Skip to content

Add Edict executable-operation prerequisites - #167

Merged
flyingrobots merged 15 commits into
mainfrom
feat/executable-operation-prerequisites
Jul 19, 2026
Merged

Add Edict executable-operation prerequisites#167
flyingrobots merged 15 commits into
mainfrom
feat/executable-operation-prerequisites

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Plain-English Walkthrough

TL;DR

Edict now preserves the minimum generic inputs needed by a future executable operation: exact fixed-width integer domains, bounded byte payloads, an input-derived explicit basis, and a digest-locked Core/lawpack semantic closure in Target IR. [claim:operation-prerequisites, confidence:1.00]

This is Stage 1 only. The branch does not add an Echo evaluator, operation installation, runtime admission, executable rope semantics, or receipt claims. A Target IR digest remains semantic identity evidence and does not confer operation identity, invocability, or runtime authority. [claim:no-runtime-authority, confidence:1.00]

Walkthrough

Previously, the initial compiler subset recognized neither the required fixed-width source scalars nor bounded bytes, and it rejected every basis other than basis none. That prevented a real basis-bearing operation from reaching canonical Core and Target IR without narrowing or losing its semantic dependencies.

The new path preserves those inputs through the existing compiler and lowerer boundaries:

flowchart LR
    A[Edict operation source] --> B[Parse and type-check]
    B --> C[Canonical Core with basis]
    C --> D[Existing target lowerer]
    D --> E[Target IR with semantic closure]
Loading
Caption: Stage 1 operation prerequisite flow
  1. Source authoring supplies exact scalar domains, a bounded byte field, and an explicit basis expression.
  2. Type checking restricts basis evaluation to the pre-body input environment and rejects width or range mismatches while accepting valid signed minima.
  3. Canonical Core binds the basis and exact integer domains into its digest.
  4. Target lowering binds that Core digest and the sorted digest-locked lawpack set into Target IR.
  5. The resulting artifact still requires a later Echo-owned admission and execution crossing.

The diagram ends at semantic artifact production. No edge in this PR crosses into Echo execution or commitment.

Exact inputs and basis

The compiler recognizes I32, I64, U32, and U64, propagates unambiguous expected widths into bare literals in supported comparisons, annotations, and record returns, folds unary-negative integer literals through the exact domain validator, and preserves Bytes<max=N>. Signed minima reach Core; unconstrained bare integers, cross-width assignments, overflow, and negative unsigned values fail before Core identity exists. [claim:fixed-width-domain, confidence:1.00]

An explicit basis is checked before body locals enter scope and is then retained in Core and Target IR. A body-local basis and missing or duplicate basis clauses fail with typed compiler errors rather than panicking. [claim:prebody-basis, confidence:1.00]

Semantic closure and substitution boundary

For an operation with an explicit basis or lawpack import, target lowering computes the canonical Core digest and binds it with a coordinate-keyed, digest-locked lawpack set. Equivalent lawpack order is identity-invariant; an empty Core coordinate, conflicting resource, or unidentifiable Core refuses without an artifact. On the computed bundle path, assembly recomputes that closure from the exact supplied Core and requires the Target IR closure and bundle lawpack set to match, then canonicalizes equivalent bundle-lawpack order and duplicate identical references before identity construction. [claim:semantic-closure, confidence:1.00]

A hand-constructed Target IR cannot substitute a different Core coordinate inside the closure while retaining the envelope coordinate, nor can it retain an explicit basis after dropping the closure. Canonical identity construction rejects both internal contradictions. Computed bundle assembly separately rejects a same-coordinate Core digest substitution, a stripped lawpack-only closure, or a substituted bundle lawpack set. [claim:core-substitution-refusal, confidence:1.00]

The Core and Target IR CDDL roots accept the new fields, require a non-empty source Core coordinate, and the Target IR root has separate closed and legacy variants. The structurally separate provider-schema path rejects a basis-bearing external artifact after its closure is removed. The generated provider contract pack was regenerated from those authoritative schema fragments. [claim:schema-conformance, confidence:1.00]

Review projections

The project command now includes an explicit basis in Core and Target IR review JSON and includes the source Core plus lawpack set in the Target IR review. Optional fields remain omitted for legacy basis-free projections. Review JSON remains display data; canonical identity still comes only from the canonical encoders. [claim:review-projection, confidence:1.00]

Verifier grades

Grade Evidence in this PR Claim
Deterministic self-validation Compiler type checking, canonical integer-domain checks, resource validation, and identity-sensitive encoding Implemented
Structurally separate verifier path edict-provider-schema validates independently assembled canonical Core and Target IR values against the published CDDL roots, including missing-closure refusal Implemented
Independently implemented conformance evidence No second semantic implementation exists in Stage 1 Not claimed

