Skip to content

FlashDay evidence kernel bootstrap — vendor + bridge seam (no merge) - #1

Merged
Thunderkill016 merged 6 commits into
mainfrom
flashday/evidence-kernel-bootstrap
Oct 1, 2026
Merged

Thunderkill016 merged 6 commits into
mainfrom
flashday/evidence-kernel-bootstrap

Conversation

@Thunderkill016

@Thunderkill016 Thunderkill016 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

FlashDay evidence kernel bootstrap on EchoType

Vendored FlashDay vNext kernel + a forge-proof evidence bridge + the first real vertical slice (mission.meet_new_person) through the actual UI, verified end-to-end in Chromium with durable IndexedDB evidence.

Baseline (upstream deccdf5e)

pnpm install clean · typecheck PASS · biome PASS (647 files) · vitest 1081 pass / 3 skip · build PASS (69 pages). Full audit in docs/flashday/BASELINE_AUDIT.md.

What shipped

  • Kernel vendored byte-identical at src/vnext/ (27 files, cmp-verified; ui/ excluded as FlashDay-shell code).
  • Evidence bridge (src/lib/evidence-bridge/): caller supplies observed reality + registered taskId; semantics are re-derived from the contract — capabilityId, purpose, context, freshness, transfer, binding cannot be authored by the caller. bindAttempt/bindObservation mint kernel-valid evidence; projectState replays; nextAction runs the shipped reference selector with an exposed reason.
  • Dexie evidenceEvents table (schema v21), append-only with fingerprint dedupe: identical re-delivery dedupes, same-id-different-content refuses (no last-write-wins), add-race re-checked atomically.
  • Session driver (session.ts): deterministic attempt ids recomputed from the committed log, support_use + stamped snapshot before commit, feedback only after evidence lands, live-task selection lock, learner-scoped mirroring.
  • UI: /mission page (intro → diagnostic → input → retrieval/interaction with real support controls → feedback → summary) + "Next For You" card on /dashboard. Every served step renders the planner's reason.

Verification on 8b540e8

  • pnpm typecheck — PASS
  • pnpm lint (biome, 656 files) — PASS
  • pnpm test — 1124 pass / 3 skip (187 files; +43 vs baseline: bridge contract pins + session/falsification pins)
  • Playwright (Chromium, real IndexedDB):
    • mission-meet-person — full slice: Today → intro → diagnostic pass/fail → hinted retrieval → guided (modelAnswer) partial → clean retry → refresh → +25h → delayed → transfer → fresh assessment → summary. 31 evidence events asserted in Dexie.
    • mission-falsification — refresh at prompt/feedback/summary, back/forward nav, double-submit idempotency, forged+garbage row injection → recovery, no credit.
  • Artifacts: test-results/mission-*.png, mission-events.json, mission-served.txt.

Falsification findings (all fixed in 8b540e8)

Finding Fix
Second learner inherited resumed state + foreign rows in selection syncEvents mirrors only the session's learnerId
Post-reload commit stamped support:{} despite landed support_use stamp unions logged support_use via kernel unionSupport
Concurrent identical commits crashed (ConstraintError) instead of deduping append re-reads on add failure: identical → dedupe, different → refuse

Known limitations

  • Typing stands in for speech; STT/pronunciation still cannot mint independent credit (kernel asr/ai_llm authorities are correctly excluded).
  • Demo clock fdn:timeOffsetMs exists dev-only — production builds cannot fast-forward the kernel-owned retention lag.
  • missionRunId not stamped (kernel bind doesn't carry it).
  • Only mission.meet_new_person is wired (fixture registry).
  • Playwright reuses the local Chrome binary (executablePath) because CDN downloads are slow here.
  • A hand-crafted IndexedDB row replicating a contract exactly could still mint credit — there is no signature/HMAC; local-device forgery needs a server trust anchor (out of scope for v0).

Draft — pending external review. Do not merge.

Thunderkill016 and others added 6 commits October 1, 2026 17:18
…ynthesis

Fork-of-record: Thunderkill016/flashday-next ← Talljack/echo-type @
deccdf5 (MIT). Baseline green: typecheck, biome, 1081 vitest, build.

Architecture: EchoType stays the product shell; the FlashDay vNext
kernel owns capability/evidence/planner semantics via a narrow
bindAttempt bridge. FSRS remains memory-only; assessment demoted to
placement estimate.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…@85ce4101)

