Skip to content

refactor(app): why Aleph refused a backup, as data (BK1) - #1075

Merged
NiKrause merged 1 commit into
mainfrom
refactor/backup-refusal-core
Dec 1, 2026
Merged

NiKrause merged 1 commit into
mainfrom
refactor/backup-refusal-core

Conversation

@NiKrause

@NiKrause NiKrause commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

First step of #1074 (BK1). No visible change: texts and data-testids are as before.

What

  • app/src/lib/backup/core/refusal.js (new, headless): a refusal as plain data – { code, retry, alephCode?, credits?, required? } with code one of credits | file-unavailable | not-allowed | invalid | unknown and retry one of no | after-credits | after-grant | maybe. Three ways in: refusalOfError (thrown by the browser key's path or reported by the bridge), refusalOfRecord (a row of the history), refusalOfCode (Aleph's code alone). The codes follow pyaleph's ErrorCode list; one it does not list stays unknown.
  • run.svelte.js: the words for a refusal, "was it a refusal", and the errorCode written to the row read the module.
  • BackupCard.svelte: "the file is gone, no retry" reads refusalOfRecord(b)?.code === 'file-unavailable' instead of comparing with 4; FILE_NOT_FOUND leaves keeper.js.
  • eslint.config.js: src/lib/**/core/ is headless – no Svelte, SvelteKit, session, catalogue or browser globals.

Not in here

The row still shows no reason and still offers a retry for every code but 4: that is #1067, a visible change with its own PR on top of this.

One edge differs: a refusal for credits in which Aleph names an amount that is no number now reads as the general refusal text instead of showing "NaN".

Tests

  • core/refusal.spec.js (node, no browser): one case per way a refusal arrives, known and unknown codes, rows Aleph did not refuse.
  • Locally: vitest --run src/lib/backup (99 passed, 1 skipped), pnpm check, pnpm lint, e2e/backup.spec.js (covers the retry and the refusal after pending). The rest of the E2E suite is left to CI.

🤖 Generated with Claude Code

A headless module, backup/core/refusal.js: a refusal's code, whether asking
again can work, Aleph's own code and the amounts when it named them – read
from a thrown error, a row of the history, or Aleph's code alone. The run's
words for a refusal, the row it writes and the card's "the file is gone"
read it; texts and test ids are as before.

backup/core/ is the first folder of logic that runs without the page: a
lint rule keeps Svelte, SvelteKit, the session, the catalogue and the
browser's globals out of it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@NiKrause
NiKrause merged commit 15dadbb into main Dec 1, 2026
16 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