Skip to content

Compile basis-bound validated patch requests - #179

Merged
flyingrobots merged 9 commits into
mainfrom
task/178-basis-bound-patch-requests
Jul 30, 2026
Merged

Compile basis-bound validated patch requests#179
flyingrobots merged 9 commits into
mainfrom
task/178-basis-bound-patch-requests

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Plain-English Walkthrough

TL;DR

[claim:request-boundary, confidence:1.00] Edict now compiles workspace.patch.applyValidated@1 as typed, non-callable request data. The request binds patch input, authority, workspace basis, budgets, settlement schema, and reconciliation identity without granting filesystem-write authority.

[claim:artifact-ownership, confidence:1.00] The owning lawpack generator publishes the complete canonical closure: source, manifest, exports, adapter, target configuration, Core, Target IR, and digest sidecars.

[claim:runtime-boundary, confidence:1.00] Dynamic patch, path-aperture, basis, and policy-instance admission remains an Echo responsibility. This change performs no patch and introduces no ambient filesystem, shell, Git, network, or model authority.

Walkthrough

The compiler path admits a second concrete external-request family. The focused syntax test proves the exact operation, schemas, dynamic authority values, basis, budgets, and reconciliation law survive Core and Target lowering while callable Target steps remain empty. [claim:typed-request, confidence:1.00] See crates/edict-syntax/tests/external_action_requests.rs#276@1130df16e08daa5143e4be2a5c05c00a9c7fefe7.

The generator builds the closure from canonical lawpack resources, compiles the digest-pinned source, lowers it, and refuses output unless it contains exactly one external request and zero callable steps. [claim:generated-closure, confidence:1.00] See xtask/src/lawpack_goldens.rs#434@1130df16e08daa5143e4be2a5c05c00a9c7fefe7.

The target configuration names the authority, basis, patch, forbidden-path, postcondition, and reconciliation classes that Echo must interpret during admission and execution. [claim:policy-binding, confidence:0.99] See xtask/src/lawpack_goldens.rs#632@1130df16e08daa5143e4be2a5c05c00a9c7fefe7.

The source remains declarative request construction. [claim:no-write-authority, confidence:1.00] See xtask/src/lawpack_goldens.rs#686@1130df16e08daa5143e4be2a5c05c00a9c7fefe7.

The composed ownership boundary is:

flowchart LR
    S[Edict source] --> C[Canonical Core request]
    C --> T[Canonical Target request]
    T --> V[Independent Echo derivation check]
    V --> A[Echo admission and adapter execution]
    A --> W[Durable settlement]
Loading
Caption: Compiler-owned request construction stops before world mutation.

Edict owns the request value and its exact derivation. Echo owns live value admission, durable execution, and settlement. The external adapter alone owns filesystem authority.

The diagram’s boundary is normative: compilation never invokes the adapter, and Echo must not infer a provisional request format.

Verification

  • RED: cargo xtask lawpack-goldens rejected the absent fixtures/lawpack/workspace-patch/manifest.cbor.
  • GREEN: cargo test -p edict-syntax --test external_action_requests passed 15/15 tests.
  • GREEN: cargo xtask lawpack-goldens --write followed by cargo xtask lawpack-goldens reproduced the checked closure.
  • GREEN: cargo xtask verify passed formatting, clippy with warnings denied, the all-features workspace suite, doctests, canonical golden checks, provider contract checks, the runtime dependency boundary, 25 topic shelves, and git diff --check.
  • Review remediation: the contract graph first rejected an imprecise oracle/path pair; tests::contract_graph_is_valid now accepts the executable evidence and exact fixture path.

Dependency rationale

No dependency was added. Existing compiler, canonical encoding, lawpack, and Target IR surfaces own the implementation.

Documentation impact

The external-action topic now records EXTREQ-REQ-010, cases EXTREQ-TP-019 through EXTREQ-TP-023, fixture ownership, determinism obligations, and the remaining Echo execution gap. See docs/topics/external-action-requests/test-plan.md#40@1130df16e08daa5143e4be2a5c05c00a9c7fefe7 and docs/topics/external-action-requests/README.md#110@1130df16e08daa5143e4be2a5c05c00a9c7fefe7.

