Skip to content

Preserve ordered effect guards in explicitly selected Target IR v2 - #219

Merged
flyingrobots merged 4 commits into
mainfrom
feature/ordered-target-ir
Oct 4, 2026
Merged

flyingrobots merged 4 commits into
mainfrom
feature/ordered-target-ir

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Plain-English Walkthrough

TL;DR

An authored effect followed by a guard on its result could compile to Core but could not lower to Target IR. This adds explicitly selected echo.span-ir/v2, preserving the sequence in canonical bytes while keeping the existing v1 artifact contract unchanged. [claim:ordered-ir, confidence:1.00]

This is the next compiler prerequisite for flyingrobots/jedit#296 and draft flyingrobots/jedit#302. It does not implement a runtime graph read or rope edit. Its prerequisite #217 has merged; it now targets main and preserves the existing Jim compiler/provider/evaluator pins. [claim:scope, confidence:0.99]

Walkthrough

The new artifact kind is orderedTargetIrArtifact. Each intent carries an executionOrder permutation of the ids in its binding, effect, and guard tables. Instruction payloads have one owner; the sequence determines when they run, and the result follows the complete successful sequence. The compiler validates Core types and local authority independently before lowering. The canonical encoder additionally rejects missing, duplicate, foreign, forward-dependent, and inconsistent references, including dependencies in predicates and obstruction payloads. [claim:ordering-integrity, confidence:1.00]

Selection separates compatibility from new semantics:

flowchart LR
  A[Authored source and lawpack] --> B[Validated Core]
  B --> C[v1 pre-step guards]
  B --> D[Explicit v2 ordered instructions]
  C --> E[Existing artifact bytes]
  D --> F[New kind, domain, and order identity]
  F --> G[Old provider refuses before execution]
Loading
Caption: Explicit ordering and provider compatibility
  1. Core validation precedes both Target IR paths.
  2. Existing selection retains the v1 restrictions and encoding.
  3. Selecting v2 binds a different artifact kind, domain, and execution order.
  4. The pinned old Echo provider rejects the new schema before component execution or package publication.

The CDDL contract describes the ordered shape separately. Its tagged family contains closed/closure-free alternatives, so the bounded schema validator now composes tag dispatch with required-key dispatch. A family tag must be common to every alternative. Memoized rule/depth analysis prevents shared rule graphs from expanding into an exponential walk. Generated contract-pack bytes and digests are refreshed. [claim:schema, confidence:1.00]

The public CLI exposes executionOrder and its referenced pure-binding payloads. A standalone Docker witness fetches Jim's committed source and the old Echo provider at exact revisions: v1 still reports TargetLoweringFailed; changing only the disposable adapter selection and corresponding source import digest advances to InvalidProviderInvocation at the old provider's schema gate. Neither attempt publishes application artifacts. No executable artifact is handwritten. [claim:consumer, confidence:1.00]

Compatibility and remaining work

Legacy golden bytes and pre-step refusals remain covered. The Rust TargetIrIntent model gains an execution_order field; callers constructing it directly must use None for legacy artifacts. Loops, statement branches, and external-action requests are unsupported by this first ordered contract. Runtime reads, private writes, atomic publication, and receipt/recovery evidence remain downstream work in Echo #684 and Jim #296. [claim:compatibility, confidence:1.00]

Audit integration

Merge c6a8fde integrates mainline arithmetic and byte-length validation fixes, retaining their refusal and work-count tests. It reconciles a changelog conflict and assigns ordered execution TIR-REQ-050 / TIR-TP-072–074 to avoid duplicate IDs. Fix f6ee91d removes Cargo compilation from the Dockerfile build layers and adds a runtime entrypoint with explicit target/binary selection. The standalone recipe documents a read-only root, 8 GiB build-cache filesystem, 256 MiB scratch filesystem, and CPU/memory/process bounds; existing compatible workers should be reused first. The Dockerfile static check passed; a fresh image build was not repeated. [claim:audit-integration, confidence:0.99]

