Skip to content

feat(domain): prove the tutor D1 event-store seam - #18

Open
phibkro wants to merge 1 commit into
publish/0015-h3-packetfrom
publish/0017-tutor-d1
Open

feat(domain): prove the tutor D1 event-store seam#18
phibkro wants to merge 1 commit into
publish/0015-h3-packetfrom
publish/0017-tutor-d1

Conversation

@phibkro

@phibkro phibkro commented Aug 12, 2026

Copy link
Copy Markdown
Member

Design spec

design-specs/0017-tutor-d1-event-store-proof.md

Journey

A maintainer runs the tutor command lifecycle against the bounded D1-compatible event-store proof, observes append/receipt behavior, and verifies rejected or failed writes leave stream heads unchanged.

Experience it

  1. Check out this stacked branch.
  2. Run bun --cwd packages/domain proof:d1 as recorded in the spec.
  3. Inspect all deterministic cases, receipt attachment, rollback, and provenance fields.

Evidence

  • 23 deterministic cases pass twice with byte-identical output.
  • Focused typecheck passes; independent code/runtime review passes.
  • Provenance fields identify source candidate and canonical integration commits without dangling parent semantics.

What is real

The local D1-compatible SQL proof and failure atomicity are executable. This does not claim a deployed D1 binding, Worker route, scheduling, provider behavior, migration of production data, or production acceptance.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 344f3d85f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +40 to +42
const SOURCE_CANDIDATE_PARENT = "266185e98d22718576653df9973ece8246da124a";
const SOURCE_CANDIDATE_COMMIT = "7ddca9eb18c307f7c6baf47134793eda5c299db6";
const CANONICAL_INTEGRATION_BASE = "0f09064d4d85039f51127bd25b6501b71696980e";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Emit the provenance recorded by the design spec

The proof runner emits 266185e... as the source-candidate parent and 0f09064... as the canonical integration base, while the newly committed spec identifies those parents as d04f237... and e214c87... respectively. Consequently every otherwise repeatable evidence document contains lineage that contradicts its own authority, so its digest cannot serve as the claimed provenance receipt; derive these values from the reviewed lineage or make the runner and spec agree.

Useful? React with 👍 / 👎.

Comment on lines +491 to +492
const result = yield* decodeCanonicalJson(row.result_bytes, "result_bytes");
const descriptor = yield* decodeStoredDescriptor(row.descriptor_bytes);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate stored observations before returning duplicates

When an imported, manually inserted, or corrupted receipt contains canonical JSON such as {} in result_bytes, readReceipt accepts it because only JSON canonicality is checked, and an exact command retry then returns that row as a successful DuplicateResult. The migration permits arbitrary BLOB contents on insertion, and the descriptor is likewise not checked against the command/result, so this bypasses the adapter's fail-closed integrity boundary and can return a response that was never an accepted observation; decode the closed observation shape and verify its command/descriptor identities before exposing the receipt.

Useful? React with 👍 / 👎.

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