The distinction is deliberate: passing a different crate and CDDL path is structurally separate verification, not proof of an independently implemented compiler or lowerer. [claim:verifier-grades, confidence:0.99]

Compatibility and non-goals

When an artifact has basis none and no lawpack import, the optional closure and basis fields are omitted. Existing reviewed Core and Target IR golden bytes and digests remain unchanged. [claim:provider-v1-compatibility, confidence:1.00]

No dependencies were added. This PR does not add EchoOperationProgramV1, a hook-free Echo evaluator, Jedit rope semantics, a Jim invocation path, the Kitten runtime, TextWindow, child lanes, wormholes, or Continuum transport.

Verification

  • Initial RED: the first four operation-prerequisite witnesses failed at unresolved fixed-width type, bounded-bytes, explicit-basis, and identity-movement seams.
  • Review RED: five earlier Codex findings reproduced as four failing operation tests, one provider-schema failure, and one CLI projection failure; a CodeRabbit finding reproduced as a distinct duplicate-basis failure; the late exact-head Codex pass reproduced three further findings as five RED witnesses covering contextual integers and bundle substitution; the final exact-head pass produced two behavioral RED failures plus four coverage/schema witnesses covering lawpack canonicalization, malformed-Core error taxonomy, closure branches, review-projection digests, and empty source-Core coordinates.
  • GREEN: cargo test -p edict-syntax --test operation_prerequisites — 18 passed, 0 failed.
  • GREEN: cargo test -p edict-syntax --test contract_bundle contract_bundle_assembly — 19 passed, 0 failed.
  • GREEN: focused provider-schema and CLI projection witnesses both pass.
  • Repository gate: cargo xtask verify — passed at deed97b47b069c9492221ccada5b128385ac91c2, including format, strict Clippy, workspace/all-feature tests, doctests, reviewed goldens, provider fixtures and contract pack, dependency boundary checks, and all 23 topic shelves.
  • Structural review: Graft reported no breaking changes or removed public exports against origin/main.
Appendix: Citations
Claim Evidence Confidence Notes
claim:operation-prerequisites crates/edict-syntax/src/compiler.rs#544@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#101@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Source implementation and the end-to-end canonical artifact witness agree.
claim:no-runtime-authority docs/design/canonical-target-ir-v0.11.md#88@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#1@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Durable design text and test scope explicitly stop before runtime authority.
claim:fixed-width-domain crates/edict-syntax/src/compiler.rs#1541@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/src/compiler.rs#1605@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#178@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#280@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Shared range validation is exercised by signed-minimum, exact-domain, overflow, unsigned-negative, and cross-width witnesses.
claim:prebody-basis crates/edict-syntax/src/compiler.rs#657@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#343@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#358@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#376@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Basis checking precedes body checking; negative witnesses cover body-local, missing, and duplicate bases.
claim:semantic-closure crates/edict-syntax/src/target_ir.rs#294@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/src/contract_bundle.rs#562@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#101@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/contract_bundle.rs#645@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Lowering binds the closure; computed assembly independently recomputes and corroborates the exact Core/lawpack binding.
claim:core-substitution-refusal crates/edict-syntax/src/canonical.rs#462@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/operation_prerequisites.rs#590@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/contract_bundle.rs#645@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/contract_bundle.rs#669@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-syntax/tests/contract_bundle.rs#684@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Canonical self-validation and computed cross-artifact corroboration cover distinct substitution boundaries.
claim:schema-conformance docs/abi/edict-core.cddl#210@deed97b47b069c9492221ccada5b128385ac91c2; docs/abi/edict-target-ir.cddl#21@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-provider-schema/tests/provider_contract_pack.rs#180@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-provider-schema/tests/provider_contract_pack.rs#263@deed97b47b069c9492221ccada5b128385ac91c2 1.00 Reference-encoded values validate through the published roots, and the missing closure shape fails structurally.
claim:review-projection crates/edict-cli/src/main.rs#1128@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-cli/src/main.rs#1146@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-cli/tests/jsonl_cli.rs#1096@deed97b47b069c9492221ccada5b128385ac91c2; crates/edict-cli/tests/jsonl_cli.rs#1135@deed97b47b069c9492221ccada5b128385ac91c2 1.00 End-to-end CLI evidence exposes the same basis and closure identities that move canonical digests.
claim:verifier-grades crates/edict-provider-schema/tests/provider_contract_pack.rs#180@deed97b47b069c9492221ccada5b128385ac91c2; docs/topics/target-ir/test-plan.md#103@deed97b47b069c9492221ccada5b128385ac91c2 0.99 The separate validation path is explicit; independent implementation is intentionally not claimed.
claim:provider-v1-compatibility docs/topics/target-ir/test-plan.md#105@deed97b47b069c9492221ccada5b128385ac91c2; xtask/src/tests.rs#60@deed97b47b069c9492221ccada5b128385ac91c2 1.00 The checked reviewed golden gate passed under the full verification command.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The compiler now supports explicit intent bases, fixed-width integers, and bounded bytes. Core and Target IR preserve these values, Target IR emits digest-locked semantic closures, canonical encoding validates their identity, and schemas, fixtures, tests, and diagnostics cover the new representations.

