Repository navigation
Conversation
Establishes the convention that wire-contract declarations (CoproductWireContract and VariantEncoding data items) must live in dedicated *_contracts.dag sidecar files, not inline in primary modules. Changes: - cli_run.rs: generalize the existing _test.dag sidecar gate into SIDECAR_PLACEMENT_RULES covering both _test.dag and _contracts.dag; discover_floor_corpus_rows now returns Err on any misplaced wire-contract decl; 4 unit tests (scan + misplaced-drives-Err discriminating test) - v1_compiler_emit_rust.rs: wire_contract_item lookup falls back to the *_contracts sidecar module; emit_coproduct_wire_contract_validations receives wire_context_items/imports (primary + sidecar) so CoproductWireContract rows in sidecars are visible during emit; new contracts_items_for_module and contracts_imports_for_module helpers - New *_contracts.dag sidecar files for 7 modules (github, pulls, llm, anthropic, openai, container_inspect, systemd) with wire contracts moved out - Primary modules updated to import from their sidecars; inline decls removed - contracts_placement_test.dag: discriminating claim witness verifying sidecar items resolve correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6 tasks
Contributor
|
Superseded by #5654 (session/gentle-wren-161). Both PRs independently arrived at identical designs: same 7 _contracts.dag sidecars, same SIDECAR_PLACEMENT_RULES + emit_discovery approach in cli_run.rs, same contracts_placement_test.dag. gentle-wren's PR has both tests green and review findings addressed; this one does not. |
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.
Establishes the
*_contracts.dagsidecar convention for wire-contract declarations and adds a fail-closed hygiene gate that rejects misplaced declarations at CI floor discovery time.What and why
CoproductWireContractandVariantEncodingdata items (wire encoding declarations for coproduct serialization) previously lived inline in primary extdeps modules. This scatters serialization policy across business-logic modules and makes the convention implicit. This PR:*_contracts.dagsidecar files (e.g.anthropic.dag→anthropic_contracts.dag).cli_run.rs): generalizes the existing_test.dagsidecar gate into aSIDECAR_PLACEMENT_RULESarray that covers both_test.dagand_contracts.dag.discover_floor_corpus_rowsreturnsErrif any.dagfile outside its designated sidecar suffix contains guarded declarations — misplacement is a loud build error, never a silent pass.github,pulls,llm,anthropic,openai,container_inspect,systemd— inline wire-contract decls moved to their*_contracts.dagsidecars; primary modules import from sidecars where still needed.v1_compiler_emit_rust.rsfetches sidecar items/imports and passes them as thewire_context_items/wire_context_importsforwire_contract_itemlookup andemit_coproduct_wire_contract_validations, so contracts in sidecars remain visible during emit. Newcontracts_items_for_moduleandcontracts_imports_for_modulehelpers.contracts_placement_test.dag): 4test fnclaims verify sidecar items resolve and compare correctly (coproduct field, VariantEncoding equality).Test plan
cargo test -p v1-compiler sidecar_placement: 4 unit tests allok(scan detects CoproductWireContract/VariantEncoding; ignores non-wire-contract; misplaced decl drivesdiscover_floor_corpus_rowstoErrwith correct message).cargo test -p v1-compiler floor_corpus_every_lens_is_justified:ok— gate does not fire on the now-correctly-structured corpus (54s run).cargo check -p v1-compiler: clean.