Skip to content

feat(doop): close proof and land_proposal policy rule, inert (CHE-9672) [squash] - #160

Draft
congvc-bot-x99[bot] wants to merge 2 commits into
cheese/mainfrom
agent/x99-claude-sonnet-200k/che-9672-6400c4ce8353
Draft

congvc-bot-x99[bot] wants to merge 2 commits into
cheese/mainfrom
agent/x99-claude-sonnet-200k/che-9672-6400c4ce8353

Conversation

@congvc-bot-x99

Copy link
Copy Markdown

What

CHE-9672, slice S3c of the CHE-9448 A5 landing plan (r5): the close proof and the landing policy rule. Inert.

  • server/landingProof.ts (new): verifyLanding(req, multica) -> LandingProof.
  • server/writePolicy.ts: new WriteOp land_proposal, WriteContext.landing, WriteTarget.sourcePageId, and its assertWritable rule.
  • server/pageState.ts: land_proposal joins FROZEN_OPS, so a Finished ledger page (the destination) is refused by the page rule.
  • tests/landingProof.test.ts (new): 37 tests.

How the proof works

  • LandingProof is made only by verifyLanding. A module-private WeakSet backs isLandingProof, so a spread, a JSON round trip or input-shaped object is not a proof.
  • Multica sits behind an injected LandingMultica (watcherId, trustedChecklist, decision, members). No REST path is guessed and S3a is not imported (it is not merged). S3b binds the real client.
  • Checks, in order: watcher set (else proof_unavailable); trustedChecklist; decision id and pin equal the record; link canvas and topic; the decision (kind, answered, not withdrawn, human, asked by the watcher else decision_not_watcher, topic issue, chosen label and content_snapshot both close, not disclaimed); answered_by_user_id equals human_user_id and is an owner in the member list; exactly one pin line equal to the record pin; SHA256 of the sent LOCK.json equals the pin manifest; LOCK canvas, page and frame set equal the request; each frame hash equals its LOCK entry and the SHA256 of its html.
  • Transport errors and malformed Multica data become proof_unavailable. S3a refusals pass through by .code.
  • land_proposal rule: lock and page rules first; a genuine proof is required for every context kind; canvas.projectId equals proof.projectId; proof canvas equals the canvas; the source page exists, is the proof topic, and when bound has the proof issue; the destination is the ledger page only. assertBinding is skipped for this op only, so the taskless refusal still holds for every other op (tested with create_frame).

Assumptions (stated, not asked)

  • pin is the Lock pin: ... line string.
  • "chosen option label close = content_snapshot" is checked as both being close.
  • The request carries the server-resolved sourcePageId and sourcePageName.

Red, on the base (e21b6250)

$ bunx vitest run tests/landingProof.test.ts
 FAIL  tests/landingProof.test.ts
Error: Cannot find module '../server/landingProof.ts' imported from tests/landingProof.test.ts
 Test Files  1 failed (1)
      Tests  no tests

Green

$ bunx vitest run tests/landingProof.test.ts
 Test Files  1 passed (1)
      Tests  37 passed (37)

$ bunx vitest run tests/pageFinished.test.ts tests/landingProof.test.ts tests/writePolicy.test.ts tests/finishedPageGuard.test.ts
 Test Files  4 passed (4)
      Tests  185 passed (185)

bun run typecheck, bun run lint and bun run format:check pass.

Selectors (describe blocks in tests/landingProof.test.ts): verifyLanding (valid case; settings unset; passthrough and transport errors; unrelated owner close; superseded checklist; pin, link, each decision-state code, owner role, base64 options, pin line, manifest, LOCK mismatch, frame hash) and assertWritable land_proposal (no proof, forged proof, taskless MCP agent with proof passes, other project, other issue, non-ledger destination, Finished ledger, locked frame, create_frame still refused).

Run one: bunx vitest run tests/landingProof.test.ts -t "assertWritable land_proposal".

Not covered

The gstack /verify pregate ran bun test over a wide unrelated selection and timed out (tests=TIMEOUT, bun:test has no vi.hoisted/inject). That is a runner mismatch, not a failure of this change. The vitest results above are the evidence.

Dark

Merges dark. No caller of verifyLanding or land_proposal yet (S3b). DOOP_LANDING is untouched (defaults false), DOOP_LANDING_WATCHER_ID stays unset, no C00 or production config changes.

Refs CHE-9672. Parent plan: CHE-9448.

congvc-bot[bot] added 2 commits November 26, 2026 04:23
verifyLanding rebuilds the close proof from Multica and the sent bytes.
assertWritable gains land_proposal, which needs a proof only verifyLanding
can make. No caller yet (S3b); DOOP_LANDING stays off.

This branch has not been deployed

No deployments
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.

0 participants