Changes

Basis and semantic closure

Layer / File(s) Summary
Compiler and Core representation
crates/edict-syntax/src/compiler.rs, crates/edict-syntax/src/core_ir.rs, crates/edict-syntax/src/semantic.rs, fixtures/lang/operations/explicit-basis-u64.edict
Explicit bases, fixed-width integers, bounded bytes, expected-type propagation, and exact compatibility rules are compiled into Core.
Target IR semantic closure and canonical encoding
crates/edict-syntax/src/target_ir.rs, crates/edict-syntax/src/canonical.rs, docs/abi/*, docs/design/canonical-target-ir-v0.11.md, crates/edict-cli/src/main.rs
Target lowering preserves basis values, computes semantic closures, validates identities and lawpack bindings, and renders optional review fields.
Contract bundle corroboration
crates/edict-syntax/src/contract_bundle.rs, docs/design/contract-bundle-assembly-v0.11.md, docs/topics/contract-bundles/*, crates/edict-syntax/tests/contract_bundle.rs
Bundle assembly recomputes semantic closure and rejects Core, closure, or lawpack-set mismatches.
Fixtures, provider schemas, and end-to-end validation
crates/edict-syntax/tests/operation_prerequisites.rs, crates/edict-provider-schema/tests/provider_contract_pack.rs, crates/edict-cli/tests/jsonl_cli.rs, fixtures/provider-contracts/v1/*, docs/topics/*
Tests and fixtures validate width preservation, basis handling, closure identity, mutation sensitivity, schema rejection, and review JSON output.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SourceModule
  participant Compiler
  participant CoreIR
  participant TargetLowering
  participant CanonicalEncoder
  participant ContractAssembler
  SourceModule->>Compiler: parse basis, integer widths, and bounded bytes
  Compiler->>CoreIR: produce typed Core intent
  CoreIR->>TargetLowering: lower intent and source Core
  TargetLowering->>CanonicalEncoder: encode Target artifact and semantic closure
  CanonicalEncoder-->>TargetLowering: canonical identity or validation error
  TargetLowering->>ContractAssembler: provide Target artifact and closure
  ContractAssembler->>CoreIR: recompute semantic closure from supplied Core
  ContractAssembler-->>TargetLowering: accept or reject identity mismatch
Loading

Possibly related PRs

Poem

A basis takes root in the Core,
While lawpack digests guard the door.
Widths hold true, bytes stay bound,
Canonical order spins around.
Invalid identities fade from sight—
The IR now hashes just right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding executable-operation prerequisites to Edict.
Description check ✅ Passed The description accurately matches the changeset and covers the new compiler, IR, schema, and test updates.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb27bfc31f

ℹ️ 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".

Comment thread crates/edict-syntax/src/compiler.rs Outdated
Comment thread crates/edict-syntax/src/target_ir.rs
Comment thread crates/edict-syntax/src/target_ir.rs
Comment thread docs/topics/compiler-spine/test-plan.md Outdated
Comment thread crates/edict-syntax/src/canonical.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/edict-syntax/src/compiler.rs`:
- Around line 657-672: Update the basis-clause collection in the source
type-checking flow to detect and reject more than one IntentClause::Basis
instead of using find_map, which silently ignores duplicates. Preserve the
existing missing-basis UnsupportedSourceShape error and only proceed to
check_expr when exactly one basis clause is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2457b18f-2bec-494b-ab30-c969873d02e3

📥 Commits

Reviewing files that changed from the base of the PR and between da5da88 and bb27bfc.

📒 Files selected for processing (18)
  • crates/edict-cli/src/main.rs
  • crates/edict-provider-schema/tests/provider_contract_pack.rs
  • crates/edict-syntax/src/canonical.rs
  • crates/edict-syntax/src/compiler.rs
  • crates/edict-syntax/src/core_ir.rs
  • crates/edict-syntax/src/lib.rs
  • crates/edict-syntax/src/semantic.rs
  • crates/edict-syntax/src/target_ir.rs
  • crates/edict-syntax/tests/operation_prerequisites.rs
  • docs/abi/edict-core.cddl
  • docs/abi/edict-target-ir.cddl
  • docs/design/canonical-target-ir-v0.11.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/core-ir/test-plan.md
  • docs/topics/target-ir/test-plan.md
  • fixtures/lang/operations/explicit-basis-u64.edict
  • fixtures/provider-contracts/v1/edict-provider-contracts.cddl
  • fixtures/provider-contracts/v1/manifest.json
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: rust stable (fmt · clippy · test)
  • GitHub Check: rust msrv 1.94.0 (fmt · clippy · test)
  • GitHub Check: supply-chain (cargo-deny)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

When creating or changing documentation, give each page one primary reader job; keep user-facing task help separate from contributor architecture and evidence maps; use concrete, valid examples and show expected results when the result matters; put exact public facts in reference material and validate or generate them from authoritative sources when practical; and update affected documentation in the same change as behavior, schema, release, workflow, or public-surface changes, or state docs-impact: none with a concise rationale.

Files:

  • docs/design/canonical-target-ir-v0.11.md
  • docs/topics/core-ir/test-plan.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/target-ir/test-plan.md
docs/topics/**/{README.md,test-plan.md,architecture.md,rationale.md}