Validation

All validation ran in COPY-based Docker without mounting host repositories. Current candidate: f6ee91dc94f83ca1af0a5a08c37acb6b111fb764. The reusable worker executes builds under its shared lock; generated build output stays outside image layers.

  • RED: five of six initial ordered tests failed with the unsupported-domain refusal; the legacy refusal control passed.
  • GREEN: 88 Target IR tests, 15 contract-pack tests, 29 public CLI tests, provider schema/dispatch regressions, and strict workspace Clippy.
  • The revised runtime entrypoint sh scripts/consumer-witnesses/run-jedit-state-read.sh emitted ORDERED_PUBLIC_BUILD_REACHED_OLD_PROVIDER_GATE on the current candidate. Its public v1 control refused with TargetLoweringFailed; v2 reached InvalidProviderInvocation / ArtifactSchemaMismatch at the pinned old provider. No application output was published.
  • Full cargo xtask verify: passed (exit 0), including legacy byte/digest goldens, generated contract pack, component fixtures, and 27 topic shelves.
  • The existing release-date check still reports v0.1.0-alpha.1 as MissingSurface in the policy block (non-fatal); this PR does not claim a release.
  • Hosted CI and independent review are pending for the current head. Prerequisites Lower proven unsigned subtraction into Core #211, Validate unsigned subtraction independently in Target IR #214, and Lower bounded byte length through independently checked Target IR #217 have merged; this PR remains open.
Appendix: Citations
Claim Evidence Confidence Notes
claim:audit-integration scripts/consumer-witnesses/run-jedit-state-read.sh#1@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; scripts/consumer-witnesses/README.md#8@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; merge c6a8fde10656ed38760e7b4344ed9a2f7cd0ee33 0.99 Actual runtime entrypoint executed in reused COPY worker; cold image build not repeated.
claim:ordered-ir crates/edict-syntax/src/target_ir.rs#25@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; crates/edict-syntax/tests/target_ir/ordered.rs#47@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 1.00 Explicit domain and source-order behavior.
claim:scope Jim #296, Edict #218; scripts/consumer-witnesses/README.md#1@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 0.99 The consumer experiment does not repin its source repository.
claim:ordering-integrity crates/edict-syntax/src/target_ir/execution_order.rs#1@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; crates/edict-syntax/tests/target_ir/ordered.rs#124@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 1.00 Canonical-order and local-reference mutation cases.
claim:schema docs/abi/edict-target-ir.cddl#21@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; crates/edict-provider-schema/src/recursive_dispatch.rs#548@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; crates/edict-provider-schema/tests/registry.rs#668@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 1.00 Independent schema and bounded dispatch tests.
claim:consumer scripts/consumer-witnesses/jedit-state-read.py#1@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; scripts/consumer-witnesses/jedit-state-read.Dockerfile#1@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; crates/edict-cli/tests/jsonl_cli.rs#429@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 1.00 Actual public CLI and exact external source/provider inputs.
claim:compatibility crates/edict-syntax/tests/target_ir/ordered.rs#87@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; docs/topics/target-ir/README.md#1@f6ee91dc94f83ca1af0a5a08c37acb6b111fb764; cargo xtask verify 1.00 Legacy golden checks and explicit exclusions.

Closes #218

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3297becc-23bc-4358-92a8-9d6be0b9cbb1
📥 Commits

Reviewing files that changed from the base of the PR and between d030653 and f6ee91d.

