Skip to content

feat(captures): error codes and a problem summary for patch apps - #9

Merged
jaspermayone merged 2 commits into
mainfrom
feature-capture-errors
Nov 9, 2026
Merged

jaspermayone merged 2 commits into
mainfrom
feature-capture-errors

Conversation

@jaspermayone

Copy link
Copy Markdown
Member

What

A capture that fails now says why in a form a patch app can act on, and the archive says what to fix.

  • captures.error_code (migration: one nullable string column): not_public, not_found, blocked, too_large, timeout, tool_failed, unexpected. The Capturers::Error subclass is the code. error keeps the message.
  • Clear messages for private sources. A Google Doc, Slides deck, Sheet or Drawing that is not shared with anyone with the link answers 404, 401 or a redirect to the sign-in page; all three become not_public with "Ask the owner to share it, then run the archive again." The sign-in redirect used to be stored as a done capture with Google's login HTML inside. GitHub's 404 on a private repository, git clone without access, yt-dlp's "Private video" and gallery-dl's "login required" are not_public too. 404 and 410 are not_found; 403 and 429 are blocked. A bad GITHUB_TOKEN (401) blames the token, not the submitter. A video past the size limit is too_large.
  • Archive#problem: the failed capture whose code matters most to the submitter, with code, method, message and a hint written for a person. The API returns it as problem on every archive; the archive page shows it in a callout, and each failed capture shows its code.
  • docs/api.md documents error_code, problem and the table of codes. docs/design.md explains the classes.

Krater already polls GET /api/v1/archives/:id; the follow-up in Krater is to read problem and show problem.hint on the project page and to the submitter. Krater ignores the new keys until then.

Checks

  • bin/rails test: 81 runs, 0 failures. New tests: the Google export against stubbed 404, 401, 302-to-sign-in and 429 (WebMock), direct downloads at 404 and 403, git and yt-dlp output classification against a stubbed subprocess, Archive#problem, the API shape, the job's codes.
  • bin/rubocop: clean. herb linter and formatter: clean.
  • Adversarial review (Claude): seven findings, all fixed in the second commit. The two that mattered: the sign-in redirect stored as a done capture, and gallery-dl's classification matched the URL on the logged command line (a tweet id with "404" in it read as not found), so classification now reads the tool's own output only.

Migration

add_column :captures, :error_code, :string, nullable, safe under strong_migrations. The repo has no migration label yet.

@jaspermayone
jaspermayone merged commit e4518da into main Nov 9, 2026
9 of 11 checks passed
@jaspermayone
jaspermayone deleted the feature-capture-errors branch November 9, 2026 04:04
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