Skip to content

Prove registry key unambiguity in Lean; evidence five more core laws - #391

Merged
0thernet merged 14 commits into
mainfrom
claude/fv-claims-core-laws
Sep 25, 2026
Merged

0thernet merged 14 commits into
mainfrom
claude/fv-claims-core-laws

Conversation

@0thernet

Copy link
Copy Markdown
Member

The provider-plugin registry's route key (<transport>:<surfaceId>) and exact-contract key (<transport>:<surfaceId>/<operation>@<contractVersion>) are now proven unambiguous in Lean — each key parses back to its parts and no two valid coordinate tuples share a key — with a seeded unseparated-key defect refuted and differential tests binding the Lean model to the TypeScript grammars. The lane also evidences five more core laws: injected clocks in the approval broker, serialized plugin lifecycle, CAS no-rollback, no-writes-on-read-paths, and local-CLI post-spawn indeterminate.

Claims moved (6)

Claim Layer Evidence
identifier-roundtrip lean RouteKey.lean: parse_routeKey, routeKey_injective, parse_operationKey, operationKey_injective, plus the operationKeyUnseparated defect refutation; differential rsurf/rop/rkey/okey against isProviderPluginSurfaceId, isProviderPluginOperationName, routeKey, operationKey
lifecycle-injected-clocks stateful-model approval-broker two-clock model (src/control/approval-broker-clock.model.test.ts)
plugin-lifecycle-serialized stateful-model src/provider-plugin-lifecycle-kernel.test.ts (+310)
state-cas-no-rollback stateful-model src/storage-cas.model.test.ts (+242)
no-writes-on-read-paths example D14 admission-claim example; gap narrowed to the fingerprinted examples
local-cli-post-spawn-indeterminate quint local-cli.qnt (Apalache length 8, 2,000 × 8-step samples) + 628-line production replay

Evidence and how the evidence fails when broken

  • Lean. lake build --wfail compiles the new module with warnings as errors; the axiom audit counts all 66 required theorems with their recorded statement digests; proofs.json registers the RouteKey theorems and the operationKeyUnseparated seeded defect, which the audit proves refutes operationKey_injective.
  • Differential. scripts/verification-lean-encodings.test.ts generates identifier candidates heavy in key separators and near the length bounds and asserts the Lean validSurface/validOperation/routeKey/operationKey agree with the TypeScript; the seeded defect's counterexample is rejected by production.
  • Local-CLI model. local-cli.qnt checks postSpawnIndeterminate/noRespawn; stepRetryTimeout and stepTrustNotStarted mutants must violate them; scripts/verification-local-cli-replay.test.ts replays 1,000 seeded traces through production.
  • Honest scope. identifier-roundtrip's notVerified records that the grammars are modelled by hand from their regular expressions, that the differential test samples generated inputs, and that the registry's positive-safe-integer check on contract versions is not modelled.

Defects found

  • None new in production; the lane narrowed two notVerified gaps to their measured extent (smuggled-key, read-path writes) so the claims describe exactly what the examples fingerprint.

Package budget

Only src/provider-plugin-registry.ts ships (+6 lines: routeKey/operationKey exported with doc references to the proofs). Lean files, proofs.json, models, and tests stay out of the package.

CI cost

Lean build time grows by one 277-line module plus differential property runs; local-cli.qnt adds an Apalache length-8 check and a 1,000-trace replay to the Required verification job.

Not covered

  • Registry keys for identifier grammars other than surface IDs and operation names (adapter, auth, run IDs, portable operation identities, cursor tokens, platform catalog IDs) remain example/property-tested only.
  • The Lean model is hand-derived from the regexes; the differential test samples generated inputs rather than proving the regex itself.
  • Local validation on this host: bun run verify:lean passed fully (build --wfail, axiom audit, all seeded defects, differential tests); typecheck and claims render/check pass post-merge. Helper-heavy stateful suites are delegated to the Required CI run on this head.

🤖 Generated with Claude Code

0thernet and others added 11 commits September 24, 2026 13:37
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…production replay

Finish the interrupted model and replay: each distinct runner script runs once
per runtime, the replay compares 1,000 traces, and the claim moves to evidenced.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tateful models

A fast-check command model drives the real bound state helper with current
and stale snapshot writers and removers, an unconditional recreate, and a
swap for a symbolic link. A second model drives the plugin lifecycle
quiescence kernel over generated live, settled, and malformed work for two
bundles. Both catch seeded defects; their shrinks are named examples.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…model

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The cache-read example now removes only a dead owner's admission claim and
leaves every other file's bytes unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tent

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Route keys and exact-contract keys read back to their parts and are
injective over the four transports and the surface and operation
grammars, with a seeded unseparated-key defect refuted. The differential
tests check routeKey, operationKey, and the two identifier grammars
against the Lean model.
…-laws

# Conflicts:
#	docs/assurance.md
#	verification/quint/models.json
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ghostget Ready Ready Preview Sep 25, 2026 4:15am UTC

Request Review

The checker test borrowed the register's last planned Lean claim to
exercise the proof-plus-differential rule; with every Lean claim now
evidenced, that fixture no longer exists and the check itself failed.
Borrow an evidenced claim instead, which exercises the same rule.
0thernet added a commit that referenced this pull request Sep 25, 2026
… reading (#393)

## Summary

Fixes a wrong-field assertion in the browser-admission `fc.commands`
model that intermittently fails `test 6/8` on `main` and on every lane
merged past #392.

`run()` asserted that a refusal while a slot was available must have
consumed a **clock reading** at or past the bound (`lastRead >= bound`).
But simulated time advances without a reading: `sleep` adds its delay
and the test commit hook adds `commitDelayMs` directly to `clock.now`. A
1 ms budget can expire on the deadline's field check before any
subsequent reading — `lastRead` still 0 while `now` is already past the
bound.

Observed on #391's `test 6/8`, seed `797548962`, counterexample
`acquire({"timeoutMs":1,"captureRemainingMs":1,"increments":[],"commitDelayMs":1})`:
the commit hook advanced `now` to 1, the capture deadline's field check
fired before the next `now()` read, production refused legitimately —
and the assertion rejected it at `lastRead=0`.

The fix compares `real.clock.now`, which is what the deadline itself
observes. A refusal while a slot was free still must be justified by
simulated time reaching the bound — the check is not weakened. Same
correction at the capture-launch assertion (line 469).

#### Test plan
- [x] Mechanism traced: `lastRead` only updates in `readClock`;
`sleep`/`afterCreateCommitForTest` advance `now` field-only;
`deadline.throwIfUnavailable` checks the field before
`throwIfUnavailable` reads `now()`
- [ ] CI `test 6/8` passes (local replay blocked by host load; the
failing schedule runs the real bound state helper)

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

# Conflicts:
#	docs/assurance.md
#	verification/quint/models.json
@0thernet
0thernet merged commit b718fbc into main Sep 25, 2026
27 checks passed
@0thernet
0thernet deleted the claude/fv-claims-core-laws branch September 25, 2026 04:26

This branch was successfully deployed

1 active deployment
Preview — 9223bd9c Deployed Sep 25, 2026 by vercel[bot]
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