Skip to content

Fix correctness, performance, privacy and content issues found in review - #8

Merged
VeteranXYZ merged 2 commits into
mainfrom
review/full-audit-fixes
Sep 3, 2026
Merged

VeteranXYZ merged 2 commits into
mainfrom
review/full-audit-fixes

Conversation

@VeteranXYZ

Copy link
Copy Markdown
Owner

Summary

  • apply the completed correctness, performance, privacy, and content fixes
  • add Workers AI translation support and translation rate limits
  • keep the GitHub main branch aligned with the version already verified and deployed to Cloudflare

Verification

  • local verification completed before deployment
  • Cloudflare production deployment completed successfully

VeteranXYZ and others added 2 commits September 2, 2026 20:01
Correctness
- Refuse a phrasebook template unless it covers ~all of the input. Substring
  matching silently replaced a long classroom sentence with a short template
  and dropped the rest of what the child typed.
- Show where the English came from (stored phrase / translation / word pile).
  The "local-words" fallback is now labelled as not being a sentence, and is
  excluded from sentence speech and from cloze practice.
- Bound Chrome's built-in Translator with a timeout and an availability check.
  A pending model download used to hang the whole analysis with no fallback.
- Look wordbook cards up by word when reading aloud. Due-word order differs
  from render order, so the highlight tracked the wrong card.
- Defer revoking the export blob URL; revoking in the same tick cancels the
  download on Safari and iOS.
- Wire the phrase lexicon into the runtime. findPhraseMatches/getPhraseMeaning
  were unreachable, so "show your work" was always split into single words.
- Quiz: reset the round on entry, cancel pending advance timers on navigation,
  and de-duplicate options by the label the child actually reads.
- Count "不确定" as its own outcome instead of folding it into `wrong`.
- Mission: say that practice words are added to the wordbook, and let words
  whose meaning only arrives from the network still enter the mission.

Performance
- Cache the normalized wordbook. Every word card asked whether it was starred,
  costing dozens of parse-and-normalize passes per sentence.
- Only run the full reverse-dictionary scan after translation actually fails.
- Patch the wordbook list in place on a review tap instead of rebuilding it,
  which threw away focus and scroll position.
- Split the runtime lexicon into an eager head (596 KB) and a deferred long
  tail (585 KB), cached after activation rather than during install.
- Bound OCR compression to 5 predicted attempts instead of up to 36 encodes.

Privacy and security
- Route translation through a same-origin /api/translate backed by Workers AI,
  replacing the browser's direct call to an unauthorized Google endpoint.
- Add an offline-only mode that stops every optional network call, with the UI
  no longer offering what it has been told not to do.
- Drop 'unsafe-inline' from the CSP; inline script hashes are generated at
  build time and audit:seo fails if it returns.
- Name upstream licences on the sources page and disclose the OCR client id.

Accessibility and content
- Implement roving tabindex and arrow/Home/End navigation for the tab bar.
- Add a dark theme; align theme-color, manifest id/lang/maskable icon.
- Stop speaking on page entry; focus the play button instead.
- Render the authored steps, keywords and sample replies on the phrases page,
  which were generated into the phrasebook and never shown to anyone.
- Reword the OCR "misrecognized" panel, which asserted an error that may not
  exist, and the stop-word explanation.

Repository
- Remove the dead Pages deployment path, _routes.json, unused image assets,
  the retired legacy lexicon, and personal documents from the public repo.
- Move the shared worker code under worker/ and make the worker test pool
  hermetic; split the dependency audit out of the release gate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@VeteranXYZ
VeteranXYZ merged commit 0c3a78d into main Sep 3, 2026
2 checks passed
VeteranXYZ added a commit that referenced this pull request Sep 3, 2026
Fix correctness, performance, privacy and content issues found in review
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