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,93 @@
|
||||
# Debian 13 deployment baseline and bandwidth assessment
|
||||
|
||||
Assessment date: 23 October 2026.
|
||||
|
||||
## Intended environment
|
||||
|
||||
The operator specified Debian 13, an application under `/home/<download_user>/`, and write access to `/mnt/media/WIP/` through the `plex` group, with `sudo` available for administration. A concrete project directory such as `/home/<download_user>/Proxer-Downloader/` can be used without hardcoding the account name in application code.
|
||||
|
||||
These are operator-supplied deployment requirements. This checkout has not inspected or changed that server, its users, PM2 state, mount permissions, MongoDB, firewall, or network interfaces.
|
||||
|
||||
### Application identity and paths
|
||||
|
||||
Run the web application, PM2 daemon, Node workers, and Python download children as the download account. Access to the media directory should work through ordinary group permissions or the existing ACL. Administrative `sudo` access does not require the application itself to execute as root.
|
||||
|
||||
Use the project's configuration for the actual locations:
|
||||
|
||||
| Setting | Intended value or requirement |
|
||||
|---|---|
|
||||
| Project working directory | `/home/<download_user>/Proxer-Downloader/`, or the chosen directory under that home |
|
||||
| `OUTPUT_DIR` | `/mnt/media/WIP` |
|
||||
| `VENV_PYTHON` | Absolute path to this project's virtual environment Python executable |
|
||||
| `MONGO_URI` | Existing deployment connection string, kept outside version control |
|
||||
| `MONGO_DB` | `downloads` unless deliberately configured otherwise; web and workers must agree |
|
||||
| `TOKEN_PREFIX` | Configured cookie name followed by `=`; do not put a live cookie token in documentation |
|
||||
| `MAX_SERIES_EPISODES` | Bounded per-submission range; Phase 1 default is 500 |
|
||||
| `PYTHONDONTWRITEBYTECODE` | `1`, in addition to the worker's `-B` launch argument |
|
||||
|
||||
The current lockfile's MongoDB driver requires Node `>=20.19.0`; verify the installed runtime against [package-lock.json](../package-lock.json). Preserve the existing Python streaming dependency versions during this phase, using an isolated virtual environment. Dependency upgrades require separate stream compatibility verification.
|
||||
|
||||
PM2 supports a systemd startup entry for a chosen user and home directory, and restores the saved process list on boot. Generate that startup integration as the intended download account and review the exact command produced for that installation. Avoid accidentally operating a second root-owned PM2 daemon. See the [PM2 startup documentation](https://pm2.keymetrics.io/docs/usage/startup/).
|
||||
|
||||
### Media access check before deployment
|
||||
|
||||
Confirm the running process identity, not only the interactive login, has the expected `plex` membership. Inspect the mount, directory traversal permissions, ACL, and available space before starting workers. If group membership was changed, restart the relevant service/session so its group list is refreshed. Existing shared media permissions should be preserved; the rollout does not call for recursively changing ownership or permissions under `/mnt/media`.
|
||||
|
||||
For a systemd-managed process, `User=`, `SupplementaryGroups=`, `WorkingDirectory=`, and `UMask=` provide explicit execution settings. A group-compatible output mask should be chosen to match the existing media policy. The actual mount's ACL may also affect resulting permissions. See Debian's [systemd.exec manual](https://manpages.debian.org/trixie/systemd/systemd.exec.5.en.html).
|
||||
|
||||
A single small create/write/remove probe by the download account can validate the intended output directory at deployment time. It has not been performed by this source-only Phase 1 work. No routine runtime command needs `sudo` merely to write an MP4 when the directory permissions are correct.
|
||||
|
||||
## Bandwidth decision
|
||||
|
||||
**Phase 1 conclusion: Debian 13 provides suitable external mechanisms, but no bandwidth backend is enabled or performance-validated by this change.** The later worker-controls phase must demonstrate global and per-worker incoming limits on the intended host before reporting a cap as enforced.
|
||||
|
||||
The protected [`download_mp4`](../scripts/lib/proxer_utils.py) implementation supplies no limiter callback and does not support byte-level resume. Preserve that transport and place enforcement outside the Python library. Delay between episodes, worker count, CPU quota, disk I/O quota, or speed measurement are different controls and must not be presented as a byte-rate cap.
|
||||
|
||||
### Recommended design: isolated worker traffic with an external shaper
|
||||
|
||||
Use a dedicated, identifiable path for Python download traffic. A worker network namespace or equivalent isolated interface is a candidate that can coexist with native PM2: the Node worker may remain under PM2 while the supervised download child enters its registered worker network context. Filesystem access and the download account remain unchanged. Debian's [ip-netns manual](https://manpages.debian.org/trixie/iproute2/ip-netns.8.en.html) documents executing namespace-unaware programs in a named network namespace. This is a proposed architecture, not a configuration already installed here.
|
||||
|
||||
A production prototype should route all participating download traffic through a common worker-bound shaping point, with one parent bandwidth budget and a class for each registered worker. A dedicated gateway interface or an IFB-based path is a possible implementation; select the exact topology after inspecting existing routes, interfaces, DNS, IPv4/IPv6, firewall policy, and local services. Classification must remain valid after address translation and must cover return traffic. Classifying an incoming download solely by the Python process ID is insufficient as a design specification.
|
||||
|
||||
Linux `tc` shapes traffic on an interface's outgoing path; inbound policing has different behavior. To control downloads, place the shaper on the outgoing side of a path leading *toward* the workers, or use a deliberately tested redirection mechanism. A limit attached only to the physical NIC's outbound traffic does not establish a download cap. See Debian's [tc manual](https://manpages.debian.org/trixie/iproute2/tc.8.en.html).
|
||||
|
||||
HTB is a candidate for a shared parent and per-worker children. Its `rate`, `ceil`, classification, and burst settings must be configured together and verified; the parent must cover all worker classes. This gives the required semantics that four workers capped at 3 MiB/s still share an 8 MiB/s global ceiling. Account for protocol overhead and the defined measurement interval when setting tolerances. See Debian's [tc-htb manual](https://manpages.debian.org/trixie/iproute2/tc-htb.8.en.html).
|
||||
|
||||
Start with one active download per worker. Keep bandwidth policy distinct from how many workers may run. A later change to multi-child workers must keep their aggregate traffic within the worker's class.
|
||||
|
||||
### Privilege separation
|
||||
|
||||
Network setup and shaping require administrative network permissions; ordinary media-directory group access does not provide them. Linux describes interface, routing, firewall, and related privileges under `CAP_NET_ADMIN`. See Debian's [capabilities manual](https://manpages.debian.org/trixie/manpages/capabilities.7.en.html).
|
||||
|
||||
The application should request a narrowly defined operation from a separately installed, administrator-controlled helper or service. The helper must resolve registered worker IDs and allowlisted rates/interfaces itself. It must not accept arbitrary shell commands, device names, scripts, or namespace paths from HTTP requests. Download children should run under the download account after entering their prepared context. Do not grant the web application unrestricted passwordless `sudo`, and do not run the web server as root to obtain traffic control.
|
||||
|
||||
Debian systemd can join a prepared namespace using `NetworkNamespacePath=` for suitable services. Its network accounting and address filtering settings are useful for observation and policy, but are not a general download-bytes-per-second limiter. See the [systemd execution manual](https://manpages.debian.org/trixie/systemd/systemd.exec.5.en.html) and [resource-control manual](https://manpages.debian.org/trixie/systemd/systemd.resource-control.5.en.html). The exact PM2/helper/service integration remains a later implementation choice.
|
||||
|
||||
### Lower-infrastructure candidate: trickle and trickled
|
||||
|
||||
Debian 13 includes `trickle`. It is a cooperative userspace shaper for supported stream sockets; its manual excludes statically linked and setuid executables. A compatible dynamically linked Python process is therefore worth testing, but the installed Python/OpenSSL/Requests stack must be measured rather than assumed compatible. The wrapper's use of library interposition also deserves explicit review against the requirement to preserve stream behavior. See the [Debian package page](https://packages.debian.org/en/trixie/net/trickle) and [trickle manual](https://manpages.debian.org/trixie/trickle/trickle.1.en.html).
|
||||
|
||||
`trickled` coordinates several participating sessions and documents an aggregate download limit. Independent standalone `trickle` processes cannot establish one shared global budget by themselves. Use a private, explicitly configured coordination socket if this candidate is tested, and verify both the local worker ceiling and the shared limit under failure and restart. See the [trickled manual](https://manpages.debian.org/trixie/trickle/trickled.8.en.html).
|
||||
|
||||
This remains a candidate, not a shipped fallback. The application must not silently run an advertised limited worker without enforcement if its limiter is missing or unhealthy. Per-job caps and dynamic cap changes should only be exposed after the selected backend's behavior is proven.
|
||||
|
||||
## Required host facts and controlled validation
|
||||
|
||||
Before implementing the limiter, establish the actual PM2 service identity and installation, Python executable, kernel/network capability availability, interface/route topology, IPv6 usage, firewall manager, and whether other applications share the proposed network path. Confirm that MongoDB and the web management interface remain reachable according to their existing access model. No assumption that `sudo` membership automatically grants a particular noninteractive helper permission should be baked into code.
|
||||
|
||||
Use a controlled local or staging HTTP/HTTPS server with generated payloads for the initial benchmark. Test the unchanged protected download function with bytecode writes disabled; no user token or production media source is necessary for that test.
|
||||
|
||||
Acceptance cases for the later implementation:
|
||||
|
||||
1. One transfer respects its cap over a specified measurement interval, including a defined short burst allowance.
|
||||
2. Two and four simultaneous workers respect both their individual ceilings and the aggregate parent budget.
|
||||
3. Idle workers release unused capacity according to the chosen sharing policy.
|
||||
4. IPv4 and IPv6 follow the enforced path, and redirects do not escape it.
|
||||
5. Resolver requests, TLS, long transfers, missing content lengths, and slow servers remain functional.
|
||||
6. Limiter loss or misconfiguration produces a visible enforcement failure; it does not silently become unlimited.
|
||||
7. Reducing or removing a cap has a documented immediate/next-job/restart behavior.
|
||||
8. Worker stop, cancellation, and reboot leave no orphan download processes or abandoned network rules.
|
||||
9. Unrelated host traffic remains outside the downloader-specific policy.
|
||||
10. All protected-library hashes and entries still match the baseline after the run.
|
||||
|
||||
No privileged helper, `tc` rule, namespace, systemd unit, sudoers rule, or bandwidth setting is created by Phase 1. This document supplies the deployment boundary and feasibility decision for the later worker-controls phase.
|
||||
@@ -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).
|
||||
@@ -0,0 +1,90 @@
|
||||
# Unresolved-link pause fix
|
||||
|
||||
Date: 23 October 2026.
|
||||
|
||||
## Observed behavior and cause
|
||||
|
||||
After installing Phase 1, the user reported that individual episodes downloaded,
|
||||
but a failure to resolve the download link was followed by failures on subsequent
|
||||
episodes until the worker was stopped manually.
|
||||
|
||||
The source code explains this path. The unchanged protected library raises
|
||||
`lib.proxer_utils.NotFoundError` when an episode page has no expected embed marker
|
||||
or a player page has no expected MP4 marker. Its HTTP request may have succeeded;
|
||||
the exception does not carry enough evidence to decide whether the page is a
|
||||
CAPTCHA/login challenge, an unavailable video, or an altered page format.
|
||||
|
||||
The initial Phase 1 classifier grouped that error with ordinary source failures.
|
||||
The worker moved each failed job into history and continued. Its pause condition
|
||||
covered verified HTTP 401/403 rejection only. That condition was too narrow to
|
||||
protect the queue in the reported situation. The actual page received on the
|
||||
user's server was not inspected, so CAPTCHA is a possible cause, not a confirmed
|
||||
diagnosis.
|
||||
|
||||
## Corrected behavior
|
||||
|
||||
| Evidence | Category | Action |
|
||||
|---|---|---|
|
||||
| Missing embed/MP4 marker reported by the protected library | `resolution` | Pause the pool immediately and retain the queued request |
|
||||
| Verified HTTP 401/403 response in the exception chain | `authentication` | Pause the pool and retain the request |
|
||||
| Verified HTTP 404 | `source` | Record an ordinary failed job |
|
||||
| Other network or validation failure | Existing category | Preserve the existing ordinary failure behavior |
|
||||
|
||||
For a resolution/access pause, the worker first persists
|
||||
`captcha_blocked: true` and its allowlisted `pause_reason`, then records the failed
|
||||
attempt, then releases only that job's `processing` and `started_at` fields. It
|
||||
does not delete the request, filename, URL, or stored token. A failed or
|
||||
unacknowledged persistence operation stops the worker instead of falling through
|
||||
to queue deletion.
|
||||
|
||||
Workers check the pause before claiming, after claiming, and again after output
|
||||
validation immediately before launching Python. A denied launch preserves the
|
||||
job without creating failed history. An already admitted transfer may finish;
|
||||
the legacy queue does not make the global read and process spawn atomic. It does
|
||||
not continue claiming while the pause remains set.
|
||||
|
||||
The banner explains that verification is needed and lists possible causes. Use
|
||||
**Resume after verification** only after checking the relevant source page. The
|
||||
action clears the pause and reason; it neither solves CAPTCHA nor updates tokens
|
||||
already stored in queued jobs. If a token expired, supplying a new token to a new
|
||||
submission does not alter older queued requests.
|
||||
|
||||
The standalone series CLI also stops at the first unresolved link and reports
|
||||
the remaining episodes as not attempted. It does not skip through the rest of
|
||||
the requested range.
|
||||
|
||||
This deliberately also pauses for an unavailable video or a parser mismatch when
|
||||
the protected library reports the same missing marker. It avoids inventing
|
||||
CAPTCHA detection from arbitrary log text or issuing additional source requests.
|
||||
No protected file, streaming call sequence, or dependency version is changed.
|
||||
|
||||
## Installation and existing failures
|
||||
|
||||
Install this fix over the previously supplied Phase 1 update. Stop the relevant
|
||||
web process and all downloader workers for this checkout, verify their children
|
||||
have stopped, and replace the complete supplied file set. Restart every worker
|
||||
along with the web process. An old Node worker does not recognize the new
|
||||
`resolution` result and would keep the earlier failure behavior.
|
||||
|
||||
Episodes already moved to failed history by the earlier release are not restored
|
||||
automatically. Those records contain the source URL, filename, and original job
|
||||
ID, but no cookie. Identify the affected episodes, check existing queued/completed
|
||||
records and output files, then resubmit the missing episodes using a currently
|
||||
valid token and their original filenames. Retain failed history while reconciling
|
||||
them. Do not bulk-clear processing claims or blindly restore every failed record.
|
||||
|
||||
No database migration or new configuration variable is required. The existing
|
||||
`captcha_blocked` field and `/clear-captcha` endpoint remain compatible.
|
||||
|
||||
## Verification
|
||||
|
||||
The complete current suite passes **158 tests: 114 Node and 44 Python**, with no
|
||||
failures or skips. The real Node-to-Python subprocess fixture reproduces both
|
||||
resolver stages, observes the new result, then verifies that the affected job and
|
||||
the next episode remain queued and no next claim is made. Other regressions cover
|
||||
pause-before-history ordering, persistence failures, concurrent claim/launch
|
||||
checks, HTTP status distinctions, series stopping, and banner/resume behavior.
|
||||
|
||||
These are controlled local tests with synthetic stream modules and database
|
||||
interfaces. No live source response or production database was used. All seven
|
||||
protected library files match the original baseline before and after the tests.
|
||||
@@ -0,0 +1,56 @@
|
||||
# Phase 1 verification report
|
||||
|
||||
Verification date: 23 October 2026.
|
||||
|
||||
**Current result: all 158 tests passed, with no failures, cancellations, or skips.** This includes the unresolved-link pause fix following the user's report of successive failed episodes. The protected library matched the reviewed baseline before and after the integrated run, and an independent check passed afterward. The initial Phase 1 release passed 141 tests.
|
||||
|
||||
The work is available as uncommitted local changes on `phase-1-reliability`, based on upstream commit `211bfd174dd78eac36f3c74411ecaa72f56eec79`. The user installed the initial file update and reported successful episode downloads, followed by an unresolved-link failure that did not pause the queue. This revision fixes that local handling; it has not been checked against the user's live source response or production server. Production validation remains part of the rollout.
|
||||
|
||||
## Executed checks
|
||||
|
||||
The integrated command was:
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
| Suite | Passed | What it establishes |
|
||||
|---|---:|---|
|
||||
| Python downloader | 44 | CLI validation, preserved filename conventions and stream call order, stdin credentials, completion records, resolution/status distinctions, and series stop/counts |
|
||||
| Node-to-Python integration | 5 | Actual subprocess invocation, credential transport, output verification, failure handling, and resolver failures that pause without consuming the next episode |
|
||||
| Protected-library guard | 10 | Exact baseline acceptance and detection of changed, added, missing, linked, or mode-altered entries |
|
||||
| Runtime services | 25 | Configuration, shared database connection handling, log redaction, and constrained PM2 operations |
|
||||
| HTTP, WebSocket, and PM2 interface | 19 | Request limits, generic errors, worker-only log subscriptions, cleanup and selection races, bounded log delivery, and safe DOM updates |
|
||||
| Web validation and status | 19 | Both submission modes, safe filenames and ranges, Unicode validation, public-field/log redaction, pause-reason allowlisting, and resume cleanup |
|
||||
| Worker lifecycle | 36 | Strict success criteria, process/storage failures, safe log truncation, pause/history/release ordering, acknowledged attention writes, and concurrent pause gates |
|
||||
| **Total** | **158** | **114 Node tests and 44 Python tests** |
|
||||
|
||||
The run used Node.js `v24.19.0` and Python `3.12.14` in the local workspace. This does not establish compatibility of the installed Python dependency stack on the intended Debian 13 host.
|
||||
|
||||
Additional checks passed:
|
||||
|
||||
```sh
|
||||
node tools/check-protected-lib.js
|
||||
git diff --check
|
||||
git diff --exit-code 211bfd174dd78eac36f3c74411ecaa72f56eec79 -- scripts/lib scripts/requirements.txt
|
||||
```
|
||||
|
||||
The protected check covers all seven original files, their SHA-256 hashes and executable bits, the exact directory structure, and unexpected entries. It found no modifications, additions, deletions, or symbolic links. The Python requirements file is unchanged. The Node lockfile retains all dependency versions; its only change adds the application's minimum Node engine metadata.
|
||||
|
||||
## Failure behavior covered by the tests
|
||||
|
||||
Completion requires exit code 0, exactly one valid completed result, and a nonempty regular output file. Nonzero exits, missing or malformed results, duplicate results, stderr-only results, signal termination, and invalid artifacts cannot become completed jobs. A nonempty file check is not full video-integrity validation.
|
||||
|
||||
Ordinary source, network, and validation failures are written to failed history without pausing unrelated jobs. Verified HTTP 404 remains an ordinary source failure. Exact protected-library missing-marker errors now produce `resolution`; these and verified HTTP 401/403 access failures set the existing global pause before failed-attempt history and release of the affected claim. They retain the full request and credential in the queue. Post-claim and final launch checks prevent newly paused work from starting; failures reading pause state leave uncertain claims held. Transfers already admitted may finish. Missing worker infrastructure or unavailable output storage retains the request and stops the worker. A handled shutdown releases only its own claim after the child has terminated; a live-child error cannot release it early.
|
||||
|
||||
History writes precede queue removal. If persistence fails, the worker stops with the processing claim held. These tests verify the ordering under simulated database results; they do not turn the legacy multi-collection sequence into an atomic transaction.
|
||||
|
||||
Submitted cookie values are sent through stdin by workers. Complete log lines are redacted before bounded accumulation, including values split across chunks. Status queries may read a token internally to sanitize older logs, but the returned DTO contains only allowlisted public fields. Neither raw tokens nor PM2 environment objects are included in those tested public responses.
|
||||
|
||||
## Test isolation and remaining deployment checks
|
||||
|
||||
The suites use synthetic jobs, temporary output files, fake database/PM2/process interfaces, and a fake browser DOM. The subprocess integration suite runs actual Node-to-Python launches against copied entrypoints and a synthetic stream module. Express body-limit tests exercise the actual parsers with in-memory HTTP objects. No authenticated media download, live MongoDB connection, PM2 daemon operation, or production-server change was performed.
|
||||
|
||||
Before production rollout, verify the target account's effective `plex` membership and write access to `/mnt/media/WIP`, its actual interpreter and existing dependencies, the MongoDB configuration, and PM2 startup under the same download account. Exercise the real stream on staging before accepting transport compatibility. Replace the worker and Python entrypoints together after existing children have stopped; the new worker requires the new result and stdin interfaces.
|
||||
|
||||
The legacy queue still has no expiring ownership or automatic worker-loss recovery. Forced kills and interrupted persistence can require reconciliation. The protected transfer still writes directly to its target and cannot resume a partial file. No bandwidth cap has been implemented or measured in this phase. These limits are tracked in the [rollout roadmap](rollout-roadmap.md) and [Debian deployment assessment](debian-13-deployment.md).
|
||||
@@ -0,0 +1,33 @@
|
||||
# Proxer-Downloader rollout roadmap
|
||||
|
||||
Baseline: upstream `211bfd174dd78eac36f3c74411ecaa72f56eec79`.
|
||||
|
||||
The user approved the roadmap and authorized Phase 1 on 23 October 2026. The intended server is Debian 13, under the download account's home directory, with `/mnt/media/WIP/` access through `plex` and administrative `sudo` available. The user has installed the initial Phase 1 update and reported successful episode downloads. A follow-up unresolved-link pause fix is prepared locally; the assistant has not accessed or changed the server.
|
||||
|
||||
All phases preserve the exact contents and paths under `scripts/lib/`. New code stays outside that directory, and Python bytecode writing is disabled.
|
||||
|
||||
**Current status:** Phase 0 review and Phase 1 implementation are complete. The current revision, including the [unresolved-link pause fix](phase-1-resolution-fix.md), passed all 158 offline tests and the protected-tree checks; see the [verification report](phase-1-verification.md). The user is testing Phase 1 on the target server. Phase 2 remains the next planned implementation phase.
|
||||
|
||||
| Phase | Scope | Acceptance gate |
|
||||
|---|---|---|
|
||||
| 0 — Review | Clone and inspect the source; map data flow and preservation boundary | Clean reviewed baseline and complete protected-tree manifest |
|
||||
| 1 — Reliable behavior | Truthful subprocess results; child startup handling; safe input/output validation; corrected video title; public status projections; safe rendering; shared configuration; deployment feasibility | Failed or malformed results cannot become successful jobs; infrastructure failures preserve pending requests; offline regressions and protected-tree checks pass |
|
||||
| 2 — UI shell | Responsive top bar; consistent visual styling; accessible submission form; filters and pagination; lightweight shared status | Both submission modes work on mobile/keyboard; refresh preserves interaction state and does not repeatedly load all history |
|
||||
| 3 — Shared execution modules | Extract the shared Python executor and Node planning/process/supervisor services; structured events; temporary output and publication policy | Compatibility of filenames/flags/stream call order; explicit results; safe output publication |
|
||||
| 4 — Recoverable queue | Explicit authoritative states; ownership and heartbeats; attempts; recovery; retries; global concurrency; grouping and indexes | Safe concurrent claims and worker-loss recovery; stale attempts cannot publish accepted output; reversible data migration |
|
||||
| 5 — Worker management | Persisted defaults/overrides; pause/drain/restart/cancel; operational limits; proven external bandwidth control | Settings are enforced and survive restarts; per-worker and shared bandwidth caps hold under concurrent transfers |
|
||||
| 6 — Release validation | End-to-end staging checks; deployment documentation; migration/rollback; pilot with one, then two, then four workers | Stable job lifecycle and recovery; measured limits; protected tree unchanged |
|
||||
|
||||
## Phase 1 boundaries
|
||||
|
||||
The legacy collections remain in place. Successful and ordinary failed jobs are still recorded in their respective history collections before removal from the queue; this sequence is not an atomic cross-collection transaction. Do not mix old and new worker code during a rollout. Stop or drain existing work before replacing the worker/script pair, because the new worker requires the new completion record and stdin credential interface.
|
||||
|
||||
The top-bar redesign and new advanced worker settings are pending. No bandwidth limit, privileged helper, network namespace, traffic-control rule, systemd unit, or sudoers entry is installed by Phase 1.
|
||||
|
||||
The Debian bandwidth assessment recommends validating a separately privileged shaper on an isolated worker traffic path. The host's actual route/interface/capability details and measured incoming-rate behavior remain prerequisites for choosing the backend.
|
||||
|
||||
## Rollback and migration
|
||||
|
||||
Keep the source version and database snapshot for each deployed phase. For Phase 1 rollback, stop the new workers and verify their children have terminated before restoring the old worker and Python entrypoints together. Additional history metadata is additive; no destructive database migration is introduced here. Rollback to the old application also restores its known reliability limitations and should be deliberate.
|
||||
|
||||
The later ownership/state migration requires draining legacy workers, preserving original records and filenames, and reconciling any in-flight attempts. Historical records lacking original source information remain historical; missing retry metadata must not be fabricated. Worker generations with different ownership rules must not run against the same active queue.
|
||||
Reference in new issue
Block a user