Skip to content

[CTX-0004] Verify live-host parity for history reads over the public API - #9

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-0004/verify-history-parity
Oct 4, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-0004/verify-history-parity

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: architecture | Labels: chore,P1,area:architecture | Milestone: v0.1.0 | RFC: W-137 | Task: CTX-0004

Closes #1

Independent verification (no Lua/manifest changes): replays the 33-probe live Core battery against the mock host and the real entry point.

Evidence

  • Live Core: bitty @76fa42d6 (PR #1673, W-139 HistoryGate), read-only git-archive export; gate suite 25 passed, 0 failed.
  • Battery: tests/fixtures/live-host-matrix.json (33 probes) generated by tests/fixtures/live-matrix-generator.rs (scratch-run, committed for regeneration).
  • Mock suite: 24/24 green (untouched). New tests/live-host-parity.test.ts: 18 tests. Total 42 pass, 0 fail; just check green.
  • bitty/ untouched (git status clean); Core build artifacts under workspace .targets (removed after run).

Parity table (all 3 sources: transcript/commands/kv)

  • Bounded one-shot snapshots: identical pages (bodies/labels/redacted/truncated/seqs/total) incl. tail/search/tail ops.
  • Per-source grants: transcript grant never implies commands/kv (E_HISTORY_MISSING_GRANT both hosts).
  • Purge/expiry: list over purged-only range denies E_HISTORY_UNAVAILABLE; search over purged content returns an empty page (no oracle signal) on both.
  • Oracle-tight denials: all 8 codes identical; no denial text on either host carries content bytes, foreign ids, or counts.
  • Untrusted labels: untrusted-observation on every record, surviving redaction+truncation (incl. char-boundary cut of multibyte bodies).
  • KV own-namespace only; KV rejects panel/workspace extents.
  • No session-snapshot access: session/snapshot/session-snapshot fail closed (Disabled diagnostic live, E_DEF_INVALID plugin-observable).
  • No streaming: cursor-free pages; fresh queries replace state; window budget 4+deny identical.

Documented raw-layer deltas (deny-vs-deny, unreachable via plugin)

  • Scope-construction failures: live Disabled diagnostic (no E_ code) vs mock E_DEF_INVALID/E_HISTORY_SCOPE_MISMATCH throws; plugin validates client-side first, so plugin-observable codes are identical.
  • L3 + standing grant: live E_HISTORY_MISSING_GRANT vs mock E_HISTORY_TRUST_DENIED (plugin never runs at L3).
  • Grant-scope narrowing parked to Core W-146: live denies out-of-grant scopes; mock filters rows under its unscoped capability grant. Both keep foreign bytes out of unauthorized hands under the current grant model.

Residual / follow-up

  • W-146 narrowed-grant intersection needs a second parity pass once the mock models narrowed grants.
  • No independent reviewer sign-off yet; no merge (verification task stops at PR).

Independent verification evidence only: replays the 33-probe live Core battery (bitty @76fa42d6, PR #1673 HistoryGate) against the SDK mock host and the real lua/history/init.lua. Asserts identical denial codes, identical success shapes across transcript/commands/kv, oracle-tight denials, KV own-namespace isolation, no session-snapshot access, and one-shot snapshot semantics. No Lua or manifest changes. Task: CTX-0004
@Xuepoo Xuepoo added this to the v0.1.0 milestone Oct 4, 2026
@Xuepoo
Xuepoo merged commit aea5ce3 into main Oct 4, 2026
5 of 7 checks passed
@Xuepoo
Xuepoo deleted the ctx-0004/verify-history-parity branch October 4, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Independently verify integration security and migration parity

1 participant