📄 CodeRabbit inference engine (AGENTS.md)

docs/topics/**/{README.md,test-plan.md,architecture.md,rationale.md}: For every nontrivial behavior, contract, workflow, release, schema, validation, or public-surface change, identify the owning topic shelf before editing code; create one if none exists; update test-plan.md before or alongside tests with requirement IDs, case IDs, fixtures, and oracles; write executable evidence; update the topic README.md only after behavior exists; mark planned cases implemented only when executable evidence exists; and run cargo xtask verify before claiming the shelf is current.
Do not churn topic shelves for purely mechanical edits that do not change a contract; when a change intentionally does not update a topic shelf, state why in the pull request body or final report.
Topic README.md files must not describe intended behavior before it lands; test-plan.md may include planned cases and known gaps; policy rows are for human-review workflow contracts and must not be used to avoid writing behavior tests; tests must assert code behavior and stable contract artifacts, not prose; negative tests should assert stable error kinds or structured artifacts, not merely is_err() or diagnostic text; release, CI, and publication workflows count as behavior when they define a project contract; avoid ceremonial documentation and update shelves because the contract changed, not because a path changed.

Files:

  • docs/topics/core-ir/test-plan.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/target-ir/test-plan.md
🪛 LanguageTool
docs/design/canonical-target-ir-v0.11.md

[grammar] ~92-~92: Ensure spelling is correct
Context: ... carries an explicit basis or imports a lawpack. It binds the exact canonical Core dige...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (19)
crates/edict-syntax/src/core_ir.rs (1)

70-82: LGTM!

Also applies to: 83-109, 243-245

crates/edict-syntax/src/compiler.rs (1)

14-21: LGTM!

Also applies to: 164-164, 266-266, 395-395, 410-410, 553-555, 568-569, 615-635, 636-642, 683-683, 1517-1521, 1549-1573, 1767-1769, 1796-1827

crates/edict-syntax/src/semantic.rs (1)

147-154: LGTM!

docs/abi/edict-core.cddl (1)

213-213: LGTM!

fixtures/lang/operations/explicit-basis-u64.edict (1)

1-29: LGTM!

docs/topics/compiler-spine/test-plan.md (1)

49-52: LGTM!

Also applies to: 81-84

docs/topics/core-ir/test-plan.md (1)

53-54: LGTM!

Also applies to: 101-102

crates/edict-provider-schema/tests/provider_contract_pack.rs (1)

14-19: LGTM!

Also applies to: 40-41, 255-278, 587-603

docs/topics/target-ir/test-plan.md (1)

54-62: LGTM!

Also applies to: 103-105

crates/edict-syntax/src/canonical.rs (1)

8-21: LGTM!

Also applies to: 463-497, 499-528, 555-580, 770-792, 944-965

crates/edict-syntax/src/target_ir.rs (2)

10-14: LGTM!

Also applies to: 157-157, 181-197, 242-245, 284-284, 460-460


304-315: 🗄️ Data Integrity & Integration

Keep the strict lowercase digest gate here. Lawpack import lowering and canonical Target IR rendering both require sha256:<64 lowercase hex> review strings, so this check matches the existing contract.

docs/abi/edict-target-ir.cddl (1)

26-37: LGTM!

docs/design/canonical-target-ir-v0.11.md (1)

