Route contract sugar through realize kits#840
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
CHANGES-REQUIRED Adversarial substrate-correctness review against the agreed-on substrate-vs-kit responsibilities (see PR-description summary + the just-landed #823/#830 substrate types). The kit boundary is clean, but the substrate-spine mints are not yet in place: this PR threads kit responses through as raw JSON/strings without minting
none of those three actions happen on the realize path in this PR. Findings
Substrate-vs-kit boundary verdictClean on the Java-leakage axis. Grep for Broken on the substrate-mint axis — see findings 1-4. The kit side is correct; the substrate side is degenerate (string-passthrough, no mint, no validation). RealizationPlanMemento minting verdictNot performed. This is the load-bearing audit record per spec §1.2 and the agreed substrate responsibility. The kit returns the four substrate-relevant CIDs/records ( Wrapper emission verdictNot handled, not declared TODO. Test results
RecommendationSplit decision:
If the intent is "wire the plumbing now, mint the mementos in the next PR", say so in the body and add explicit |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6c30fd1da
ℹ️ 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".
| self.ordered_plugins() | ||
| .iter() | ||
| .filter(|(declared_kind, _, _)| declared_kind == kind) | ||
| .filter_map(|(_, source, _)| load_one(source).ok()) |
There was a problem hiding this comment.
Reuse sealed plugin payloads instead of reloading sources
payloads_for_kind performs a fresh load_one(source) pass after build_registry has already sealed provenance, so the sugar payloads sent to realize can diverge from the plugin set represented by the sealed registry CID. This is observable for RPC/HTTP plugin sources (or mutable files) where a second load can return different content or fail transiently, producing non-deterministic rewrites and audit records that no longer correspond to the sealed registry.
Useful? React with 👍 / 👎.
|
|
||
| private static String render(String template, Match match) { | ||
| return template | ||
| .replace("${symbol}", match.symbol()) |
There was a problem hiding this comment.
Render JUnit witness symbols with Java-safe identifiers
The JUnit witness path sanitizes symbols for local declarations, but template rendering substitutes ${symbol} with the raw witness name. When a witness symbol is not a valid Java identifier, the generated test class can reference an undeclared/invalid token in assertNotNull(...), making emitted Java source uncompilable for those inputs. Use the same sanitized identifier in template substitution for witness emissions.
Useful? React with 👍 / 👎.
…pperMemento, validate_against, ParametricRealizationMemento Blocker #1: Mint RealizationPlanMemento after each kit dispatch in realize_function / apply_canonical_rewrite. Blocker #2: Call plan.validate_against(&realization) after construction; propagate RealizationPlanError. Blocker #3: Build synthetic ParametricRealizationMemento inline (one slot per param) via mint_realization_artifacts; catalog lookup path acknowledged as future enhancement per cmd_bind.rs gap comment. Blocker #4: Mint ObservationWrapperMemento when mode in {witness, monitor, dispatcher} and kit returns observation_wrapper_emission_record; call wrapper.validate before persisting; set plan.observation_wrapper_cid. Nit: used_sugars subset check in invoke_realize returns ext:unauthorized-sugar error when kit returns a CID not in the cited set. Add observation_wrapper_emission_record to RealizedSource (both kit_dispatch and cmd_transport layers) extracted from kit JSON response. Extend EngineResult with realization_plan_mementos and observation_wrapper_mementos; write to .provekit/bindings/ realization-plans/ and observation-wrappers/. Add three unit tests in cmd_transport for mint_realization_artifacts asserting: plan IS minted, validate_against passes, and wrapper IS minted for mode=witness. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b6c30fd to
a4f78fa
Compare
|
Rebased against origin/main (4204dea, post-PR#839) and applied 4 substrate blockers + 1 nit flagged in Opus review. Conflict resolution (4 files)
Substrate mints applied Blocker #1 - RealizationPlanMemento: minted in new pure function mint_realization_artifacts() in cmd_transport.rs, called from apply_canonical_rewrite after each successful kit dispatch. Blocker #2 - validate_against: called inside mint_realization_artifacts after plan construction; propagates RealizationPlanError. Blocker #3 - ParametricRealizationMemento resolution: synthetic inline construction (one slot per param) per the established gap-comment pattern at cmd_bind.rs:1112. Returns CompositionRefusalMemento failure_kind "memento-required-missing" path available for future catalog integration. Blocker #4 - ObservationWrapperMemento: minted when mode in {witness, monitor, dispatcher} and kit returns observation_wrapper_emission_record. Calls wrapper.validate(&[], &observer_effects_clone, &[]) before persisting (v1: object FCM effects unknown at realize-time; honest loudly-bounded-lossy per Supra omnia rectum). plan.observation_wrapper_cid is set to the minted wrapper's CID. Nit - used_sugars subset check: invoke_realize returns ext:unauthorized-sugar error when kit returns a CID not cited in sugar_cids. New fields
Tests: 3 unit tests in cmd_transport::mint_realization_artifacts_tests asserting plan IS minted, validate_against passes, and ObservationWrapperMemento IS minted for mode=witness with valid invariants. All cargo test -p provekit-cli -p provekit-walk -p provekit-ir-types pass except polyglot_smoke::test_daemon_polyglot_smoke (pre-existing: provekit-linkerd binary not in env, unrelated to this PR). |
Summary
This PR wires contract witnesses through canonical bind lowering without making the Rust substrate own target sugar semantics.
mode, married contract payload,sugar_cids, and fullsugar_pluginspayloads.emitted_artifact_cid,observed_loss_record, andused_sugars.@NotNull, JUnit 5 witness skeletons, and role-aware function comments.Architecture boundary: the substrate routes/cites sugar dictionaries and contract witnesses; the Java kit reads the sugar payloads, applies Java surface locators, and computes the observed loss from what it actually emitted.
Verification
cargo test --manifest-path implementations/rust/Cargo.toml -p provekit-cli realize_request_params_include_contract_mode_and_loss_payload --lib -- --nocapturecargo test --manifest-path implementations/rust/Cargo.toml -p provekit-plugin-loader --test substrate_default_cids -- --nocapturecargo test --manifest-path implementations/rust/Cargo.toml -p provekit-cli bind_writes_evidence_and_compound_contracts --test cmd_bind_integration -- --nocapturemvn test -pl provekit-realize-java-core -am -Dtest=JavaNullBoundaryRealizerTest#bindContractWitnessesEmitNotNullSugarmvn test -pl provekit-realize-java-core -amJAVA_HOME=/usr/local/Cellar/openjdk/25.0.2/libexec/openjdk.jdk/Contents/Home PATH=/usr/local/Cellar/openjdk/25.0.2/libexec/openjdk.jdk/Contents/Home/bin:$PATH cargo test --manifest-path implementations/rust/Cargo.toml -p provekit-cli --test slice2_java_realize_plugin_byte_identical -- --nocapturecargo test --manifest-path implementations/rust/Cargo.toml -p provekit-cli --test compose_rpc_smoke -- --nocapturecargo test --manifest-path implementations/rust/Cargo.toml -p provekit-walk compose_method_chain --lib -- --nocapturegit diff --check