Repository navigation
dt64/r2il: stamp MethodRef with its issuing store and binding digest; make Prepared private - #1979
Merged
Merged
Conversation
…d private A store admitted another store's MethodRef for reversed effects (P1-5), and Prepared's public fields let a caller edit `steps` after prepare checked them. dt64: - BindStore gets a private Arc<()> identity; Clone is manual and mints a fresh one (D2), so a clone is another store. - Each method's binding digest (FNV-1a 128, tag dt64.binding.v1: classid, basis witness, id, sig_rev, ON/reads, ordered effects with lens rev and arity, population/truth/demand; not name, not guard) is stored at insert. - MethodRef gains `stamp: Stamp` (private issuer + digest, no public constructor). MethodRef::of is removed; BindStore::method_ref issues refs. - admit: existing checks, then stored digest (BindingMismatch), then issuer (ForeignStore). New Refusal variants BindingMismatch, ForeignStore. r2il: - run, prepare_native and run_native refuse a plan whose reference another store issued (ExecRefusal::Binding(ForeignStore)). - Prepared fields are pub(crate) with read-only getters; compile_fail doctest. - plan_id hashes the binding digest. Lane kind is not hashed: lanes are bound per run, never on Prepared (C5). Call sites moved to method_ref in dt64, r2il, report, dir-sim, math-polyfill-probe, grammar-constraints-probe, dt64-admission-probe and xlog-relcomp-probe tests/examples. Ruling: EXO-199. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMMWgnUU9g7Ldyn6sbk
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A
MethodRefwas plain data: class, method id, signature revision and guard. Two problems followed.BindStorewas admitted by another store that had bound a method with the same number but different effects. The lab probe measured a cross-store method with reversed effects being admitted.Preparedexposedpub steps, andrunexecuted them after checking onlypermit.methods.contains(&plan.method). A caller could therefore swap in different steps after preparation (r2ilbinding.rs, prior lines 153-161 and 340-363).The ruling is Linear EXO-199 (D1/D2):
Change
dt64
MethodRefgains one pub opaquestamp: Stamp. It carries the issuer (Weak<()>) and a 128-bit binding digest, has private fields, and no public constructor.The stamp comes from the store:
BindStore::method_refandMethodRef::of.BindStoreimplementsCloneby hand, and each clone mints a fresh identity (D2).derive(Clone)would have shared the identity.admitchecks, in order:BindingMismatch;ForeignStore.Only in this order can both refusals fire.
r2il
Prepared's fields are private, with getters (method,steps,lens,route,guards,plan_id).run,prepare_nativeandrun_nativecheck the stamp's issuer against the store. A plan prepared against another store, or a clone of it, is refused.plan_idhashes the binding digest.Constraints
unsafecode.Non-test diff: dt64
lib.rs+211/−19, r2ilbinding.rs+67/−15,binding_native.rs+11/−4. The plan docd-dt64-6-routing-bindstore-behavior-v1.mdgains contract section A.6.Call sites updated
ofcalls, 6Preparedfield reads (now getters)In grammar-constraints-probe, a
stamped()helper keeps the old refusals for refs built from descriptions. dr-math-binding-probe has its own localMethodRefand is unaffected.Tests
a_reference_to_reversed_effects_is_refused_as_another_bindinga_stamp_moved_to_another_method_is_refuseda_same_binding_from_another_store_is_refused_as_foreigna_cloned_store_refuses_the_originals_referencea_plan_prepared_or_run_against_another_store_is_refuseda_native_plan_prepared_or_run_against_another_store_is_refusedcompile_faildoctests:Prepared::stepscannot be mutated, and aStampcannot be built.Disable runs
All five ran after the commit. Each patch was asserted to apply once, then restored with
git checkout.derive(Clone)instead of the manual implrun/run_native/prepare_native, each alonePrepared::stepsmadepubcompile_faildoctestValidation
All runs used
CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 CARGO_INCREMENTAL=0.cargo test: dt64 95 passed, r2il 87, report 55, all with 0 failures. The dt64 and r2il counts were re-run independently.clippy --all-targets -D warningsis clean for dt64, r2il and math-polyfill-probe.cargo fmt --checkis clean.Open
plan_iddoes not include the lane kind.Preparedholds no lanes (they are bound per run), and adding them would make plans source-specific. This is recorded in the plan.runchecks the issuer before guards and route, so a clone with identical routes reportsForeignStore.matchonRefusal. External code is unknown, so the two new variants may break it.Generated by Claude Code