54-106: LGTM!

crates/edict-syntax/src/lib.rs (1)

184-187: LGTM!

crates/edict-cli/src/main.rs (1)

1435-1435: LGTM!

crates/edict-syntax/tests/operation_prerequisites.rs (1)

99-452: LGTM!

fixtures/provider-contracts/v1/edict-provider-contracts.cddl (1)

300-300: LGTM!

Also applies to: 768-779

fixtures/provider-contracts/v1/manifest.json (1)

6-7: 🗄️ Data Integrity & Integration

No issue here The fixture’s bytesHex and rawSha256 line up, and the payload already includes the new semanticClosure/basis rules.

			> Likely an incorrect or invalid review comment.

Comment thread crates/edict-syntax/src/compiler.rs Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 19, 2026

Copy link
Copy Markdown
Owner Author

@codex Please confirm these resolved findings against current head a747a181db7fc7bb7dab3d8ec753f6c6757397f6.

Severity Path Finding Resolution
P1 crates/edict-syntax/src/canonical.rs A basis-bearing Target IR artifact could omit its semantic closure. Canonical encoding and the published CDDL now require the closure; a negative witness covers deletion.
P1 docs/topics/{compiler-spine,core-ir,target-ir}/README.md Owning topic contracts lagged the implementation. Current-contract READMEs and test plans now describe the implemented behavior.
P2 crates/edict-syntax/src/compiler.rs Unary-negative signed literals bypassed exact-width validation. Negative literals now use the shared exact-domain checker, including signed minima and unsigned refusal witnesses.
P2 crates/edict-syntax/src/target_ir.rs An empty Core coordinate could report successful lowering before canonical encoding failed. Target lowering now refuses the empty identity before producing an artifact.
P2 crates/edict-cli/src/main.rs Public review projections omitted basis and semantic-closure identities. Core/Target review JSON now exposes basis, source Core, and lawpack closure fields.
P2 crates/edict-syntax/src/compiler.rs Direct type checking silently accepted a second basis clause. The type checker now requires exactly one basis clause; RED/GREEN evidence is in ec10dad and a747a18.

Validation at the current head: cargo test -p edict-syntax --test operation_prerequisites (15 passed) and cargo xtask verify (passed). Graft reports no breaking changes or removed public exports against origin/main.

Copy link
Copy Markdown
Owner Author

@codex review

Please review the current head a747a181db7fc7bb7dab3d8ec753f6c6757397f6, including the fixes summarized immediately above.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a747a181db

ℹ️ 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".

Comment thread crates/edict-syntax/src/target_ir.rs
Comment thread crates/edict-syntax/src/canonical.rs
Comment thread crates/edict-syntax/src/compiler.rs Outdated

Copy link
Copy Markdown
Owner Author

@codex review

Please review the exact current head bbd64b7d58b89708b0538ab95470a94b8e2edc1e. The three findings from the prior a747a18 review have RED/GREEN evidence in d6b1d39 and bbd64b7: computed bundle assembly now corroborates exact Core/Target-IR/lawpack closure, stripped lawpack-only closure fails at that evidence-bearing boundary, and bare integers inherit only unambiguous fixed-width contexts. The full cargo xtask verify gate passes, and Graft reports no breaking changes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbd64b7d58

ℹ️ 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".

Comment thread crates/edict-syntax/src/contract_bundle.rs
Comment thread crates/edict-syntax/src/contract_bundle.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/edict-syntax/src/canonical.rs (1)

462-484: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject empty sourceCoreCoordinate here
target_ir_resource_ref_value already rejects empty resource coordinates, but sourceCoreCoordinate is still emitted raw. A caller can hand encode_target_ir_artifact/digest_target_ir_artifact an externally constructed legacy TargetIrArtifact with "", and it will still canonicalize/digest. Add the same non-empty guard here, or reject it at construction.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/edict-syntax/src/canonical.rs` around lines 462 - 484, Update
target_ir_artifact_value to reject an empty artifact.source_core_coordinate
before emitting the raw sourceCoreCoordinate field, returning the existing
canonical validation error used for invalid coordinates. Preserve
canonicalization for non-empty coordinates and ensure encode_target_ir_artifact
and digest_target_ir_artifact cannot accept the empty value.
crates/edict-syntax/src/compiler.rs (1)

550-566: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reserve built-in scalar names for type declarations

type_ref_shape still gives I32/I64/U32/U64 precedence over named_types, and the semantic pass only reserves those names for binders—not for type declarations. A local type U64 = ... can still be accepted but never resolved in type position. Reject the collision at declaration time, or make the reservation explicit and test it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/edict-syntax/src/compiler.rs` around lines 550 - 566, Update
type_ref_shape and the type-declaration validation to consistently reserve
built-in scalar names (I32, I64, U32, and U64): reject declarations using those
names before adding them to named_types, or otherwise make the reservation
explicit so such declarations cannot be accepted yet shadowed during type
resolution. Add coverage for each collision if the project’s existing tests
support it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/edict-cli/tests/jsonl_cli.rs`:
- Around line 1140-1151: Update the semantic-closure assertions in the test to
include diagnostic messages consistent with the nearby basis/field assertion,
specifically for sourceCore/coordinate and lawpacks/0/coordinate. Immediately
assert that lawpacks/0/digest preserves the expected sha256 digest declared by
the demo.write@1 fixture.

In `@crates/edict-syntax/tests/contract_bundle.rs`:
- Around line 644-697: Add contract-bundle tests for the two untested branches
of corroborate_target_ir_semantic_closure: create a closure-free Core with an
injected Some semantic_closure and assert TargetIrSourceMismatch for
target_ir_artifact.semantic_closure, then mutate the artifact closure’s lawpacks
while keeping the Core and bundle lawpacks unchanged and assert
TargetIrSourceMismatch for the artifact closure lawpacks field. Follow the
existing assembly_from_target_ir_input test style and error assertions.

In `@crates/edict-syntax/tests/operation_prerequisites.rs`:
- Around line 447-463: Add an encoder-boundary test alongside the existing
prerequisite tests using a manually constructed legacy artifact with
source_core_coordinate empty and semantic_closure set to None. Invoke the
canonical encoder entry point and assert it rejects the artifact, covering the
validation path beyond lower_to_target_ir and preserving the expected failure
behavior.

In `@docs/abi/edict-target-ir.cddl`:
- Around line 23-28: Update the target-ir-artifact-common schema definition so
sourceCoreCoordinate requires a non-empty string, using the same regexp
constraint as target-ir-resource-ref.id. Preserve the existing field name and
type while rejecting empty wire values.

---

Outside diff comments:
In `@crates/edict-syntax/src/canonical.rs`:
- Around line 462-484: Update target_ir_artifact_value to reject an empty
artifact.source_core_coordinate before emitting the raw sourceCoreCoordinate
field, returning the existing canonical validation error used for invalid
coordinates. Preserve canonicalization for non-empty coordinates and ensure
encode_target_ir_artifact and digest_target_ir_artifact cannot accept the empty
value.

In `@crates/edict-syntax/src/compiler.rs`:
- Around line 550-566: Update type_ref_shape and the type-declaration validation
to consistently reserve built-in scalar names (I32, I64, U32, and U64): reject
declarations using those names before adding them to named_types, or otherwise
make the reservation explicit so such declarations cannot be accepted yet
shadowed during type resolution. Add coverage for each collision if the
project’s existing tests support it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 64d109d3-e16c-4569-b898-ee5723a14589

📥 Commits

Reviewing files that changed from the base of the PR and between bb27bfc and bbd64b7.

📒 Files selected for processing (25)
  • crates/edict-cli/src/main.rs
  • crates/edict-cli/tests/jsonl_cli.rs
  • crates/edict-provider-schema/tests/provider_contract_pack.rs
  • crates/edict-syntax/src/canonical.rs
  • crates/edict-syntax/src/compiler.rs
  • crates/edict-syntax/src/contract_bundle.rs
  • crates/edict-syntax/src/target_ir.rs
  • crates/edict-syntax/tests/contract_bundle.rs
  • crates/edict-syntax/tests/operation_prerequisites.rs
  • crates/edict-syntax/tests/provider_lowering.rs
  • docs/abi/edict-target-ir.cddl
  • docs/design/canonical-target-ir-v0.11.md
  • docs/design/contract-bundle-assembly-v0.11.md
  • docs/topics/cli/README.md
  • docs/topics/cli/test-plan.md
  • docs/topics/compiler-spine/README.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/contract-bundles/README.md
  • docs/topics/contract-bundles/test-plan.md
  • docs/topics/core-ir/README.md
  • docs/topics/core-ir/test-plan.md
  • docs/topics/target-ir/README.md
  • docs/topics/target-ir/test-plan.md
  • fixtures/provider-contracts/v1/edict-provider-contracts.cddl
  • fixtures/provider-contracts/v1/manifest.json
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: rust msrv 1.94.0 (fmt · clippy · test)
  • GitHub Check: rust stable (fmt · clippy · test)
  • GitHub Check: supply-chain (cargo-deny)
🧰 Additional context used
📓 Path-based instructions (2)
docs/topics/**/{README.md,test-plan.md,architecture.md,rationale.md}

📄 CodeRabbit inference engine (AGENTS.md)

docs/topics/**/{README.md,test-plan.md,architecture.md,rationale.md}: For every nontrivial behavior, contract, workflow, release, schema, validation, or public-surface change, identify the owning topic shelf before editing code; create one if none exists; update test-plan.md before or alongside tests with requirement IDs, case IDs, fixtures, and oracles; write executable evidence; update the topic README.md only after behavior exists; mark planned cases implemented only when executable evidence exists; and run cargo xtask verify before claiming the shelf is current.
Do not churn topic shelves for purely mechanical edits that do not change a contract; when a change intentionally does not update a topic shelf, state why in the pull request body or final report.
Topic README.md files must not describe intended behavior before it lands; test-plan.md may include planned cases and known gaps; policy rows are for human-review workflow contracts and must not be used to avoid writing behavior tests; tests must assert code behavior and stable contract artifacts, not prose; negative tests should assert stable error kinds or structured artifacts, not merely is_err() or diagnostic text; release, CI, and publication workflows count as behavior when they define a project contract; avoid ceremonial documentation and update shelves because the contract changed, not because a path changed.

Files:

  • docs/topics/cli/README.md
  • docs/topics/compiler-spine/README.md
  • docs/topics/contract-bundles/README.md
  • docs/topics/core-ir/test-plan.md
  • docs/topics/target-ir/README.md
  • docs/topics/contract-bundles/test-plan.md
  • docs/topics/core-ir/README.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/cli/test-plan.md
  • docs/topics/target-ir/test-plan.md
docs/**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

When creating or changing documentation, give each page one primary reader job; keep user-facing task help separate from contributor architecture and evidence maps; use concrete, valid examples and show expected results when the result matters; put exact public facts in reference material and validate or generate them from authoritative sources when practical; and update affected documentation in the same change as behavior, schema, release, workflow, or public-surface changes, or state docs-impact: none with a concise rationale.

Files:

  • docs/topics/cli/README.md
  • docs/design/contract-bundle-assembly-v0.11.md
  • docs/topics/compiler-spine/README.md
  • docs/topics/contract-bundles/README.md
  • docs/design/canonical-target-ir-v0.11.md
  • docs/topics/core-ir/test-plan.md
  • docs/topics/target-ir/README.md
  • docs/topics/contract-bundles/test-plan.md
  • docs/topics/core-ir/README.md
  • docs/topics/compiler-spine/test-plan.md
  • docs/topics/cli/test-plan.md
  • docs/topics/target-ir/test-plan.md
🪛 LanguageTool
docs/design/contract-bundle-assembly-v0.11.md

[grammar] ~104-~104: Ensure spelling is correct
Context: ...ure against the exact supplied Core and lawpacks before the digest enters the bundle pre...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

docs/topics/target-ir/README.md

[grammar] ~97-~97: Ensure spelling is correct
Context: ...icit basis or the Core module imports a lawpack, the artifact carries a `TargetIrSemant...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (30)
crates/edict-cli/tests/jsonl_cli.rs (2)

