Skip to content

Keeping a page lives in one module with one retry policy - #118

Merged
NiallJoeMaher merged 1 commit into
mainfrom
arch-keeping-a-page
Oct 27, 2026
Merged

NiallJoeMaher merged 1 commit into
mainfrom
arch-keeping-a-page

Conversation

@NiallJoeMaher

Copy link
Copy Markdown
Contributor

lib/library/keeping.ts (was lib/capture.ts) now owns keeping an Item's page: keepNow, keepLater, keepFile, keepImported, the queued try (keepQueued), when a failure is final, and the one Extracted → ExtractionResult mapping. jobs.ts is a table of handlers. The run-and-retry loop moved to lib/job-runner.ts, so keepLater can kick the queue without import("../jobs"). That removes the import cycle.

The retry policy. Tries are counted on the Item (extraction.attempts). A page gets four: one now, then one 30 s, 2 min and 10 min after each failure. The fourth failure is final. A 4xx (except 408 and 429), a refused address or a file over 50 MB is final straight away. The job queue's own retries (5 tries, 30 s × 2ⁿ) only re-run a try whose result was never written, for example while the database is down. Links behave as before.

Behaviour changes:

  • Files from the iPhone. A missing upload, or a file that can't be read, is now a failed try under the same policy. Before, the generic job retry handled it and left the Item pending forever once the job gave up (the old shortcut: comment). Now the Item is marked failed after about 13 minutes, with "The file has not arrived." as lastError.
  • The kick after a multi-link pluck. It now runs only extract jobs (claimJob takes an optional queue), not everyone's digests and imports.

Tests: keeping.test.ts runs against the fixture server and covers keeping now, a retry after keeping later, four tries then a final failure, and a 4xx that fails at once. files.test.ts is updated for the missing upload.

Gates: pnpm typecheck ok, pnpm lint ok, pnpm test 71 files / 449 tests pass. pnpm e2e and pnpm design were not run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7

@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pluck Ready Ready Preview Oct 27, 2026 7:28am UTC

Request Review

…rary no longer imports the job queue

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Per4f8yL5A7nL9frZVDJj7
Signed-off-by: NiallJoeMaher <nialljoemaher@gmail.com>
@NiallJoeMaher
NiallJoeMaher merged commit cfe03b6 into main Oct 27, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant