Skip to content

Follow-ups: dart-run replay CLI via pure-Dart i18n split + page-level a11y audit#91

Merged
albertzhzhou-droid merged 1 commit into
mainfrom
replay-cli-and-a11y-followups
Jun 11, 2026
Merged

Follow-ups: dart-run replay CLI via pure-Dart i18n split + page-level a11y audit#91
albertzhzhou-droid merged 1 commit into
mainfrom
replay-cli-and-a11y-followups

Conversation

@albertzhzhou-droid

Copy link
Copy Markdown
Owner

Summary

Closes the two concrete follow-ups documented in #89.

1. dart run Local-AI replay CLI — finally unblocked

The CLI had been documented as future work in three consecutive PRs because the
recommendation orchestrator transitively imported Flutter via app_i18n.dart.
The actual Flutter surface there turned out to be just three members, so this
PR splits them out instead of refactoring i18n broadly:

  • lib/core/i18n/app_i18n_context.dart (new) — the BuildContext.appI18n
    extension (AppState provider lookup) and appI18nLocaleFor (tag → Locale),
    re-exporting app_i18n.dart. The 13 UI files + app.dart now import this;
    app_i18n.dart itself is pure Dart. No behaviour change (same logic,
    same listen: false semantics).
  • tool/run_recommendation_scenario_replay.dart + .mjs wrapper +
    npm run recommend:replay — replays the five archetypes with the same
    offline scripted Local AI stand-in as the test harness, writes
    build/recommendation_scenario_replay/latest.{json,md}, and exits non-zero
    iff the candidate-set invariant is violated.
  • Verified byte-identical artifacts between the CLI and
    flutter test test/local_ai_replay_report_test.dart (md5-compared), so the
    two entry points cannot drift from each other.
  • Docs updated: the "Why there is no dart run CLI" section is replaced with
    CLI notes; the reviewer order in PUBLIC_VERIFICATION.md now starts with
    npm run recommend:replay.

2. Page-level accessibility audit (was blocked on asset loading)

test/accessibility_semantics_test.dart gains a real CatalogPage widget
test: a stub CachingAssetBundle serves a valid 1×1 PNG plus a
StandardMessageCodec-encoded AssetManifest.bin, so the brand images render
under flutter_test; a local-mode AppState is constructed in a guarded zone
(sqlite init is unavailable on the test VM and irrelevant); a phone-sized test
viewport avoids layout overflow. The test asserts the accessible "view details"
labels are exposed by the real page's semantics tree — upgrading the previous
construct-level checks to a page-level audit.

Validation (all run, all green)

  • dart format --set-exit-if-changed . clean; flutter analyze no issues
  • flutter test --concurrency=1745 passed
  • npm run recommend:replay → 5 scenarios, invariant held, exit 0
  • CLI vs test artifact: byte-identical (json + md)
  • npm run public:preflight 0 BLOCKER; npm run privacy:preflight 0 blocker
  • git diff --check clean

Remaining follow-ups (intentionally untouched)

  • Language-tagged alias model (LocalizedAlias) — only if per-locale alias
    filtering becomes a requirement; flat lists still suffice.
  • Kana below the catalog engine's CJK threshold — widening _hasCjk would
    shift existing confidence assignments; deliberately left alone.

Educational prototype only; synthetic/demo data only; no medical advice; not
calibrated for real care.

🤖 Generated with Claude Code

… a11y audit

Closes the two concrete follow-ups documented in PR #89.

1. Local-AI replay CLI (unblocked after three PRs)
   - Split the Flutter-facing i18n members out of app_i18n.dart into a new
     lib/core/i18n/app_i18n_context.dart (BuildContext extension, AppState
     provider lookup, Locale mapping as appI18nLocaleFor). app_i18n.dart is now
     pure Dart, so the whole recommendation stack compiles under `dart run`.
     The 13 UI files + app.dart import the context file (which re-exports
     app_i18n.dart); pure-Dart consumers are untouched. No behaviour change.
   - New tool/run_recommendation_scenario_replay.dart (+ .mjs wrapper,
     `npm run recommend:replay`): replays the five archetypes with the same
     offline scripted Local AI stand-in as the test harness and writes
     build/recommendation_scenario_replay/latest.{json,md}. Verified the CLI
     and `flutter test test/local_ai_replay_report_test.dart` produce
     byte-identical artifacts. Exits non-zero iff the Local-AI candidate-set
     invariant is violated.
   - Docs: LOCAL_AI_REPLAY_REPORT.md "Why there is no dart run CLI" replaced
     with the CLI notes; PUBLIC_VERIFICATION.md reviewer order + snapshot
     section now reference `npm run recommend:replay`.

2. Page-level accessibility audit
   - test/accessibility_semantics_test.dart gains a real CatalogPage widget
     test: a stub CachingAssetBundle serves a valid 1x1 PNG (and a
     StandardMessageCodec AssetManifest.bin) so brand images render under
     flutter_test, with a local-mode AppState in a guarded zone and a phone
     viewport. Asserts the accessible "view details" labels are exposed by the
     real page semantics tree.

Educational prototype only; synthetic/demo data only; deterministic; no medical
advice; not calibrated for real care; no PHI. Gates: dart format clean, flutter
analyze clean, flutter test 745 passed, public:preflight 0 BLOCKER,
privacy:preflight 0 blocker, `npm run recommend:replay` runs end-to-end, git
diff --check clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@albertzhzhou-droid albertzhzhou-droid merged commit afe654f into main Jun 11, 2026
3 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