Appendix: Source citations
Claim Evidence
Request compiles as one non-callable Core and Target request crates/edict-syntax/tests/external_action_requests.rs#276@1130df16e08daa5143e4be2a5c05c00a9c7fefe7
Generator owns the exact closure xtask/src/lawpack_goldens.rs#434@1130df16e08daa5143e4be2a5c05c00a9c7fefe7
Target policy classes are digest-bound configuration xtask/src/lawpack_goldens.rs#632@1130df16e08daa5143e4be2a5c05c00a9c7fefe7
Edict source only constructs request data xtask/src/lawpack_goldens.rs#686@1130df16e08daa5143e4be2a5c05c00a9c7fefe7
Fixture boundary and ownership fixtures/lawpack/workspace-patch/README.md#1@1130df16e08daa5143e4be2a5c05c00a9c7fefe7
Contract graph and open Echo gap docs/topics/external-action-requests/test-plan.md#40@1130df16e08daa5143e4be2a5c05c00a9c7fefe7

Closes #178

@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

@coderabbitai review

@flyingrobots

Copy link
Copy Markdown
Owner Author

@codex please review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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 Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Added support for basis-bound, validated workspace patch requests.
    • Validated patch requests carry patch data, authority, workspace basis, budgets, settlement, and reconciliation details.
    • Requests compile as non-callable data without directly granting filesystem write access.
  • Documentation

    • Added usage guidance, fixture documentation, and expanded test coverage for validated patch workflows.
  • Tests

    • Added deterministic compilation, identity, artifact, and bounded-stress validation for workspace patch requests.

Walkthrough

Adds the workspace.patch.applyValidated@1 compiler-owned request closure, typed lowering coverage, a generated workspace-patch lawpack fixture set, golden artifact generation, and documentation for non-callable request semantics.

Changes

Validated workspace patch