📒 Files selected for processing (25)
  • CHANGELOG.md
  • crates/edict-cli/src/main.rs
  • crates/edict-cli/tests/jsonl_cli.rs
  • crates/edict-provider-schema/src/recursive_dispatch.rs
  • crates/edict-provider-schema/tests/provider_contract_pack.rs
  • crates/edict-provider-schema/tests/registry.rs
  • crates/edict-syntax/src/canonical.rs
  • crates/edict-syntax/src/lib.rs
  • crates/edict-syntax/src/target_ir.rs
  • crates/edict-syntax/src/target_ir/execution_order.rs
  • crates/edict-syntax/tests/target_ir.rs
  • crates/edict-syntax/tests/target_ir/ordered.rs
  • crates/edict/tests/artifact_models.rs
  • docs/abi/edict-target-ir.cddl
  • docs/topics/providers/README.md
  • docs/topics/providers/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
  • scripts/consumer-witnesses/README.md
  • scripts/consumer-witnesses/jedit-state-read.Dockerfile
  • scripts/consumer-witnesses/jedit-state-read.Dockerfile.dockerignore
  • scripts/consumer-witnesses/jedit-state-read.py
  • scripts/consumer-witnesses/run-jedit-state-read.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (8)
Source excerpt: For every nontrivial behavior, contract, workflow, release, schema, validation, or public-surface change, Edict expects a visible RED/GREEN cycle: mark planned rows as implemented only when executable evidence exists; Source...

📄 CodeRabbit inference engine (docs/topics/tests/README.md)

Files:

  • docs/topics/providers/test-plan.md
  • docs/topics/target-ir/test-plan.md
Tests must assert software behavior and stable error kinds or structured artifacts, not implementation details, prose, paths, or merely `is_err()`; documentation-tool tests may test validator behavior.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • crates/edict/tests/artifact_models.rs
  • crates/edict-syntax/src/lib.rs
  • crates/edict-cli/src/main.rs
  • crates/edict-provider-schema/tests/provider_contract_pack.rs
  • docs/topics/providers/test-plan.md
  • crates/edict-syntax/tests/target_ir.rs
  • crates/edict-provider-schema/src/recursive_dispatch.rs
  • docs/topics/providers/README.md
  • crates/edict-cli/tests/jsonl_cli.rs
  • CHANGELOG.md
  • crates/edict-syntax/tests/target_ir/ordered.rs
  • crates/edict-syntax/src/target_ir/execution_order.rs
  • crates/edict-provider-schema/tests/registry.rs
  • docs/topics/target-ir/test-plan.md
  • crates/edict-syntax/src/canonical.rs
  • docs/topics/target-ir/README.md
  • scripts/consumer-witnesses/README.md
  • crates/edict-syntax/src/target_ir.rs
For Rust changes, preserve claim integrity by providing executable evidence, keep compiler and validation paths deterministic and free of hidden I/O, and prefer structured public failures with stable error kinds over prose-only diagnostics.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • crates/edict/tests/artifact_models.rs
  • crates/edict-syntax/src/lib.rs
  • crates/edict-cli/src/main.rs
  • crates/edict-provider-schema/tests/provider_contract_pack.rs
  • crates/edict-syntax/tests/target_ir.rs
  • crates/edict-provider-schema/src/recursive_dispatch.rs
  • crates/edict-cli/tests/jsonl_cli.rs
  • crates/edict-syntax/tests/target_ir/ordered.rs
  • crates/edict-syntax/src/target_ir/execution_order.rs
  • crates/edict-provider-schema/tests/registry.rs
  • crates/edict-syntax/src/canonical.rs
  • crates/edict-syntax/src/target_ir.rs
Never amend Git commits, use `git rebase` without explicit user approval, or force any Git operation; use new commits and regular merge commits instead.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • crates/edict/tests/artifact_models.rs
  • crates/edict-syntax/src/lib.rs
  • crates/edict-cli/src/main.rs
  • crates/edict-provider-schema/tests/provider_contract_pack.rs
  • scripts/consumer-witnesses/jedit-state-read.Dockerfile
  • scripts/consumer-witnesses/run-jedit-state-read.sh
  • docs/topics/providers/test-plan.md
  • crates/edict-syntax/tests/target_ir.rs
  • crates/edict-provider-schema/src/recursive_dispatch.rs
  • docs/topics/providers/README.md
  • crates/edict-cli/tests/jsonl_cli.rs
  • scripts/consumer-witnesses/jedit-state-read.Dockerfile.dockerignore
  • CHANGELOG.md
  • crates/edict-syntax/tests/target_ir/ordered.rs
  • crates/edict-syntax/src/target_ir/execution_order.rs
  • crates/edict-provider-schema/tests/registry.rs
  • docs/topics/target-ir/test-plan.md
  • crates/edict-syntax/src/canonical.rs
  • docs/topics/target-ir/README.md
  • scripts/consumer-witnesses/jedit-state-read.py
  • fixtures/provider-contracts/v1/edict-provider-contracts.cddl
  • scripts/consumer-witnesses/README.md
  • docs/abi/edict-target-ir.cddl
  • crates/edict-syntax/src/target_ir.rs