32-50: LGTM!


1095-1100: LGTM!

crates/edict-syntax/src/compiler.rs (2)

657-682: Duplicate basis clause now properly rejected — past nightmare resolved.

Previously this used a lazy find_map that vaporized any second basis clause into the void. Now it explicitly drains the iterator and screams UnsupportedSourceShape on a second hit. Matches direct_type_check_refuses_duplicate_basis_clauses. I withdraw my earlier scorn, conditionally, on continued good behavior.


164-164: Everything else in this diff is exactly as advertised.

basis: Option<CoreExpr> threading through TypedIntent/lower_core, TypeKind::Bytes { max } + bytes_shape, the check_expr/check_expr_with_expected split, check_integer_literal's width-then-domain validation via parse_core_integer, and is_bare_integer_literal's comparison-context inference all line up cleanly with the fixture, docs, and test evidence (operation_prerequisite_fixture_preserves_fixed_width_basis_and_lawpack_closure, bare_integer_literals_inherit_unambiguous_fixed_width_context, unconstrained_bare_integer_literal_refuses_before_core). Bare-literal-vs-bare-literal comparisons correctly fall through to the "no unambiguous width" rejection instead of silently defaulting to a host width.

Also applies to: 266-266, 395-410, 568-634, 693-693, 784-798, 1014-1046, 1503-1646, 1747-1813

docs/topics/compiler-spine/README.md (1)

40-58: LGTM!

docs/topics/compiler-spine/test-plan.md (1)

49-52: LGTM!

