phase 1 rework
This commit is contained in:
1 parent
211bfd174d
commit
20054198f3
38 files changed
+5001
-1019
No files matched your search
@@ -0,0 +1,69 @@
|
||||
# Phase 1 baseline and compatibility boundary
|
||||
|
||||
Reviewed upstream commit: `211bfd174dd78eac36f3c74411ecaa72f56eec79`.
|
||||
|
||||
This baseline describes the source checkout, not a verified production deployment. The Phase 1 review and automated checks use synthetic job records, temporary files, and controlled subprocesses. They do not contact the production database or fetch authenticated media.
|
||||
|
||||
## Protected library
|
||||
|
||||
`scripts/lib/` is immutable for this rollout. The complete reviewed directory contains two Python source files and five tracked Python bytecode files. All seven files have the executable bit set in the original Git tree (`100755`). Their original contents and that Git-relevant mode are recorded in [the manifest](../tests/fixtures/protected-lib-manifest.json).
|
||||
|
||||
Run the read-only integrity check from the project directory:
|
||||
|
||||
```sh
|
||||
node tools/check-protected-lib.js
|
||||
```
|
||||
|
||||
The check verifies SHA-256 content hashes, file types, executable bits, the directory structure, and the exact set of entries. Extra bytecode, hidden files, empty directories, symbolic links, removed files, and changed files cause failure. It does not rely on `.gitignore` or only on tracked-file differences. It never imports a Python module or rewrites the manifest.
|
||||
|
||||
Future Python commands must disable bytecode output (`python -B` or `PYTHONDONTWRITEBYTECODE=1`) before loading the protected modules. Do not regenerate the baseline to accept an unexpected change. Investigate and restore the original protected tree instead. Directory ownership and ordinary read/write permission bits are deployment concerns; the integrity check preserves Git's executable/nonexecutable distinction without requiring a specific UID, GID, or umask.
|
||||
|
||||
The checker regression tests mutate only temporary copies:
|
||||
|
||||
```sh
|
||||
node tests/protected-lib.test.js
|
||||
```
|
||||
|
||||
## Captured compatibility fixtures
|
||||
|
||||
[legacy-contracts.json](../tests/fixtures/legacy-contracts.json) records examples of the old CLI flags, filenames, and MongoDB document shapes. Every token, object ID, timestamp, title, and log is fictional. The source URLs describe valid input syntax only and must not be fetched by fixture tests.
|
||||
|
||||
| Entry point | Required arguments at the reviewed commit | Filename convention |
|
||||
|---|---|---|
|
||||
| Video CLI | `-u/--url`, `-f/--filename`, `-t/--token`, `-o/--output` | Explicit filename plus `.mp4` |
|
||||
| Series CLI | `-i/--id`, `-n/--name`, `-e/--episodes`, `-l/--language`, `-t/--token`, `-o/--output` | `{name}_Episode_{episode}_{language}.mp4` |
|
||||
| Web video | `mode=video`, `url`, `token`, optional `filename` | Default `{id} E{episode} {language}`, then `.mp4` at execution |
|
||||
| Web series | `mode=series`, `id`, `language`, `episode_from`, `episode_to`, `token`, optional `name` | `{trimmedNameOrId}E{paddedEpisode}_{language}`, then `.mp4` at execution |
|
||||
|
||||
Web series episode padding uses the width of the final episode number. The standalone series CLI does not use that padding. The supported language values are `engsub`, `engdub`, `gersub`, and `gerdub`. The actual CLI parsers required the flags above even though the original README described some arguments as optional.
|
||||
|
||||
The source web form submitted the title as `name`, but video enqueue looked only for `filename`. Accepting the form title as a fallback is an intentional Phase 1 correction. Explicit legacy `filename` input remains meaningful.
|
||||
|
||||
## Legacy job data
|
||||
|
||||
The reviewed `queue` documents contain URL, cookie token, filename, and enqueue time, plus an optional `processing` boolean. The `done` and `failed` documents contain filename, terminal time, and output log, but generally lack the original URL and token. The fixtures preserve these limitations rather than inventing retry information.
|
||||
|
||||
The atomic queue claim already exists in the original source. Phase 1 does not claim to introduce expiring ownership, recovery, exactly-once execution, or a new authoritative job schema. Those belong to later phases. In particular, a process killed during an attempt can still leave a legacy processing record requiring deliberate reconciliation; it must not be made eligible again while its child is still running.
|
||||
|
||||
## Deliberate corrections and boundaries
|
||||
|
||||
Phase 1 establishes truthful Python results and worker handling, handles child startup errors, validates inputs and output containment, removes the blanket processing reset, and limits public response fields. Error reports must not expose submitted credentials or signed media URLs. A download must not be recorded as complete merely because a broad keyword search did not find an error.
|
||||
|
||||
The protected functions continue to resolve the embed URL, resolve the MP4 URL, and download the file in that order. New result handling is outside `scripts/lib/`. The protected transfer function still has no byte-resume, rate-limit, socket-timeout, or structured-progress hook. Its no-content-length path can buffer the response; completion checks based on a nonempty file alone cannot establish full media integrity.
|
||||
|
||||
The initial Phase 1 release classified the protected library's missing-page-marker error as an ordinary source failure. Following a report that this consumed successive queued episodes during a possible verification challenge, the current revision classifies it as `resolution` and pauses at the first occurrence while preserving the queued request. This is an attention gate, not proof of CAPTCHA. The [fix and recovery note](phase-1-resolution-fix.md) explains the distinction and existing failed-job handling.
|
||||
|
||||
The user-interface redesign, durable lease/retry model, temporary-file publication design, and actual bandwidth control are later-phase work. Any Phase 1 tests that simulate process outcomes establish application behavior under those outcomes; they do not prove remote Proxer compatibility or performance on the intended server.
|
||||
|
||||
## Review gates
|
||||
|
||||
Before accepting a Phase 1 change:
|
||||
|
||||
1. Run the protected-library integrity check.
|
||||
2. Run the Node and Python regression suites, with Python bytecode writes disabled.
|
||||
3. Confirm the synthetic filename and CLI contracts, allowing only the documented corrections.
|
||||
4. Confirm failed exit codes, missing result records, malformed results, and child startup errors cannot become successful jobs.
|
||||
5. Confirm status payloads and rendered logs do not reveal tokens or raw process environments.
|
||||
6. Run the integrity check again to catch generated files as well as edits.
|
||||
|
||||
Deployment-specific preparation and the external bandwidth feasibility decision are documented in [Debian 13 deployment](debian-13-deployment.md).
|
||||
Reference in new issue
Block a user