The evidence kernel — capabilities, contracts, evidence, bind,
evaluators, projection, learner-model, planner, next-for-you,
correction-episodes, curriculum-checks, persist, store-memory,
risk-priors, mission-runner, pilot-harness, fixtures + the one external
dep core/mission-checks.js — vendored unchanged so the tested engine is
the shipped engine. ui-session.js + ui/ excluded (FlashDay-UI coupled).

Excluded from biome lint/format: vendored upstream code must stay
byte-identical to FlashDay src for future sync diffs.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EchoType submits a registered taskId + what the learner did; the
contract derives everything semantic (capability, purpose, context,
freshness, transfer, authority). Deterministic contracts re-score the
response — a UI 'correct=true' can never mint evidence.

- createRegistry runs the kernel authoring gate (checkCurriculum);
  fixtureRegistry wires the vendored curriculum byte-for-byte
- submitAttempt/submitObservation → bindAttempt/bindObservation →
  append-only Dexie event store (new table evidenceEvents, schema v21,
  fingerprint-deduped, conflict-throwing)
- projectState replays events → capability milestones
- nextAction → selectNextTask in shipped reference mode (B0/B1 stay
  experiment surfaces)
- 27 contract pins: forgery rejection, correct=true≠capability,
  completion≠mastery, supported≠independent, STT≠pronunciation
  (asr authority caps at SUPPORTED), practiced≠transfer, assessment
  needs stable attemptId, FSRS fields inert, learner isolation,
  dedupe/conflict, persist→replay determinism, retention lag,
  auditable Next-For-You reason

Tests: 27/27 bridge pins; suite 1108 passed / 3 skipped;
typecheck + biome clean.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Vendor landed at src/vnext/ (mission-runner included — reference
selector path needs it), persistence is Dexie v21 evidenceEvents,
bridge API documented as shipped.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The §11 slice: one registered mission driven end-to-end by the vendored
kernel — the reference planner selects each step (reason surfaced in
UI), the session driver mirrors ui-session evidence semantics
(deterministic attemptIds from the committed log, support_use events +
stamped snapshots before commit, feedback only after evidence lands,
live-task lock, exposure never minting attempts), and Dexie
evidenceEvents is the durable replay source — refresh resumes mid-
trajectory.

- bridge: emittedEventType picks purpose×response event types;
  evaluator missingFunctions propagate for demand routing;
  submitAttempt returns {event, evalResult}; evaluationCtx carries
  learnerName for state_own_name matching
- session.ts: createMissionSession over the bridge (init/screen/start/
  view/support/play/commit/next/projection/decision)
- /mission page: intro → input → task (text/choice, support controls,
  TTS play) → feedback → summary with replay-derived capability states
- dashboard: 'Next For You' entry card under the Today surface
- mission-copy.ts: Vietnamese-first frames/hints/models ported from
  FlashDay's shipped vnext copy
- e2e/mission-meet-person.spec.ts: real-browser drive of the canonical
  learner — baseline fail on ask_name → hinted supported → clean retry
  → INDEPENDENT → +25h delayed → RETAINED → changed-context
  TRANSFERRED → fresh checkpoints — asserted against IndexedDB
  evidenceEvents, incl. refresh persistence

Tests: 1114 passed / 3 skipped (bridge 27 + session 6 new).
Browser: playwright spec green; artifacts in test-results/.

Demo seam: fdn:timeOffsetMs localStorage / __FDN_TIME_OFFSET__ shifts
the session clock so delayed_retrieval is reachable in verification —
the 24h lag remains kernel policy, only time moves.
Adversarial review of the vertical slice surfaced three evidence-integrity
defects, each pinned by a failing reproduction before the fix:

- Cross-learner leak: syncEvents mirrored the whole table, so a second
  learner saw intro.resumed=true and foreign rows fed the selector.
  Now only the session's learnerId is mirrored.
- Post-reload support stamp: support_use landed durably but the commit
  after a reload stamped support:{} — the union the projection computes
  was never written into the attempt itself. The stamp now unions logged
  support_use for the attemptId via the kernel's own unionSupport.
- Append race: get→add was not atomic, so concurrent identical commits
  crashed with ConstraintError instead of deduping. append now re-reads
  on add failure: identical dedupes, different refuses, none rethrows.

Also: the demo clock seam (fdn:timeOffsetMs) is dev-only so production
builds cannot fast-forward retention; sync() catches store rejections so
an integrity refusal can't wedge the UI busy; markPromptShown is wired so
latencyMs evidence is real.

New pins: 9 falsification unit tests + a browser spec attacking refresh
at prompt/feedback/summary, back/forward nav, double-submit, and forged
IndexedDB rows.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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