Source excerpt: Fixtures should be reused across stages when the semantic artifact is the same:

📄 CodeRabbit inference engine (docs/topics/tests/README.md)

Files:

  • fixtures/provider-contracts/v1/edict-provider-contracts.cddl
Topic shelves document landed behavior: `README.md` describes current HEAD truth, `test-plan.md` records verification and known gaps, and optional architecture or rationale pages contain durable supporting information.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • docs/topics/providers/test-plan.md
  • docs/topics/providers/README.md
  • docs/topics/target-ir/test-plan.md
  • docs/topics/target-ir/README.md
Documentation pages must have one primary reader job, separate user task help from contributor architecture and evidence maps, use concrete valid examples with expected results when relevant, and keep exact public facts in validated or gene...

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • docs/topics/providers/test-plan.md
  • docs/topics/providers/README.md
  • CHANGELOG.md
  • docs/topics/target-ir/test-plan.md
  • docs/topics/target-ir/README.md
  • scripts/consumer-witnesses/README.md
Use tables for consistent-shape comparisons and evidence, bullets for unordered sets, numbered lists for ordered procedures or states, and focused branch-accurate snippets for exact syntax.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • docs/topics/providers/test-plan.md
  • docs/topics/providers/README.md
  • CHANGELOG.md
  • docs/topics/target-ir/test-plan.md
  • docs/topics/target-ir/README.md
  • scripts/consumer-witnesses/README.md
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: flyingrobots/edict

Timestamp: 2026-10-04T07:15:50.162Z
Learning: Source excerpt:
# Testing Workflow Topic

## RED/GREEN Contract

For every nontrivial behavior, contract, workflow, release, schema, validation,
or public-surface change, Edict expects a visible RED/GREEN cycle:

- report the RED and GREEN commands in the final report or pull request body.
  [TESTS-REQ-002]
Learnt from: CR
Repo: flyingrobots/edict

Timestamp: 2026-10-04T07:15:50.162Z
Learning: Source excerpt:
# Testing Workflow Topic

## RED/GREEN Contract

For every nontrivial behavior, contract, workflow, release, schema, validation,
or public-surface change, Edict expects a visible RED/GREEN cycle:

- write the deterministic test, fixture, doctest, or contract check before the
  implementation;
Learnt from: CR
Repo: flyingrobots/edict

Timestamp: 2026-10-04T07:15:50.162Z
Learning: Source excerpt:
# Testing Workflow Topic

## RED/GREEN Contract

For every nontrivial behavior, contract, workflow, release, schema, validation,
or public-surface change, Edict expects a visible RED/GREEN cycle:

- run the narrowest relevant command and observe the RED failure;
Learnt from: CR
Repo: flyingrobots/edict

Timestamp: 2026-10-04T07:15:50.162Z
Learning: Source excerpt:
# Testing Workflow Topic

## RED/GREEN Contract

For every nontrivial behavior, contract, workflow, release, schema, validation,
or public-surface change, Edict expects a visible RED/GREEN cycle:

- implement the smallest coherent change that turns that test GREEN;
Learnt from: CR
Repo: flyingrobots/edict

Timestamp: 2026-10-04T07:15:50.162Z
Learning: Source excerpt:
# Testing Workflow Topic

## Verification

