phase 2 rework

This commit is contained in:
admin_rb committed 2026-10-23 18:19:44 +02:00
1 parent 20054198f3
commit b397ea9256
44 files changed
+5528 -1377

No files matched your search

+4 -2
View File
@@ -2,9 +2,11 @@
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.
**Phase 1 release 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. Later UI verification is recorded in the [Phase 2 report](phase-2-ui.md).
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.
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.
After installing the resolution fix, the user confirmed that downloads paused, waited for confirmation, retried the affected episode, and successfully completed the queue. The supplied log contained the expected structured `resolution` result. This is user-reported deployment validation; the assistant has not accessed the production server or inspected the underlying source response. A resolution result alone does not identify the exact type of verification page.
## Executed checks
+141
View File
@@ -0,0 +1,141 @@
# Phase 2 refinements: dashboard, worker activity, naming, and session cache
Implementation date: 23 October 2026.
The user confirmed that a series and a single episode completed successfully with the first Phase 2 interface, then requested these refinements. This update is applied over `Proxer-Downloader-phase2-ui-update.zip`. It preserves the confirmed verification-pause/retry behavior and the entire original `scripts/lib/` tree.
## Interface changes
`/` is now the Dashboard. The top bar links Dashboard, New download (`/download`), Queue, and Workers. Old `/?mode=series` and `/?mode=video` bookmarks redirect to the corresponding form.
The Dashboard and Queue begin with a horizontally scrollable card strip showing each managed worker's current claims, filename, source episode/language, start time, elapsed time, and current file size. Empty cards distinguish idle, paused, stopped, and uncertain activity. Existing claims without worker metadata appear in a separate unassigned section. Supervisor failure leaves saved claims visible and marks the live inventory unavailable.
The Dashboard also provides four clickable state totals and the latest five completed and five failed-attempt records. Failed attempts can remain in history after a retained episode subsequently succeeds. Polls run every ten seconds while visible, without duplicate summary polling. Failed refreshes retain the last results and mark them stale.
The Queue's danger button is beside Refresh and follows the server-selected state and URL:
| Selected state | Action |
|---|---|
| Queued | Clear waiting queue |
| Active | No destructive action; active downloads are protected |
| Completed | Clear completed history |
| Failed attempts | Clear failed history |
Confirmation states that the action applies to all records in that state, including records outside a search/page. History clearing does not remove media. Waiting-job deletion uses `{processing: {$ne: true}}` atomically, so a job claimed before deletion is preserved. The server accepts only the four known states, rejects active clearing, and requires an acknowledged deletion. Navigation/refresh keeps the action disabled while a new state is loading or a refresh has failed.
Workers offers **Quick add worker**, with server-assigned names `proxer-worker-1`, `proxer-worker-2`, etc. A MongoDB counter is seeded from the highest existing numbered PM2 name, including unrelated processes, then incremented atomically. Deletion/restart does not recycle numbers; a failed creation may leave a gap. Concurrent quick-add submissions reserve different numbers. An optional custom-name form remains available. Existing managed-script and numeric-ID restrictions remain in effect.
## Series names
The series form adds Season, default 1. Season 0 is allowed for specials. The title should not already include a season or episode suffix.
```text
Title: My Series
Season: 1
Episodes: 9–10
Language: engsub
My SeriesS001E009_engsub.mp4
My SeriesS001E010_engsub.mp4
```
Season and episode use a minimum of three digits, following the user's requested `{title}S{XXX}E{XXX}` pattern. Larger values expand rather than truncate. The language suffix stays immediately before `.mp4`. Filename previews and server planning use the same format and enforce the existing 255-byte limit including extension.
Season is filename metadata only. Proxer episode numbers are used unchanged; this update does not map absolute episode numbers into season-relative numbering. Series and season folders are not created. Single-episode explicit/default names, queued filenames, existing files, standalone Python CLI names, and older direct API requests that omit `season` keep their existing behavior.
The three-digit format is the requested local convention. Plex's [official TV naming guide](https://support.plex.tv/articles/naming-and-organizing-your-tv-show-files/) illustrates `sXXeXX` and separately discusses folder organization; it does not establish a mandatory three-digit width. Test one imported episode against the library's existing scanner and episode ordering.
## Session cache and access checks
A blank token field uses the token saved in the existing MongoDB `settings` collection. A supplied token replaces the cache only after a successful source-access check. The page always renders an empty password field and shows only safe metadata: saved/missing/replacement-needed status and last successful check time. Token values are absent from HTML/JSON responses, browser storage, URLs, raw upstream errors, and logs.
Every submission is checked, including repeated use on the same day. There is no fixed 24-hour expiration assumption or validation bypass based on cache age. Source/filename/output validation happens before the access probe, and no queue write happens until access succeeds.
The probe requests the first planned canonical HTTPS Proxer watch page using the configured cookie and `stream_choose=proxer-stream`. It requires positive `"code":"..."` evidence matching the protected resolver's source-access contract. It does not download media or alter `scripts/lib/`. Requests are capped at twelve seconds and one MiB; credentials are never forwarded through redirects or to other hosts.
| Result | Behavior |
|---|---|
| Positive source-access evidence | Save/revalidate the token, then enqueue with that verified credential |
| No cached token and blank field | Ask for a token; add no jobs |
| Explicit rejection | Ask for a current token; invalidate the exact rejected cache revision; add no jobs |
| CAPTCHA/verification challenge | Ask for verification and a refreshed token; keep cache; add no jobs |
| Missing first source | Ask to check series, episode, and language; keep cache; add no jobs |
| Network, timeout, rate limit, server error | Report unavailable validation; keep cache; add no jobs |
| Unrecognized source response or redirect | Report that access could not be verified; keep cache; add no jobs |
| Cache read/write failure | Report unavailable token storage; add no jobs |
Concurrent updates use revision comparisons, including rotation after successful revalidation. An older rejected check cannot erase a newer saved or successfully revalidated token. A stale successful request cannot overwrite a newer replacement. Each accepted batch uses the credential actually checked for that submission.
This is a download-access check, not an assertion of account identity. The configured cookie can serve different purposes; Proxer's [published API documentation](https://proxer.me/wiki/Proxer_API/v1) describes a separate API-key/token mechanism. No new API key or login automation is introduced.
Existing queued jobs keep their original token. Rotation after enqueueing can still trigger the existing worker pause. The cache is shared by this application's database and is covered by the same MongoDB access and backup protection as queued credentials. There is no multi-user token ownership or encryption-key migration in this refinement.
## API and data additions
- `GET /dashboard-data`: `{counts, global, activity, recent: {done, failed}}`.
- `GET /status-data`: retains the paginated Phase 2 shape and adds `activity`.
- `GET /status-summary`: still only `{counts, global}`; no job, log, token, filesystem, or supervisor reads.
- `POST /clear-state`: form body `state=queued|done|failed`; `processing` returns 409. Legacy clear endpoints remain scoped to their named states.
- `POST /pm2/quick-add`: accepts an empty body and returns the server-assigned worker name on success.
- `POST /queue`: `season` is optional for legacy series clients; a blank/missing token now uses the cache. Submission success is reported only after a confirmed insert/batch result. An uncertain queue write instructs the user to inspect the queue before retrying because partial insertion remains possible.
Activity includes `workers`, `unassigned`, `available`, `truncated`, and `workersTruncated`. Each worker includes safe identity/status fields and bounded public jobs. At most 51 processing records are read to display 50 and detect truncation; at most 50 worker cards are shown. PM2 inventory is cached for ten seconds with a single shared in-flight read. File metadata is read only for displayed active claims and the existing visible processing/completed queue page. Recent history reads at most five records per history state.
New claims atomically store `{name,pid,host,run_id,started_at}` under `worker`. A match requires the current host, an unambiguous live PID, and compatible worker/process start times. PID reuse, missing identities, and stopped/replaced processes do not create invented attribution. Claim release removes the metadata. This identity is diagnostic; it is not a lease, recovery lock, or new authority to release a claim.
Two additive settings records are used:
- `worker-name-sequence`: the highest reserved quick-add number.
- `proxer-session-token`: the credential and internal revision plus safe status timestamps.
No migration of existing queue or history records is required. No dependency versions, Python entrypoints, streaming code, or environment-variable contract change.
## Verification
The final integrated `npm test` run passed **258 tests: 214 Node and 44 Python**, with no failures, skips, or cancellations. The protected-tree guard matched all seven original files before and after the run; `git diff --check` passed. Tests use local fixtures and injected database, process, and network interfaces.
| Suite | Passed |
|---|---:|
| Python downloader | 44 |
| Node-to-Python integration | 5 |
| Protected-library guard | 10 |
| Runtime services | 25 |
| HTTP and WebSocket services | 19 |
| Submission, status, and safe templates | 19 |
| Worker lifecycle | 39 |
| Status query and form model | 16 |
| Worker browser behavior | 11 |
| Worker attribution and dashboard reads | 14 |
| Numbered quick-add | 10 |
| Season naming and clear-state integration | 11 |
| Token cache and HTTP probe | 24 |
| Token/controller integration | 11 |
| **Total** | **258** |
Token tests cover validation on every submission, cache metadata secrecy, explicit rejection versus challenges/network failures, first-source ordering, no queue writes after failed checks, bounded/no-redirect probes, bodyless/error responses, and concurrent replacement/revalidation/invalidation races. Clear-state tests cover a concurrent claim, allowlisted predicates, acknowledgements, and preservation of media. Worker tests preserve the confirmed pause/retry and result-validation behavior.
A separate Playwright run in Chrome **151.0.7922.34** passed **42 browser checks** with zero JavaScript errors and no external requests. It used the real Express application, queue/dashboard/PM2 controllers, EJS/browser assets, activity service, and token-cache service with synthetic MongoDB/PM2/probe interfaces. Expected test failures deliberately returned HTTP 400, 409, and 503.
The browser run exercised real series/single form POSTs, season-zero and three-digit preview agreement, saved-token reuse/replacement/rejection, unavailable validation with cache retention, state-specific clearing with cancellation and active protection, quick-add selection and duplicate-command suppression, focused-link/log preservation, and shared-summary isolation. Worker cards show an overflow cue and can be scrolled with the keyboard.
Desktop views at 1440 × 1000 and all four pages at **390 × 844** and **320 × 844** were checked without page-level horizontal overflow. Screenshots were visually reviewed; the worker strip intentionally scrolls horizontally within its own container. Local runtimes were Node.js 24.19.0 and Python 3.12.14.
Live production MongoDB, PM2, authenticated media, and Plex import were not exercised in this workspace. The previous production workflow success was reported by the user. The new live access probe requires a valid cookie on the Debian host for acceptance.
## Deployment and acceptance
Use the `UPDATE.md`, manifest, read-only checker, and checksums in the refinement ZIP. Wait until both waiting and active counts reach zero, stop the actual web process and currently online managed workers, back up the application/configuration/database, and apply the complete `files/` overlay. Run preflight before copying and postflight plus the protected check/tests afterward. Restart the web process and the workers that were previously online. Reload open browser tabs.
The web entrypoint is still `server.js`; the worker entrypoint is still `queue_worker.js`. Run both as the download account. Existing `.env`, virtual environment, dependencies, and `/mnt/media/WIP` files stay in place. This refinement needs no new sudo privilege.
Recommended production acceptance checks:
1. Open `/`: the Dashboard is the landing page; worker cards show the newly restarted workers.
2. Quick-add two workers and verify their distinct incremented names, selection, and logs.
3. Submit a short series with Season 1, checking the filename preview. Submit another request with the token blank and confirm reuse.
4. Try a rejected token and confirm a visible warning with no new jobs. Restore a valid token. A connection/challenge warning must not claim definite expiry.
5. Check a current download card against its worker logs and file size. Verify the existing pause/manual-resume/retry flow still works.
6. Switch queue states: confirm the danger action changes; cancel a clear confirmation once, then clear disposable completed/failed history and verify media remains.
7. Import one `TitleS001E009_engsub.mp4` sample into the existing Plex library and confirm its series/season/episode mapping.
The next planned phase remains the shared execution refactor. Durable recovery, safe drain controls, advanced worker policies, and enforced speed limits remain later roadmap work.
+119
View File
@@ -0,0 +1,119 @@
# Phase 2: interface and bounded status reads
Implementation and verification date: 23 October 2026.
**Historical baseline:** this report describes the first Phase 2 ZIP, which the user installed and confirmed worked for both series and single episodes. The subsequent [Phase 2 refinements](phase-2-refinements.md) add the dashboard, worker attribution, season naming, quick-add, and token caching. Use the newer deployment instructions for that update; it requires restarting workers as well as the web process.
The user authorized this phase after confirming that the Phase 1 resolution fix paused downloads, retained the affected episode, waited for confirmation, retried successfully, and completed the queue. That execution baseline remains intact.
## What changes
### Navigation and shared status
A responsive top bar links New download, Queue, and Workers, with active-page indication, a pending-count badge, and a queue readiness/verification indicator. The interface uses local CSS and JavaScript without the previous Bootstrap CDN dependency. It includes keyboard focus styling, a skip link, labeled controls, and layouts that adapt to narrow screens.
The existing verification banner is available on every page. It retains the cautious resolution/authentication messages and the existing **Resume after verification** action. A status refresh failure keeps a known pause visible and marks the status unavailable.
Non-queue pages poll the lightweight summary endpoint. The queue page updates the shared status from its own result, avoiding a second history request. Polling is bounded, avoids overlapping reads, and pauses when the document is hidden.
### Download submission
Series and Single episode use native radio controls. Fields for the inactive mode are disabled, so hidden fields cannot interfere with browser validation or submission. A no-JavaScript mode switch is available through ordinary links.
The form previews the actual legacy filename convention, episode count, and configured destination. Series padding follows the width of the last requested episode. Single-episode language comes from its URL. Client-side range/name checks provide immediate feedback; server validation remains authoritative.
The token starts as a password field and has an optional show/hide button. It is not written to local/session storage or query parameters. Validation errors retain safe non-secret fields and require the token again. Successfully queued batches redirect to the queued tab with an episode-count notice.
### Queue and history
The four state cards select Queued, Active, Completed, or Failed attempts. The selected state has literal case-insensitive filename search, 10/25/50 items per page, stable ordering, and previous/next navigation. Filter state is represented in the URL and works with browser back/forward navigation.
Automatic refresh preserves unsent search input, existing row nodes, expanded logs, and log scroll positions. Manual refresh and an auto-refresh toggle support close inspection. File sizes use readable binary units; no guessed percentage or transfer rate is shown.
Failed attempts are labeled as attempts: the verification flow can keep an episode queued and later complete it while its earlier failure remains in history. History/queue clearing controls are grouped below the list and confirm their complete scope. They affect all records in the named state, including records outside the selected filter or page. History clearing leaves media files on disk. Active downloads remain protected from blanket flag clearing.
### Workers
The worker page provides named worker creation, a selectable worker list, CPU/memory/uptime details, and the existing start/stop/restart/delete operations. Controls show action results and prevent concurrent commands. Stop, restart, and delete ask for confirmation because they can interrupt work.
Keyed row updates preserve worker selection and focus during polling. The log viewer supports following output, holding the scroll position while inspecting older lines, clearing only the visible log, and reconnecting. Logs are rendered as text, bounded to 64 KiB of UTF-8 content. Switching workers closes the previous subscription and rejects delayed events from an obsolete socket.
These controls use the established server restriction to this checkout's managed workers. This phase does not introduce worker limits, bandwidth caps, new persisted settings, or automatic recovery.
## Status API
`GET /status-data` and the server-rendered `/status` accept:
| Parameter | Accepted values | Default |
|---|---|---|
| `state` | `queued`, `processing`, `done`, `failed` | `queued` |
| `q` | Literal filename text, at most 100 characters, no control characters | Empty |
| `page` | Positive whole number, at most 100000 | `1` |
| `pageSize` | `10`, `25`, `50` | `25` |
Arrays/objects and malformed values are rejected with a safe HTTP 400 response before querying the database. Search text is escaped before use in the MongoDB regex and searches only filenames.
The JSON response shape is:
```json
{
"items": [],
"counts": { "queued": 0, "processing": 0, "done": 0, "failed": 0 },
"pagination": { "page": 1, "pageSize": 25, "total": 0, "totalPages": 1 },
"filters": { "state": "queued", "q": "" },
"global": { "captcha_blocked": false, "pause_reason": null }
}
```
`items` contains only the selected page of public jobs. `counts` covers all records in each state; `pagination.total` reflects the selected state's filename filter. An out-of-range page is clamped after counting. Empty results have page 1 of 1.
`GET /status-summary` returns only `counts` and `global`. It does not load job records, output logs, cookies, or filesystem metadata. Both JSON endpoints use `Cache-Control: no-store`.
Only the selected processing/completed page receives file-size checks. Records retain the Phase 1 public projection and exact-value credential redaction. The pause reason remains restricted to `authentication`, `resolution`, or null.
This replaces the previous four-array `/status-data` shape. The bundled frontend is updated together; any external client using `queued`, `processing`, `done`, and `failed` arrays must adapt to the paginated contract.
Each MongoDB read is bounded to five seconds. Sorting uses the existing state timestamp with `_id` as a deterministic tie-breaker. Bounded page retrieval reduces response size and file reads; exact counts, case-insensitive substring search, and high-offset `skip` can still become expensive on very large legacy collections. Index/cursor planning remains part of Phase 4. No migration or background index build is performed.
## Automated verification
`npm test` passed **183 tests: 139 Node and 44 Python**, with no failures, skips, or cancellations. The entire protected tree matched the original baseline before and after the run.
| Suite | Passed |
|---|---:|
| Python downloader | 44 |
| Node-to-Python integration | 5 |
| Protected-library guard | 10 |
| Runtime services | 25 |
| HTTP and WebSocket services | 19 |
| Submission, public status, and safe templates | 19 |
| Worker execution lifecycle | 36 |
| Status query/pagination and form model | 16 |
| Worker interface behavior | 9 |
| **Total** | **183** |
New query tests cover literal-search escaping, malformed query shapes, stable sorts, skip/limit bounds, page clamping, selected-page-only reads, summary isolation, token redaction, symlink refusal, and form retention without credentials. New worker UI tests cover safe DOM text, bounded Unicode logs, selection/socket races, command serialization, cancellation, named creation, errors, and page cleanup.
Local test runtimes are Node.js 24.19.0 and Python 3.12.14. Database, PM2, and stream dependencies in tests are synthetic interfaces. No test contacts production MongoDB or downloads authenticated media.
## Browser and visual verification
A separate Playwright run in Chrome 151.0.7922.34 passed **27 browser checks with no failures**. It served the real application factory, queue controller, EJS templates, and browser scripts with synthetic database records and local worker/log simulators.
The checks exercised real form POSTs for both modes, native keyboard mode selection, filename padding and language derivation, client range validation, server validation with credential removal, literal filename search, bounded page reads, pagination/browser Back, and refresh preservation of open logs, focus, scroll position, and unsent search input.
They also exercised the resolution banner and resume action while retaining the affected queued record, safe HTML rendering, worker selection and refresh, log follow/scroll, scoped stop confirmation, named creation, and shared-summary isolation. No JavaScript errors or external/CDN requests occurred. The deliberately invalid form POST produced its expected HTTP 400 response.
Desktop screenshots at 1440 × 1000 and all three pages at 390 × 844 and 320 × 844 were visually inspected. Navigation, controls, forms, rows, process details, and logs fit without horizontal overflow. These are local fixture checks; the user will validate the new interface in the existing Debian deployment.
## Deployment scope
Apply the Phase 2 ZIP over the installed Phase 1 update **including the resolution fix**. The archive contains a read-only preflight checker, a per-file manifest, checksums, installation instructions, and only the changed/new project files.
The Node worker, Python entrypoints, `scripts/requirements.txt`, Node dependencies, environment-variable contract, and every file under `scripts/lib/` are unchanged from the installed fix. Keep `.env`, the Python environment, dependencies, and media in place.
Stop the web process while copying the complete update and restart that web process after verification. Existing downloader workers do not need a code restart for this phase. Reload already-open browser tabs so they use the new API/frontend pair. No database migration is required.
The production web entrypoint remains `server.js`. The worker entrypoint remains `queue_worker.js`. Run both under the download account with its existing media access; Phase 2 requires no additional privilege or sudoers rule.
For rollback, stop the web process, restore all replaced web files from the backup, and remove the Phase 2 additions identified by the manifest before restarting it. Keep the installed Phase 1 worker/resolution fix. Restore a matching frontend/API pair together.
+14 -4
View File
@@ -2,17 +2,17 @@
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.
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. After installing Phase 1 and the resolution fix, the user confirmed successful episode downloads, verification pause, manual confirmation, retry of the affected episode, and completion of the full queue. The user then authorized Phase 2, confirmed that both series and single downloads worked with its UI, and requested the dashboard, state-specific clear actions, numbered workers, current-download cards, season naming, and MongoDB token caching. The assistant has not accessed or changed the production 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.
**Current status:** Phases 0, 1, and 2 are implemented locally. The user confirmed the initial Phase 2 workflow in production; the requested refinements are documented in the [current report](phase-2-refinements.md), including their acceptance checks. They preserve the [unresolved-link pause fix](phase-1-resolution-fix.md). Phase 3 is the next planned implementation phase and awaits authorization.
| 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 |
| 2 — UI shell and requested refinements | Responsive top bar; default dashboard; active worker cards; accessible submission with season preview; filters, pagination and state-specific clear actions; numbered quick-add; per-submission token-cache validation | Both modes work on mobile/keyboard; refresh preserves interaction state; bounded activity/history; failed access checks never enqueue or expose tokens; protected stream unchanged |
| 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 |
@@ -22,10 +22,20 @@ All phases preserve the exact contents and paths under `scripts/lib/`. New code
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.
Phase 2 delivers the top-bar redesign and improves the existing worker controls. Persisted advanced worker settings and enforced bandwidth control remain in Phase 5. Neither Phase 1 nor Phase 2 installs a bandwidth limit, privileged helper, network namespace, traffic-control rule, systemd unit, or sudoers entry.
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.
## Phase 2 boundaries
The first UI release changed only web code and did not require a worker restart. The subsequent requested refinements add diagnostic identity to atomic worker claims and clear that identity when a claim is released. The metadata does not grant ownership, implement a lease, authorize recovery, or change download/verification behavior. Restart both web and workers after applying the refinement update to enable attribution on future claims. Drain waiting and active work before stopping and replacing worker code.
Series naming changes only for new web requests that explicitly provide `season`. The form always provides it; legacy clients that omit it retain their previous names. Existing files, queued filenames, standalone CLI names, and all Python/protected stream code are unchanged.
The token cache and numbered worker counter add documents to the existing `settings` collection. Existing queue credentials are not rewritten. Access checks use the first requested source and cannot guarantee validity after a token rotates mid-queue. No destructive migration is introduced.
Selected status results remain paginated, recent history is capped at five records per history state, and activity reads/display are capped at 50 jobs and 50 workers with explicit truncation notices. The shared summary avoids record/log/file/PM2 reads. Exact counts and literal filename searches still query legacy collections. Index planning, cursor pagination, durable ownership, recovery, and grouped jobs remain in Phase 4.
## 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.