Layer / File(s) Summary
Typed request construction and lowering
crates/edict-syntax/tests/external_action_requests.rs
Typed schema and reconciliation coordinates are parameterized, and validated patch lowering is asserted to produce one external-action request with zero callable steps.
Validated patch contract
fixtures/lawpack/workspace-patch/apply-validated-patch.edict
Defines ApplyPatchInput and the applyValidated intent with patch, authority, basis, budget, schema, and reconciliation bindings.
Lawpack golden generation and artifacts
xtask/src/lawpack_goldens.rs, fixtures/lawpack/workspace-patch/*
Generates and verifies canonical workspace-patch manifest, exports, adapter, configuration, source, Core, Target IR, and digest fixtures.
Documentation and test-plan coverage
docs/topics/external-action-requests/*, fixtures/lawpack/workspace-patch/README.md, CHANGELOG.md
Documents request semantics, fixture coverage, planned identity and stress cases, and deferred Echo execution and settlement.

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

Sequence Diagram(s)

sequenceDiagram
  participant Generator
  participant Compiler
  participant CoreIR
  participant TargetIR
  participant Echo
  Generator->>Compiler: compile applyValidated source
  Compiler->>CoreIR: produce compiler-owned request data
  Compiler->>TargetIR: lower one external-action request
  TargetIR-->>Echo: provide basis-bound validated patch request
  Echo-->>Echo: execute and settle request
Loading

Possibly related issues

  • flyingrobots/edict#178 — Covers validated workspace patch request compilation, non-callable Core/Target artifacts, and identity tests.
  • flyingrobots/hello-echo#11 — Covers the compiler-authored validated patch request’s basis, policy, settlement, reconciliation, and authority constraints.

Possibly related PRs

  • flyingrobots/edict#170 — Introduced the lawpack-golden and adapter/loading pipeline extended here for workspace-patch artifacts.
  • flyingrobots/edict#175 — Introduced the typed external-action request machinery extended here for validated-patch compilation.

Poem

A patch is typed, its bounds are bright,
Core holds data, not the write.
Target steps remain at zero,
Golden bytes stand guard like a hero.
Echo waits to settle right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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: compiling basis-bound validated patch requests.
Description check ✅ Passed The description is directly related to the PR and accurately describes the validated patch request work.

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.

@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: 2

🤖 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/tests/external_action_requests.rs`:
- Around line 264-297: Extend
validated_patch_request_compiles_as_non_callable_data to assert the complete
ExternalActionRequest closure in both Core and Target IR: verify exact
digest-locked operation, input, settlement, and reconciliation resource
references, plus the structured input, authority, basis, and budget expressions
using the expected artifact fields and values. Keep the existing operation/count
assertions and ensure the test fails if lowering drops or substitutes any
EXTREQ-TP-019 request data.

In `@docs/topics/external-action-requests/README.md`:
- Around line 110-122: Update the documentation for
workspace.patch.applyValidated@1 to describe the application source as carrying
the authority value/scope, not an authority digest; retain “digest” only for
resource references where that contract applies, and keep the remaining typed
request-expression description unchanged.
🪄 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 Plus

Run ID: 2d49a75e-4a76-4e5c-b2ec-24900c2f22d2

📥 Commits

Reviewing files that changed from the base of the PR and between 97ef5ea and e9a9596.

📒 Files selected for processing (19)
  • CHANGELOG.md
  • crates/edict-syntax/tests/external_action_requests.rs
  • docs/topics/external-action-requests/README.md
  • docs/topics/external-action-requests/test-plan.md
  • fixtures/lawpack/workspace-patch/README.md
  • fixtures/lawpack/workspace-patch/adapter.cbor
  • fixtures/lawpack/workspace-patch/adapter.sha256
  • fixtures/lawpack/workspace-patch/apply-validated-patch.core.cbor
  • fixtures/lawpack/workspace-patch/apply-validated-patch.core.sha256
  • fixtures/lawpack/workspace-patch/apply-validated-patch.edict
  • fixtures/lawpack/workspace-patch/apply-validated-patch.target-ir.cbor
  • fixtures/lawpack/workspace-patch/apply-validated-patch.target-ir.sha256
  • fixtures/lawpack/workspace-patch/exports.cbor
  • fixtures/lawpack/workspace-patch/exports.sha256
  • fixtures/lawpack/workspace-patch/manifest.cbor
  • fixtures/lawpack/workspace-patch/manifest.sha256
  • fixtures/lawpack/workspace-patch/request-profile-configuration.cbor
  • fixtures/lawpack/workspace-patch/request-profile-configuration.sha256
  • xtask/src/lawpack_goldens.rs
📜 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 (6)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Never amend Git commits, use git rebase without explicit user approval, or force any Git operation; use new commits and regular merge commits instead.
Do not create draft pull requests, and never use a codex prefix in branch names, pull request titles, or commit messages.
Pull requests for issue work must include GitHub auto-close text such as Closes #123`` for every issue they intend to close.
Use codex-think --remember --json when starting a session, entering the repository, or regaining context, and record significant durable events with `codex-think "..." --json`. Treat Think as memory rather than repository truth.
Every pull request body must contain `## Plain-English Walkthrough` with `### TL;DR` and `### Walkthrough`, explaining the prior behavior, new model and dataflow, invariants, failures, compatibility, and verification as applicable.
Use Mermaid diagrams for nontrivial flow, lifecycle, ownership, or component interaction when clearer than prose; every diagram requires an introductory paragraph, the diagram, the exact collapsed caption structure, and a concluding interpretation.
Tag each material technical claim at first occurrence as `[claim:, confidence:]`, cite evidence using repository-relative paths, line numbers, and Git SHAs, and end the explanatory body with a collapsed citations appendix.
If CodeRabbit is actively reviewing, obtain its approval before merge; if unavailable due to limits or credits, request `@codex review please` and wait for the alternate response. Do not treat unavailability as approval unless a maintainer explicitly overrides the gate.
For release preparation, write the release thesis first, reconcile changes from the previous tag, update release policy and tests, verify the milestone has no open issues and no unauthorized crates.io publication occurred, and record a durable release report.
Run `cargo xtask verify` before claiming a branch is ready.

Files:

  • fixtures/lawpack/workspace-patch/manifest.sha256
  • fixtures/lawpack/workspace-patch/exports.sha256
  • fixtures/lawpack/workspace-patch/exports.cbor
  • fixtures/lawpack/workspace-patch/request-profile-configuration.cbor
  • fixtures/lawpack/workspace-patch/manifest.cbor
  • fixtures/lawpack/workspace-patch/request-profile-configuration.sha256
  • fixtures/lawpack/workspace-patch/apply-validated-patch.core.cbor
  • fixtures/lawpack/workspace-patch/adapter.sha256
  • fixtures/lawpack/workspace-patch/apply-validated-patch.edict
  • fixtures/lawpack/workspace-patch/apply-validated-patch.core.sha256
  • fixtures/lawpack/workspace-patch/README.md
  • fixtures/lawpack/workspace-patch/apply-validated-patch.target-ir.sha256
  • fixtures/lawpack/workspace-patch/apply-validated-patch.target-ir.cbor
  • CHANGELOG.md
  • docs/topics/external-action-requests/README.md
  • docs/topics/external-action-requests/test-plan.md
  • fixtures/lawpack/workspace-patch/adapter.cbor
  • xtask/src/lawpack_goldens.rs
  • crates/edict-syntax/tests/external_action_requests.rs
**/*.{rs,md}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,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.
For nontrivial behavior, contract, workflow, release, schema, validation, or public-surface changes, follow RED/GREEN TDD: update the owning test-plan.md, write the deterministic test first, observe the RED failure, implement the smallest coherent fix, then mark the case implemented only after executable evidence exists.