`cargo xtask contract-check` validates topic-shelf metadata, status values,
local links, implemented evidence names, and fixture paths. `cargo xtask verify`
runs the full local gate. [TESTS-REQ-006]
Learnt from: CR
Repo: flyingrobots/edict

Timestamp: 2026-10-04T07:15:50.162Z
Learning: Source excerpt:
# Testing Workflow Topic

## Verification

`cargo xtask contract-check` validates topic-shelf metadata, status values,
local links, implemented evidence names, and fixture paths. `cargo xtask verify`
runs the full local gate. [TESTS-REQ-006]
🪛 ast-grep (0.45.3)
scripts/consumer-witnesses/jedit-state-read.py

[error] 16-19: Command coming from incoming request
Context: subprocess.run(
[binary], cwd=root, input=json.dumps(request) + "\n", text=True,
capture_output=True, timeout=120, check=False,
)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[info] 17-17: use jsonify instead of json.dumps for JSON output
Context: json.dumps(request)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 31-31: use jsonify instead of json.dumps for JSON output
Context: json.dumps(diagnostic, sort_keys=True)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)


[info] 59-59: use jsonify instead of json.dumps for JSON output
Context: json.dumps(definition, indent=2)
Note: [CWE-116] Improper Encoding or Escaping of Output.

(use-jsonify)

🪛 Checkov (3.3.17)
scripts/consumer-witnesses/jedit-state-read.Dockerfile

[low] 1-17: Ensure that HEALTHCHECK instructions have been added to container images

(CKV_DOCKER_2)


[low] 1-17: Ensure that a user for the container has been created

(CKV_DOCKER_3)

🪛 Hadolint (2.15.1)
scripts/consumer-witnesses/jedit-state-read.Dockerfile

[warning] 2-2: Pin versions in apt get install. Instead of apt-get install <package> use apt-get install <package>=<version>

(DL3008)


[warning] 7-7: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

(DL4006)


[warning] 11-11: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check

(DL4006)

🪛 LanguageTool
docs/topics/providers/test-plan.md

[grammar] ~144-~144: Use a hyphen to join words.
Context: ...riminator analysis is memoized and depth bounded. Required-key dispatch is limite...

(QB_NEW_EN_HYPHEN)

CHANGELOG.md

[grammar] ~18-~18: Use a hyphen to join words.
Context: ...tion support or change existing consumer producer pins. - Avoided exponential re...

(QB_NEW_EN_HYPHEN)

🪛 Ruff (0.16.7)
scripts/consumer-witnesses/jedit-state-read.py

[error] 17-17: subprocess call: check for execution of untrusted input

(S603)


[warning] 30-30: Avoid specifying long messages outside the exception class

(TRY003)


[warning] 37-37: Avoid specifying long messages outside the exception class

(TRY003)


[warning] 66-66: Avoid specifying long messages outside the exception class

(TRY003)


[warning] 71-71: Avoid specifying long messages outside the exception class

(TRY003)

🪛 Trivy (0.74.0)
scripts/consumer-witnesses/jedit-state-read.Dockerfile

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)


[info] 1-1: No HEALTHCHECK defined

Add HEALTHCHECK instruction in your Dockerfile

Rule: DS-0026

Learn more

(IaC/Dockerfile)

🔇 Additional comments (23)
crates/edict-syntax/src/lib.rs (1)

233-234: LGTM!

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

1-176: LGTM!

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

496-501: LGTM!

Also applies to: 551-560, 667-667, 720-724, 745-750

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

1014-1014: LGTM!

Also applies to: 3959-3961

crates/edict-syntax/tests/target_ir/ordered.rs (1)

1-249: LGTM!

crates/edict/tests/artifact_models.rs (1)

85-85: LGTM!

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

21-74: LGTM!

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

906-959: LGTM!

crates/edict-provider-schema/src/recursive_dispatch.rs (1)

544-590: LGTM!

Also applies to: 1150-1170

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

311-347: LGTM!

Also applies to: 964-964

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