Also applies to: 55-58, 81-85

crates/edict-syntax/src/target_ir.rs (1)

242-245: LGTM!

Also applies to: 294-350, 396-403

crates/edict-syntax/src/canonical.rs (1)

494-508: Rest of the canonicalization changes hold up.

entries-vector-based optional-field encoding for both Target IR and Core intents, the source-core-coordinate cross-check against the semantic closure, and width-aware int_text_value domain validation are all consistent with the described contract and test evidence.

Also applies to: 541-564, 782-802, 955-975, 1079-1094

docs/abi/edict-target-ir.cddl (1)

1-22: LGTM!

Also applies to: 29-79

docs/design/canonical-target-ir-v0.11.md (1)

49-99: LGTM!

Also applies to: 100-111

docs/topics/target-ir/README.md (1)

90-104: LGTM!

Also applies to: 114-121, 135-149

crates/edict-cli/src/main.rs (1)

1096-1195: LGTM!

Also applies to: 1475-1475

docs/topics/cli/README.md (1)

49-56: LGTM!

docs/topics/cli/test-plan.md (1)

88-88: LGTM!

crates/edict-syntax/tests/operation_prerequisites.rs (1)

101-158: LGTM!

Also applies to: 161-175, 214-277, 279-307, 342-396

docs/topics/core-ir/test-plan.md (1)

53-54: LGTM!

Also applies to: 101-102

docs/topics/core-ir/README.md (1)

43-45: LGTM!

Also applies to: 64-68, 78-80

crates/edict-syntax/src/contract_bundle.rs (3)

559-618: Corroboration logic is correct — nice tight closure-vs-Core binding. All four match arms are structurally sound and the check correctly runs before digest_target_ir_artifact is called, so a mismatched closure never reaches the bundle preimage.

One gap: the (Some(_), None) | (None, Some(_)) arm collapses two semantically distinct failure modes (missing required closure vs. an unexpected extra closure on a no-basis/no-lawpack Core) into one untested branch pairing. See the companion note on the test file for the specific missing cases.


27-34: LGTM!


620-628: 📐 Maintainability & Code Quality

No duplicate helper here. canonical.rs only encodes ResourceRef/ResourceList values; it does not define a shared sort+dedup normalizer, so canonical_resource_set is just a local helper.

			> Likely an incorrect or invalid review comment.
docs/design/contract-bundle-assembly-v0.11.md (1)

37-40: LGTM!

Also applies to: 103-106

docs/topics/contract-bundles/README.md (1)

72-76: LGTM!

docs/topics/contract-bundles/test-plan.md (1)

46-46: LGTM!

Also applies to: 70-70

crates/edict-syntax/tests/provider_lowering.rs (1)

200-200: LGTM!

crates/edict-provider-schema/tests/provider_contract_pack.rs (2)

14-19: Verified: schema-rejection test is internally consistent with the CDDL union.

Stripping semanticClosure from a basis-bearing intent correctly falls into the gap between target-ir-closed-artifact (requires semanticClosure) and target-ir-legacy-artifact (its target-ir-legacy-intent doesn't permit basis), so SchemaMismatch is the right outcome.

Also applies to: 40-41, 191-198


263-286: 🎯 Functional Correctness

The context concern is incorrect. Both the new integration test and the semantic_closure/basis builder change are present in the patch, so there’s enough context to review them.

			> Likely an incorrect or invalid review comment.
fixtures/provider-contracts/v1/manifest.json (1)

6-7: LGTM!

fixtures/provider-contracts/v1/edict-provider-contracts.cddl (1)

300-300: LGTM!

Also applies to: 763-804

docs/topics/target-ir/test-plan.md (1)

54-55: LGTM!

Also applies to: 56-62, 103-105

crates/edict-syntax/tests/contract_bundle.rs (1)

379-391: 🎯 Functional Correctness

No issue: the hardcoded digest is the expected 64 hex chars.

			> Likely an incorrect or invalid review comment.

Comment thread crates/edict-cli/tests/jsonl_cli.rs
Comment thread crates/edict-syntax/tests/contract_bundle.rs
Comment thread crates/edict-syntax/tests/operation_prerequisites.rs
Comment thread docs/abi/edict-target-ir.cddl

Copy link
Copy Markdown
Owner Author

@codex review

Please review the exact current head deed97b47b069c9492221ccada5b128385ac91c2. All prior inline findings have evidence-backed replies and are resolved; cargo xtask verify and Graft's structural review pass on this exact head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: deed97b47b

ℹ️ 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".

@flyingrobots
flyingrobots merged commit 337e014 into main Jul 19, 2026
4 checks passed
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