Skip to content

[CTX-0244] feat(ipc): frameHash lossless digest method - #421

Merged
Xuepoo merged 1 commit into
mainfrom
carryctx/ctx-0244
Sep 8, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
carryctx/ctx-0244

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Priority: P2 | Area: ipc | Labels: feat,area:ipc,P2 | Milestone: v0.1.0 | RFC: OQ-xxx | Task: CTX-0244

Closes #420.

Owner-approved spec (decisions not relitigated): bitty.debug/frameHash digest method per .worktrees/ctx-0244/ctx-0244-design-note.md. Raw pixel channel stays deferred indefinitely — this PR implements NO pixel transport.

What it does:

  • SHA-256 (std-only FIPS 180-4; no sha2 in lockfile, no new dep) over canonical BFH1 || width_be32 || height_be32 || frameSeq_be64 || headless_rgba; response is 32-byte hex + geometry, < 512 bytes.
  • Same CTX-0188 consent minter; NO new scope (debug.trace + terminal.inspect); NEW AutomationFamily::FrameDigest (Capture never widened, both directions tested).
  • TTL cap 120 s (default minter refuses digest grants fail-closed); 2 digests/s; local-attested transport only (attest_local_peer at the verified accept boundary; no TCP listener exists); ScopeDenied fail-closed on all auth failures; Unavailable on empty surfaces (never a hash of nothing).
  • Granted AND denied calls audited in the existing bounded (64, drop-oldest) log with the served digest hex.
  • Runtime publishes presented headless frames only while a digest grant is live (zero cost otherwise) and only for headless presents (stale GPU buffers can never bind a new frame number).

Tests (all headless/in-process, CI-safe):

  • NIST SHA-256 vectors + Python-hashlib cross-checked fixed canonical vector + avalanche.
  • Digest equality vs local computation across 3 geometries; full auth matrix (no-bearer/wrong-family/wrong-terminal/wrong-session/missing-each-scope/unattested/forged all ScopeDenied); TTL cap + virtual-clock expiry; rate shed + window slide; publish validation; audit boundedness + served-digest content; family isolation both directions; publish gate.
  • Socket-level proof over real Unix socket (2 tests); live-grant ceremony test is #[ignore]-gated manual-only (CI never mints real grants).

Gates (local): fmt PASS; clippy -D warnings PASS; cargo test --workspace --all-targets --locked PASS (0 failed); windows-gnu check PASS; actionlint PASS; markdownlint PASS; act -n (ci + codeql) PASS. Evidence: worktree recording/ctx-0244/ (uncommitted).

Risks / follow-ups for reviewer:

  • R1 oracle / R2 same-user boundary / R3 no localization / R4 canonical drift (algo label sha256-v1, bump on change): per design note, accepted with mitigations.
  • Denied digest calls are audited (per spec AC-8): an unauthenticated local caller can churn the 64-entry log (eviction only, memory bounded). Flagging in case the auditor wants capture-parity (granted-only) instead.
  • CTX-0242 V1-V3 wiring (harness attests same-process contexts, compares digests) is follow-up, not here.
  • Branch is carryctx/ctx-0244 (pre-existing worktree name) rather than ctx-0244/feat-* convention; rename on request.

Implements bitty.debug/frameHash: SHA-256 (std-only) over canonical BFH1 header + headless_rgba. Same CTX-0188 consent minter, no new scope, new AutomationFamily::FrameDigest (never widens Capture), TTL cap 120s, 2 digests/s, local-attested transport only, ScopeDenied fail-closed, digest audit in the bounded log. Raw pixel channel stays deferred. Task: CTX-0244, Closes #420.
@Xuepoo Xuepoo added this to the v0.1.0 milestone Sep 8, 2026
@Xuepoo Xuepoo added feat Feature area:ipc Area: IPC / MCP boundary P2 Priority: medium labels Sep 8, 2026
@Xuepoo
Xuepoo merged commit 3f5ed24 into main Sep 8, 2026
10 checks passed
@Xuepoo
Xuepoo deleted the carryctx/ctx-0244 branch September 8, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ipc Area: IPC / MCP boundary feat Feature P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CTX-0244] Pixel-capable lossless frame path: frameHash digest method

1 participant