The Export report can print undefined #43

Open
opened 2026-08-13 15:08:17 +00:00 by aiko · 0 comments
Owner

What to build

The Export panel reports a failed sync as:

Anki has not synced to AnkiWeb yet: undefined

undefined is a JavaScript value that reached the screen — the sync failure's reason is not being read off the wire, so whatever AnkiWeb actually said is lost between the server and the panel.

Two things to fix, and the second is the one that keeps it fixed:

Read the reason. Find where the sync failure crosses the wire and carry its reason the way the per-Capture failures already carry theirs.

Make undefined unrenderable. A field that can arrive missing and be printed anyway is a shape problem, not a typo. Whatever the panel prints should come from a value the wire mapping has already turned into a string — a missing reason should read as an honest "no reason given", not as the name of a JavaScript value. Nothing the reader sees should be able to say undefined again.

Worth checking the other report lines while in there: the same pattern would produce the same result for a failure reason, a count, or a Headword that did not arrive.

Acceptance criteria

  • A sync failure shows the reason the server gave
  • A sync failure with no reason shows an honest phrase, never undefined or null
  • The wire mapping, not the renderer, is where a missing value becomes a string
  • Tests cover a sync failure with a reason and one without, asserting the rendered line in both cases
  • No other line the Export report can print is capable of rendering undefined

Blocked by

None - can start immediately.

Added after filing: one word, one line

The first real Export reported three failures, two of them the same Headword:

私たち — ffmpeg exited with 234: …
茶番  — ffmpeg exited with 234: …
茶番  — ffmpeg exited with 234: …

That is honest — two Captures of 茶番 really did fail, with different Cues and different files — but it reads as two problems when it is one word that failed twice, and it invites the reader to think Export is about to make duplicate Notes. It is not: those two collapse to one Note at Export, oldest winning, and both leave the queue.

Group the report's failures by Headword and say how many Captures each covers, so one word reads as one line:

茶番 — 2 Captures — ffmpeg exited with 234: …

Where the Captures failed for different reasons, the line must not pretend they failed for one. Same shaping code as the undefined fix, which is why it belongs here rather than in an issue of its own.

Added acceptance criteria

  • Failures are grouped by Headword, with the number of Captures each covers
  • Captures of one Headword that failed for different reasons are not collapsed into a single reason
  • The counts in the report add up to the Captures the run actually touched, so a reader can reconcile the queue count falling by more than the number of Notes made
## What to build The Export panel reports a failed sync as: ``` Anki has not synced to AnkiWeb yet: undefined ``` `undefined` is a JavaScript value that reached the screen — the sync failure's reason is not being read off the wire, so whatever AnkiWeb actually said is lost between the server and the panel. Two things to fix, and the second is the one that keeps it fixed: **Read the reason.** Find where the sync failure crosses the wire and carry its reason the way the per-Capture failures already carry theirs. **Make `undefined` unrenderable.** A field that can arrive missing and be printed anyway is a shape problem, not a typo. Whatever the panel prints should come from a value the wire mapping has already turned into a string — a missing reason should read as an honest "no reason given", not as the name of a JavaScript value. Nothing the reader sees should be able to say `undefined` again. Worth checking the other report lines while in there: the same pattern would produce the same result for a failure reason, a count, or a Headword that did not arrive. ## Acceptance criteria - [ ] A sync failure shows the reason the server gave - [ ] A sync failure with no reason shows an honest phrase, never `undefined` or `null` - [ ] The wire mapping, not the renderer, is where a missing value becomes a string - [ ] Tests cover a sync failure with a reason and one without, asserting the rendered line in both cases - [ ] No other line the Export report can print is capable of rendering `undefined` ## Blocked by None - can start immediately. ## Added after filing: one word, one line The first real Export reported three failures, two of them the same Headword: ``` 私たち — ffmpeg exited with 234: … 茶番 — ffmpeg exited with 234: … 茶番 — ffmpeg exited with 234: … ``` That is honest — two Captures of 茶番 really did fail, with different Cues and different files — but it reads as two problems when it is one word that failed twice, and it invites the reader to think Export is about to make duplicate Notes. It is not: those two collapse to one Note at Export, oldest winning, and both leave the queue. Group the report's failures by Headword and say how many Captures each covers, so one word reads as one line: ``` 茶番 — 2 Captures — ffmpeg exited with 234: … ``` Where the Captures failed for different reasons, the line must not pretend they failed for one. Same shaping code as the `undefined` fix, which is why it belongs here rather than in an issue of its own. ## Added acceptance criteria - [ ] Failures are grouped by Headword, with the number of Captures each covers - [ ] Captures of one Headword that failed for different reasons are not collapsed into a single reason - [ ] The counts in the report add up to the Captures the run actually touched, so a reader can reconcile the queue count falling by more than the number of Notes made
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mobrule/kurageyomi#43
No description provided.