Files:

  • fixtures/lawpack/workspace-patch/README.md
  • CHANGELOG.md
  • docs/topics/external-action-requests/README.md
  • docs/topics/external-action-requests/test-plan.md
  • xtask/src/lawpack_goldens.rs
  • crates/edict-syntax/tests/external_action_requests.rs
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{md,mdx}: 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 generated reference material.
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:

  • fixtures/lawpack/workspace-patch/README.md
  • CHANGELOG.md
  • docs/topics/external-action-requests/README.md
  • docs/topics/external-action-requests/test-plan.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.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.

Files:

  • fixtures/lawpack/workspace-patch/README.md
  • CHANGELOG.md
  • docs/topics/external-action-requests/README.md
  • docs/topics/external-action-requests/test-plan.md
docs/topics/**

📄 CodeRabbit inference engine (AGENTS.md)

docs/topics/**: 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.
For every nontrivial behavior, contract, workflow, release, schema, validation, or public-surface change, identify or create the owning topic shelf, update test-plan.md, add executable evidence, update README.md only after behavior exists, and run cargo xtask verify.
Do not update topic shelves for purely mechanical edits that do not change a contract; explain the omission in the pull request or final report.

Files:

  • docs/topics/external-action-requests/README.md
  • docs/topics/external-action-requests/test-plan.md
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.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.
Do not add Rust dependencies without pull-request rationale and contract-impact notes; treat planned lint, dependency, and fuzzing ratchets as planned until executable checks land.

Files:

  • xtask/src/lawpack_goldens.rs
  • crates/edict-syntax/tests/external_action_requests.rs
🔇 Additional comments (19)
crates/edict-syntax/tests/external_action_requests.rs (1)

52-160: LGTM!

Also applies to: 464-624

fixtures/lawpack/workspace-patch/apply-validated-patch.edict (1)

1-34: LGTM!

xtask/src/lawpack_goldens.rs (1)

91-137: LGTM!

Also applies to: 434-725

fixtures/lawpack/workspace-patch/adapter.cbor (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/adapter.sha256 (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/manifest.cbor (1)

1-1: LGTM!

docs/topics/external-action-requests/README.md (1)

137-137: LGTM!

docs/topics/external-action-requests/test-plan.md (1)

40-51: LGTM!

Also applies to: 95-95

fixtures/lawpack/workspace-patch/README.md (1)

1-35: LGTM!

CHANGELOG.md (1)

28-32: LGTM!

fixtures/lawpack/workspace-patch/manifest.sha256 (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/request-profile-configuration.cbor (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/request-profile-configuration.sha256 (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/exports.cbor (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/exports.sha256 (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/apply-validated-patch.core.cbor (1)

1-4: LGTM!

fixtures/lawpack/workspace-patch/apply-validated-patch.core.sha256 (1)

1-1: LGTM!

fixtures/lawpack/workspace-patch/apply-validated-patch.target-ir.cbor (1)

1-4: LGTM!

fixtures/lawpack/workspace-patch/apply-validated-patch.target-ir.sha256 (1)

1-1: LGTM!

Comment thread crates/edict-syntax/tests/external_action_requests.rs
Comment thread docs/topics/external-action-requests/README.md
@flyingrobots
flyingrobots merged commit cf8c17f into main Jul 30, 2026
4 checks passed
@flyingrobots
flyingrobots deleted the task/178-basis-bound-patch-requests branch July 30, 2026 09:18
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.

Compile basis-bound validated workspace patch requests

1 participant