668-705: LGTM!

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

85-92: LGTM!

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

144-144: LGTM!

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

1381-1400: LGTM!

crates/edict-cli/tests/jsonl_cli.rs (1)

428-460: LGTM!

CHANGELOG.md (1)

13-19: LGTM!

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

15-174: LGTM!

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

134-134: LGTM!

Also applies to: 192-213

scripts/consumer-witnesses/README.md (1)

1-51: LGTM!

scripts/consumer-witnesses/jedit-state-read.Dockerfile (1)

1-17: LGTM!

scripts/consumer-witnesses/jedit-state-read.Dockerfile.dockerignore (1)

1-22: LGTM!

scripts/consumer-witnesses/jedit-state-read.py (1)

1-76: LGTM!

scripts/consumer-witnesses/run-jedit-state-read.sh (1)

1-13: LGTM!


Summary by CodeRabbit

  • New Features
    • Added support for explicitly selecting echo.span-ir/v2, which preserves instruction order across bindings, steps, and requirements.
    • The CLI now displays execution order and available pure-binding details for v2 projections.
  • Bug Fixes
    • Ordered artifacts are rejected if instructions are missing, duplicated, out of order, or reference unavailable values.
    • Provider schema dispatch now handles nested tagged choices within bounded validation depth.
  • Documentation
    • Updated Target IR and provider schema guidance with v2 ordering rules and validation behavior.
    • Legacy v1 behavior remains unchanged; v2 does not add Echo runtime execution support.

Walkthrough

Adds explicitly selected echo.span-ir/v2 Target IR with source-ordered effects, pure bindings, and requirements. The change validates and encodes the order, exposes it in CLI output, and adds schema and consumer-witness coverage. It does not add Echo execution support or change consumer producer pins.

Changes

Ordered Echo Target IR

