Files
Proxer-Downloader/docs/phase-1-resolution-fix.md
T
2026-10-23 16:38:55 +02:00

91 lines
4.9 KiB
Markdown

# 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.