Compile runtime optic artifacts#504
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR introduces a complete runtime optic artifact system for Wesley, enabling GraphQL operations to be compiled into inspectable, reusable, law-shaped contracts. It adds domain models for artifacts and authorization, a compiler path for SDL-to-artifact transformation with stable hashing, artifact resolution and validation, comprehensive tests, aligned fixture updates, and extensive documentation establishing "bounded lawful autonomy" as the north star. ChangesRuntime Optic Artifacts: Compiler-to-Runtime Workflow
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aaa8b42ace
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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/wesley-core/src/adapters/apollo.rs`:
- Around line 1502-1504: The parsing currently uses
optional_string_array(&arguments, "reads")? and
optional_string_array(&arguments, "writes")? which allows empty defaults; change
these to required parsing (e.g., required_string_array or
string_array(&arguments, "reads")? depending on existing helpers) so reads and
writes are mandatory when parsing the `@wes_footprint` directive, keep forbids as
optional_string_array(&arguments, "forbids")?, and update any error messages to
clearly state the missing required field; apply the same change to the other
occurrence noted around the 1511-1535 block.
In `@crates/wesley-core/src/domain/optic.rs`:
- Around line 263-267: The insert method should not return the caller-provided
artifact.registration verbatim; instead construct the
OpticRegistrationDescriptor from the canonical fields of the stored
OpticArtifact (use the artifact instance that you insert into self.artifacts or
read it back from the map) so the returned descriptor reflects the actual stored
values (artifact_id, storage/location, checksum/version metadata, etc.). Update
the insert implementation in function insert to build and return a new
OpticRegistrationDescriptor derived from the artifact's canonical fields (or
validate that artifact.registration matches those fields and panic/log if it
doesn't) rather than returning artifact.registration directly.
In `@crates/wesley-core/tests/runtime_optic_artifact.rs`:
- Around line 143-169: Add a test case that clones the existing registration,
mutates its operation_id (e.g., let mut tampered_operation =
registration.clone(); tampered_operation.operation_id =
"tampered-operation".to_string();), and assert that calling
registry.resolve_optic_artifact(&tampered_operation) returns
Err(ResolveError::OperationIdMismatch { .. }); place it alongside the other
tampered- field assertions that call registry.resolve_optic_artifact so the
descriptor integrity contract explicitly includes operation_id.
In `@docs/NORTHSTAR.md`:
- Around line 255-256: The doc inconsistently lists fields for
OpticRegistrationDescriptor (one place: artifact hash, schema id, operation id,
requirements digest; another place includes artifact_id); update all mentions so
the descriptor uses a single canonical field set—either add artifact_id
everywhere or remove it from the validation text—by editing the
OpticRegistrationDescriptor definitions and the validation/registration
paragraphs (the sections that reference OpticRegistrationDescriptor and
OpticArtifactHandle) so they all list the same fields in the same order and
adjust any validation examples or sentences to reference the chosen field set.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e8abffea-e310-4bb2-81b1-147b8f599879
📒 Files selected for processing (26)
CHANGELOG.mdREADME.mdcrates/wesley-core/src/adapters/apollo.rscrates/wesley-core/src/domain/mod.rscrates/wesley-core/src/domain/optic.rscrates/wesley-core/src/lib.rscrates/wesley-core/tests/operation_analysis.rscrates/wesley-core/tests/runtime_optic_artifact.rscrates/wesley-emit-rust/src/lib.rscrates/wesley-emit-typescript/src/lib.rsdocs/NORTHSTAR.mddocs/README.mddocs/SDL.mddocs/VISION.mddocs/method/backlog/bad-code/DX_preflight-latency-instrumentation.mddocs/method/backlog/bad-code/SOURCE_optic-artifact-id-hash-semantics.mddocs/method/backlog/bad-code/SOURCE_optic-authority-vocabulary-boundary.mddocs/method/backlog/cool-ideas/README.mddocs/method/backlog/cool-ideas/RUNTIME_echo-optic-artifact-registration-fixture.mddocs/method/backlog/cool-ideas/RUNTIME_warp-ttd-adapter-capability-rename.mddocs/method/backlog/cool-ideas/SOURCE_continuum-optic-admission-role-note.mdtest/fixtures/README.mdtest/fixtures/consumer-models/stack-witness-0001-file-history.graphqltest/fixtures/consumer-models/stack-witness-0001-vectors.jsontest/fixtures/runtime-optics/rename_symbol.graphqltest/fixtures/runtime-optics/workspace_schema.graphql
🔍 The Case of Pull Request #504Plain-English Readout
Suggested next actions
📚 Glossary (what the Holmes terms mean)
🕵️ SHA-lock HOLMES full report (click to expand)🕵️ SHA-lock HOLMES Investigation
🔍 Executive Deduction"Watson, after careful examination of the evidence, I deduce..." Weighted Completion: ░░░░░░░░░░ 0.0% 🧩 SCS Breakdown
🧪 TCI Breakdown
|
| Component | Risk Share | Points | Count |
|---|---|---|---|
| Drops | 0% | 0 | 0 |
| Renames Without Uid | 0% | 0 | 0 |
| Add Not Null Without Default | 0% | 0 | 0 |
| Non Concurrent Indexes | 0% | 0 | 0 |
📊 The Weight of Evidence
"Observe, Watson, how not all features carry equal importance..."
| Element | Weight | Status | Evidence | Strength | Deduction |
|---|
🚪 Security & Performance Gates
"Elementary security measures, Watson..."
| Gate | Status | Evidence | Holmes's Ruling |
|---|---|---|---|
| Migration Risk | ✅ | MRI: 0.0% | "Trivial risk" |
| Test Coverage | TCI: 0.0% | "Theatrical tests!" | |
| Sensitive Fields | ✅ | 0 fields | "All secured" |
| Evidence Quality | ⛔ | 0 exact · 0 whole-file · 0 coarse | "No evidence citations were available for trust analysis." |
📋 The Verdict
⛔ YOU SHALL NOT PASS
"Critical evidence is missing! Return to your laboratory!"
Signed and sealed,
- S. Holmes, Consulting Detective
[END OF INVESTIGATION FOR COMMIT d6c5917]
🧵 Command Run
- Run ID: run-mp3b5cpw-86rkh7
- Transmutation: holmes-investigate
- Command: investigate
- Status: completed
- Ledger: /home/runner/work/wesley/wesley/test/fixtures/examples/.wesley-cache/ledger
🩺 Dr. WATSON full report (click to expand)
🩺 Dr. Watson's Independent Verification Report
Medical Examination of Evidence
- Examination Date: 2026-05-13T00:15:17.951Z
- Patient SHA: d6c5917
🔬 Citation Verification
"Let me examine each piece of evidence independently..."
- Citations Examined: 0
- Verified: 0 ✅
- Failed: 0 ❌
- Unable to Verify: 0
- Exact Subrange Citations: 0
- Whole-file Citations: 0
- Coarse Citations: 0
- Evidence Trust: missing
- Trust Note: No evidence citations were available for trust analysis.
Verification Rate: 0.0%
📊 Mathematical Verification
"I shall recalculate Holmes's arithmetic..."
Holmes claimed SCS: 0.0%
Watson calculates: 0.0%
Difference: ✅ Negligible
🔍 Consistency Analysis
"Checking for contradictions in Holmes's deductions..."
🩺 Dr. Watson's Medical Opinion
VERIFICATION: CONCERNS NOTED
"While Holmes's methods are generally sound, I have noted some"
"discrepancies that warrant further investigation. No evidence citations were available for trust analysis."
Respectfully submitted,
- Dr. J. Watson, M.D.
Medical Examiner & Verification Specialist
🧵 Command Run
- Run ID: run-mp3b5wac-j5u1tf
- Transmutation: watson-verify
- Command: verify
- Status: completed
- Ledger: /home/runner/work/wesley/wesley/test/fixtures/examples/.wesley-cache/ledger
🔮 Professor MORIARTY full report (click to expand)
🧠 Professor Moriarty's Temporal Predictions
The Mathematics of Inevitability
- Analysis Date: 2026-05-13T00:15:54.670Z
🔮 Current State
SCS: ░░░░░░░░░░ 0.0%
TCI: ░░░░░░░░░░ 0.0%
MRI: 0.0% risk
Evidence Trust: missing
📈 Velocity Analysis
SCS Velocity: +0.00%/day
Git Activity (window): 24h · commits 39 (1 relevant) · ~39.00 commits/day
↳ Magnitude: ~65 relevant LOC/day across ~2.0 files/day
Activity Index: 16 / 100 (PR 0, Window 41)
Blended Velocity: +0.10%/day
Commit Size Burstiness: 0 / 100 (higher = more uneven commit sizes)
⏰ Completion Predictions
ETA: Cannot predict (insufficient velocity)
"At current velocity, completion is... improbable."
⚠️ Warnings
- Evidence trust is missing; No evidence citations were available for trust analysis.
🧪 Readiness EXPLAIN
- SCS ≥ 80% → FAIL ❌ (actual 0.0%)
- TCI ≥ 70% → FAIL ❌ (actual 0.0%)
- MRI ≤ 40% → PASS ✅ (actual 0.0%)
- CI Stability ≥ 90% (branch main) → FAIL ❌ (actual 89% over ~168h)
- Evidence Trust ≥ moderate → FAIL ❌ (actual missing) — No evidence citations were available for trust analysis.
- Delivery context (last 168h): 0 issues closed · 5 PRs merged (informational, not gating)
Signals blend: SCS velocity (70%) + Git activity (30%, branch-first). Activity only suppresses false plateaus; it never inflates readiness.
📊 Historical Trajectory
05-13: ░░░░░░░░░░ 0.0%
05-13: ░░░░░░░░░░ 0.0%
05-13: ░░░░░░░░░░ 0.0%
"Every problem becomes elementary when reduced to mathematics"
— Professor Moriarty
🧵 Command Run
- Run ID: run-mp3b6omk-q938pw
- Transmutation: moriarty-predict
- Command: predict
- Status: completed
- Ledger: /home/runner/work/wesley/wesley/test/fixtures/examples/.wesley-cache/ledger
Machine-readable reports: holmes-report.json · watson-report.json · moriarty-report.json (see workflow artifacts).
Filed at 221B Repository Street
|
@coderabbitai review pls 🥕 |
|
✅ Actions performedReview triggered.
|
|
@coderabbitai review please? |
|
✅ Actions performedReview triggered.
|
Validation run before push:
|
|
Follow-up backlog note added after the review-resolution table: |
|
Resolution accepted with one follow-up doctrine note: For v0, Longer term, I agree the spelling should likely become
Current behavior is correct; naming deserves a separate migration slice. I logged that follow-up in |
|
Self-review follow-up findings for reviewer visibility. @codex please confirm whether this interpretation of the remaining runtime-optic validation issues matches your read.
Doctrine answers being applied:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27f2c36645
ℹ️ 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".
|
Resolved the self-review findings from the table above. @codex please re-check these deltas against the concerns called out in #504 (comment).
Validation before push:
|
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
This branch turns the Wesley north-star discussion into the first concrete runtime optic artifact surface.
wesley-core, includingOpticArtifact,OpticRegistrationDescriptor,OpticAdmissionRequirements, law claim templates, capability/admission/witness vocabulary, and an in-memory artifact registry.OpticArtifactHandleso the handle means runtime registration, not compiler-issued authority.RenameSymbolmutation and tests stable artifact identity, scalar/shape inspection, directive preservation, footprint extraction, requirements digests, descriptor resolution, tamper rejection, and wire serialization.Validation
Ran during the branch work:
cargo test -p wesley-core --test runtime_optic_artifactcargo test -p wesley-corecargo xtask docs-checkgit diff --checkpnpm run preflightThe branch is pushed and the local worktree is clean.
Summary by CodeRabbit
New Features
Documentation
Tests