Layer / File(s) Summary
Select and lower ordered execution
crates/edict-syntax/src/target_ir.rs, crates/edict-syntax/src/lib.rs
Echo uses ordered execution when echo.span-ir/v2 is explicitly selected. Lowering records instruction IDs in source order, while legacy configurations retain pre-step guard restrictions.
Validate and encode ordered artifacts
crates/edict-syntax/src/target_ir/execution_order.rs, crates/edict-syntax/src/canonical.rs, crates/edict-syntax/tests/target_ir*, crates/edict/tests/artifact_models.rs
Validation checks instruction permutations and local-reference availability. Canonical encoding identifies ordered artifacts and includes executionOrder when present. Tests cover invalid orderings, dependencies, and identity changes.
Describe and recognize ordered schemas
docs/abi/edict-target-ir.cddl, fixtures/provider-contracts/v1/edict-provider-contracts.cddl, crates/edict-provider-schema/*, docs/topics/providers/*
The schemas add ordered artifact forms. Provider-schema dispatch discovers shared required text literals with a depth-bounded memoized traversal.
Expose and verify the ordered contract
crates/edict-cli/*, docs/topics/target-ir/*, scripts/consumer-witnesses/*, CHANGELOG.md
CLI review output includes available execution order and pure bindings. Tests, documentation, and a Docker consumer witness cover ordered projection and the provider-schema refusal boundary.

Priority: ➖ Normal

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

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Source as Edict source
  participant Lowering as Target IR lowering
  participant Validator as Execution-order validator
  participant Encoder as Canonical encoder
  Source->>Lowering: Source-ordered effects, bindings, and requirements
  Lowering->>Validator: Intent with executionOrder
  Validator->>Encoder: Validated ordered artifact
Loading

Possibly related PRs

  • flyingrobots/edict#67: Introduced Echo echo.span-ir/v1; this change extends that Target IR model with explicitly selected ordered execution.
  • flyingrobots/edict#167: Added basis and semantic-closure data that the ordered-intent validation and encoding retain.

Merge Risk: ⚪ Minimal · up to f6ee9

No actionable merge-blocking issue is established; the identified failed-lowering case publishes no artifact.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f6ee9

The new execution-order contract is opt-in, and compatibility checks remain in place. No introduced security bypass was established. Actual execution, partial-failure handling, and recovery remain outside this change and unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — For the inspected paths, expanded reachability begins with caller-supplied Core or CLI source and target settings, and reaches ordered compilation output and provider request validation. Runtime access to participant assets, tenants, or data stores is not established by this compiler change.

Trust Boundaries and Controls

  • observed — Provider request validation checks bound inputs before producing a validated request. Artifact identity validation decodes canonical bytes, requires a supported domain, applies the owning schema, and computes the digest. The CLI requires successful request validation before lowerer invocation.
  • observed — Discriminator specialization remains an internal dispatch aid, not a replacement for structural validation. The cache is local to analysis and keyed by rule and depth; validation retains independent nesting checks and final native CDDL validation. Schema compilation remains role- and digest-bound.

Resilience and Maintainability Implications

  • observed — Terminal and continueObstructed failure payloads are statically checked against available locals. This PR does not implement runtime termination, continuation recovery, rollback, or atomicity. Successful static validation therefore cannot establish secure behavior across interruption, retry, or partial effects.

Hardening Proposals

  • proposed — Before deploying a consumer that accepts v2, require consumer-side semantic validation and explicit guarantees for guard termination, partial-effect visibility, interruption, replay, concurrency, and recovery. Do not treat schema acceptance or producer-side permutation validation as sufficient execution authority.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 14 files. (10 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue [#218] requires an explicitly selected, versioned Target IR contract that preserves straight-line instruction order and fails closed with unsupported consumers. target_ir.rs selects ordered lo…
Out of Scope Changes check ✅ Passed The provider-schema dispatch changes, CDDL and generated contract updates, CLI projection, tests, documentation, and Docker witness support issue [#218]'s ordered contract, schema recognition, compati…
Title check ✅ Passed The title clearly describes the main change: preserving ordered effect guards in the explicitly selected Target IR v2.
Description check ✅ Passed The description explains the ordered Target IR v2 changes, compatibility boundaries, validation, and reported tests. It is directly related to the changeset.
Full details: Docstring Coverage

Explanation

Docstring coverage is 44.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 14 files. (10 skipped: 10 unsupported.)

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Effects step in source order
Bindings mark the path
Guards check what came before
Schemas trace each required field
Old contracts keep their shape

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

@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer self-audit at integrated candidate c6a8fde10656ed38760e7b4344ed9a2f7cd0ee33:

Severity Location Finding Evidence Acceptance
P3 scripts/consumer-witnesses/jedit-state-read.Dockerfile:6 The witness bakes Cargo build output into an image layer, contrary to the shared build-resource policy. RUN cargo build --locked -p edict-cli executes during image construction. The documented run also lacks runtime resource bounds. Keep image construction to source/toolchain preparation; compile at container runtime into explicit cache storage, document bounded execution/reuse, and execute the public witness with the revised runtime entrypoint in the existing COPY worker.
P4 Target IR topic requirement/test IDs Mainline integration produced duplicate IDs for ordered execution and byte-length work. Both sets originally used TIR-REQ-048 and TIR-TP-070/071. Merge c6a8fde preserves byte-length IDs and assigns ordered work TIR-REQ-050 / TIR-TP-072–074, updating references. Full contract check must pass.

Cc @codex for a second opinion. Tests remain Docker-only; existing Jim producer locks remain unchanged.

@flyingrobots

Copy link
Copy Markdown
Owner Author

@codex review please

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@flyingrobots

Copy link
Copy Markdown
Owner Author

Code Lawyer activity summary

Candidate f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 targets main d030653a0083c7edb3f3841c14c732bcf96f85e6. Worktree is clean and all fixes are pushed.

Item Severity / source Commit Outcome and evidence
Mainline integration and duplicate topic IDs P4 / self c6a8fde Both merge parents inspected; retained arithmetic/byte-length runtime validation fixes and regressions. Ordered work now owns TIR-REQ-050 / TIR-TP-072–074. Full topic gate passes.
Cargo output embedded in witness image P3 / self f6ee91d Removed build-time Cargo execution. Runtime entrypoint selects an explicit target/binary, and documentation provides reuse-first and bounded standalone execution. Dockerfile check passes without warnings. Actual entrypoint passed in the reused COPY worker; a new image build was not repeated.

Exact-head Docker cargo xtask verify exited 0, including 88 Target IR tests, 29 JSONL CLI tests, 15 contract-pack tests, legacy golden checks, component fixtures, and 27 topic shelves. The existing historical MissingSurface: v0.1.0-alpha.1 [policy block] release-date advisory remains nonfatal and disclosed. All five hosted CI jobs passed.

The current-head public witness uses exact Jim source 19edb6fba94a8fea2dea63aa2f05cffc3e084f97 and old Echo provider 49e9efb68001dfd78563d18bac9359a87671e431. V1 retains TargetLoweringFailed; explicit V2 reaches InvalidProviderInvocation / ArtifactSchemaMismatch at that provider. No application output is published. It prints ORDERED_PUBLIC_BUILD_REACHED_OLD_PROVIDER_GATE. Original feature RED evidence remains the five failing ordered cases and passing legacy refusal control before implementation.

The reusable COPY worker has no host mounts and is now stopped. Retained target cache is 2.7 GiB plus 446 MiB registry, within the project budget; host free space was 716 GiB. No host tests ran.

Complete paginated review retrieval currently has no formal reviews or threads. CodeRabbit is actively reviewing, so its approval is still required before merge. The Codex fallback request returned a quota response, which is not approval. This PR does not repin Jim, implement Echo execution, or complete rope editing/admission/recovery acceptance.

@flyingrobots

Copy link
Copy Markdown
Owner Author

MERGE GATE: OPEN ✅

CodeRabbit formally approved exact head f6ee91dc94f83ca1af0a5a08c37acb6b111fb764 with no actionable findings. Full paginated retrieval has one APPROVED review, no changes-requested reviews, and no review threads. All five CI jobs and CodeRabbit status pass. Exact-head Docker verification and the public consumer witness passed; the PR is non-draft, clean, and mergeable.

Raw scanner advisory disposition (separate from CodeRabbit's no-actionable-findings verdict):

  • Python subprocess/JSON warnings: binary is an operator-selected local compiler path supplied as a single argv element without a shell; request JSON goes to stdin. This witness is not an HTTP handler, so a framework jsonify substitution is inapplicable. No request-to-shell injection path was established.
  • Healthcheck/non-root suggestions: this is an ephemeral build/test witness, not a serving process. The documented invocation has a read-only root, bounded temporary filesystems, and no host repository mounts. No service-health contract is claimed. Running as container root remains an acknowledged property of this developer recipe.
  • Apt pinning and pipeline advisories: the standalone recipe does not claim fully reproducible image bytes; Python is installed from the base distribution. Git fetches use exact source revisions, while archive extraction uses the existing Git-to-tar pipeline. The Dockerfile static check passed; a cold image build was not repeated. These limitations are retained rather than presented as independently validated deployment hardening.
  • Docstring coverage and grammar suggestions: the bot reports a heuristic coverage warning, but the repository's required documentation/topic checks pass and the reviewer approved the documented contract. No repository rule was found imposing that heuristic percentage as a merge gate. Source contracts and test plans were reviewed directly.

No runtime execution, admitted edit, or recovery claim is made. The historical release-ledger advisory remains disclosed. Proceeding under the user's standing merge authorization, using a regular merge pinned to this reviewed commit with no protection bypass.

@flyingrobots
flyingrobots merged commit ac63fe6 into main Oct 4, 2026
6 checks passed
@flyingrobots
flyingrobots deleted the feature/ordered-target-ir branch October 4, 2026 07:25
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.

Preserve ordered effect-result guards in an explicitly selected Target IR contract

1 participant