Skip to content

Compile runtime optic artifacts#504

Merged
flyingrobots merged 40 commits into
mainfrom
wip/stack-witness-0001
May 13, 2026
Merged

Compile runtime optic artifacts#504
flyingrobots merged 40 commits into
mainfrom
wip/stack-witness-0001

Conversation

@flyingrobots
Copy link
Copy Markdown
Owner

@flyingrobots flyingrobots commented May 12, 2026

Summary

This branch turns the Wesley north-star discussion into the first concrete runtime optic artifact surface.

  • Aligns the README, VISION, SDL, and NORTHSTAR docs around Wesley as a compiler for lawful GraphQL-declared optic claims.
  • Adds a runtime optic artifact model in wesley-core, including OpticArtifact, OpticRegistrationDescriptor, OpticAdmissionRequirements, law claim templates, capability/admission/witness vocabulary, and an in-memory artifact registry.
  • Separates the Wesley-owned registration descriptor from the Echo-owned opaque OpticArtifactHandle so the handle means runtime registration, not compiler-issued authority.
  • Adds runtime optic fixtures for a RenameSymbol mutation and tests stable artifact identity, scalar/shape inspection, directive preservation, footprint extraction, requirements digests, descriptor resolution, tamper rejection, and wire serialization.
  • Keeps follow-up debt and cool ideas in backlog files as they came up, including preflight latency, artifact id/hash semantics, authority vocabulary ownership, Echo registration, WARP-TTD naming, and a Continuum role note.
  • Carries the Stack Witness fixture-byte hardening commit still present on this branch.

Validation

Ran during the branch work:

  • cargo test -p wesley-core --test runtime_optic_artifact
  • cargo test -p wesley-core
  • cargo xtask docs-check
  • git diff --check
  • pnpm run preflight

The branch is pushed and the local worktree is clean.

Summary by CodeRabbit

  • New Features

    • Added runtime optic artifact compilation from GraphQL schema and operations.
    • Added artifact resolution and validation against registry.
  • Documentation

    • Added North Star vision guide for bounded, lawful autonomy using GraphQL.
    • Added SDL and shape documentation with ecosystem component mapping.
    • Updated README with extended guidance on extending Wesley and legacy tooling.
    • Expanded Vision document with new concepts on law satisfaction.
  • Tests

    • Added comprehensive test suite validating optic artifact compilation and resolution.
    • Updated existing test fixtures with new directive conventions.
    • Added new workspace operation fixtures.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Warning

Rate limit exceeded

@flyingrobots has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 49 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 719ae782-e19f-4760-980d-7f271367a41d

📥 Commits

Reviewing files that changed from the base of the PR and between aaa8b42 and 7a0d789.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • README.md
  • crates/wesley-core/src/adapters/apollo.rs
  • crates/wesley-core/src/domain/ir.rs
  • crates/wesley-core/src/domain/optic.rs
  • crates/wesley-core/tests/runtime_optic_artifact.rs
  • docs/NORTHSTAR.md
  • docs/SDL.md
  • docs/method/backlog/bad-code/README.md
  • docs/method/backlog/bad-code/SOURCE_echo-footprint-directive-migration.md
  • docs/method/backlog/bad-code/SOURCE_runtime-optic-graphql-validation-coverage.md
📝 Walkthrough

Walkthrough

This 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.

Changes

Runtime Optic Artifacts: Compiler-to-Runtime Workflow

Layer / File(s) Summary
Optic domain types and contracts
crates/wesley-core/src/domain/mod.rs, crates/wesley-core/src/domain/optic.rs
Defines OpticArtifact, OpticRegistrationDescriptor, and OpticArtifactHandle as first-class domain models, plus OpticOperation with codec shapes/directives/law claims, OpticAdmissionRequirements with identity/permission/forbids, CapabilityGrant and CapabilityPresentation for bounded authority, LawWitness/LawVerdict/EvidenceKind for evidence tracking, OpticArtifactResolver trait, InMemoryOpticArtifactRegistry implementation, and ResolveError for artifact resolution validation.
Runtime optic compilation and artifact generation
crates/wesley-core/src/adapters/apollo.rs
Adds public compile_runtime_optic() and compile_runtime_optic_registration() entry points that parse SDL, select operations with optional operation naming, extract @wes_law and @wes_footprint directives, compute variable/payload codec shapes with fragment expansion and cycle detection, derive law claims and permission requirements, and generate stable artifact/registration hashes using canonical JSON serialization.
Core library re-exports for public API
crates/wesley-core/src/lib.rs
Re-exports domain::optic::\* and reformatted adapters::apollo public exports to make optic compilation and domain types available to downstream consumers.
Comprehensive runtime optic compilation and artifact tests
crates/wesley-core/tests/runtime_optic_artifact.rs
Validates artifact generation (IDs, hashes, operation metadata, directive preservation, footprint extraction, permission/requirements derivation, codec shapes, law claims), artifact resolution with tampering rejection, hash stability and sensitivity to shape/footprint/law changes, and stable JSON serialization of wire shapes and enums.
Stack Witness 0001 fixture directive argument updates
test/fixtures/consumer-models/stack-witness-0001-file-history.graphql, test/fixtures/consumer-models/stack-witness-0001-vectors.json, test/fixtures/README.md
Updates @wes_stack_witness directives from canonicalVarsEncoding/canonicalVarsBytes to fixtureVarsEncoding/fixtureVarsBytes across createBuffer, replaceRange, and textWindow operations; adds targetCodec: wesley-binary/v0; clarifies that fixture vars are temporary metadata while target codec is the durable codec.
Operation analysis and emitter test assertion updates
crates/wesley-core/tests/operation_analysis.rs, crates/wesley-emit-rust/src/lib.rs, crates/wesley-emit-typescript/src/lib.rs
Aligns stack-witness operation bindings tests to expect fixtureVarsEncoding, fixtureVarsBytes, and targetCodec; removes stale canonical-vars assertions; updates helper shape field name validation.
Vision expansion and north star documentation
docs/VISION.md
Expands the opening description to introduce "bounded lawful autonomy" and replayable contract evidence; adds "Bounded Lawful Autonomy" and "Law Satisfaction Witnesses" as new core tenets 6 and 7; updates the Mermaid mindmap to include optic admission and law witness concepts.
NORTHSTAR and SDL architecture documentation
docs/NORTHSTAR.md, docs/SDL.md, docs/README.md
Introduces NORTHSTAR.md explaining the north star of using GraphQL optics for bounded autonomy with law directives, apertures, footprints, and evidence-bearing witnesses; introduces SDL.md clarifying contract substrate vs. law-shaped data and mapping interpretation responsibilities; updates docs/README.md with new Signposts and Start Paths links.
Backlog items, methodology, and fixture guidance
docs/method/backlog/bad-code/*, docs/method/backlog/cool-ideas/*, test/fixtures/README.md
Adds backlog entries for Preflight Latency Instrumentation, Optic Artifact ID/Hash Semantics, Optic Authority Vocabulary Boundary, Echo Optic Artifact Registration Fixture, WARP-TTD Capability Rename, and Continuum Optic Admission Role; clarifies fixture codec target posture.
README, CHANGELOG, and fixture schema updates
README.md, CHANGELOG.md, test/fixtures/runtime-optics/workspace_schema.graphql, test/fixtures/runtime-optics/rename_symbol.graphql
Rewrites README "What Is Wesley?" boundary description, repository tooling map, North Star narrative, and release guidance; updates CHANGELOG entry for Stack Witness 0001 fixture shape; adds runtime-optics workspace schema with law/footprint directives and RenameSymbol mutation with receipt selection set.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • flyingrobots/wesley#499: Introduces the Stack Witness 0001 fixture artifacts and corresponding test infrastructure; this PR updates those fixtures and tests to align with the new optic domain model directives and field naming.
  • flyingrobots/wesley#503: Updates README.md with overlapping structural and clarity changes to the What Is Wesley section and documentation links.

Suggested labels

enhancement, feature

Poem

🐰 The GraphQL optic blooms bright,
Bounded autonomy takes flight,
Law directives guide the way,
Evidence blooms to save the day,
Witnesses sing of lawful might!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.92% 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
Title check ✅ Passed The title 'Compile runtime optic artifacts' accurately and concisely describes the main change: adding runtime optic artifact compilation to wesley-core.
Description check ✅ Passed The PR description is comprehensive and addresses the template sections: Summary clearly states the problem/solution; Why section explains the rationale and north-star alignment; Changes uses bullet points for focused modifications; backlog items are documented; Testing/validation notes are provided. However, explicit Risk, Backout, and Merge Strategy sections are missing from the provided description.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wip/stack-witness-0001

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 and usage tips.

@flyingrobots flyingrobots changed the title [codex] Compile runtime optic artifacts Compile runtime optic artifacts May 12, 2026
@flyingrobots flyingrobots marked this pull request as ready for review May 12, 2026 17:38
Copy link
Copy Markdown

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

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: 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".

Comment thread crates/wesley-core/src/adapters/apollo.rs
Comment thread crates/wesley-core/src/adapters/apollo.rs
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between f995fcb and aaa8b42.

📒 Files selected for processing (26)
  • CHANGELOG.md
  • README.md
  • crates/wesley-core/src/adapters/apollo.rs
  • crates/wesley-core/src/domain/mod.rs
  • crates/wesley-core/src/domain/optic.rs
  • crates/wesley-core/src/lib.rs
  • crates/wesley-core/tests/operation_analysis.rs
  • crates/wesley-core/tests/runtime_optic_artifact.rs
  • crates/wesley-emit-rust/src/lib.rs
  • crates/wesley-emit-typescript/src/lib.rs
  • docs/NORTHSTAR.md
  • docs/README.md
  • docs/SDL.md
  • docs/VISION.md
  • docs/method/backlog/bad-code/DX_preflight-latency-instrumentation.md
  • docs/method/backlog/bad-code/SOURCE_optic-artifact-id-hash-semantics.md
  • docs/method/backlog/bad-code/SOURCE_optic-authority-vocabulary-boundary.md
  • docs/method/backlog/cool-ideas/README.md
  • docs/method/backlog/cool-ideas/RUNTIME_echo-optic-artifact-registration-fixture.md
  • docs/method/backlog/cool-ideas/RUNTIME_warp-ttd-adapter-capability-rename.md
  • docs/method/backlog/cool-ideas/SOURCE_continuum-optic-admission-role-note.md
  • test/fixtures/README.md
  • test/fixtures/consumer-models/stack-witness-0001-file-history.graphql
  • test/fixtures/consumer-models/stack-witness-0001-vectors.json
  • test/fixtures/runtime-optics/rename_symbol.graphql
  • test/fixtures/runtime-optics/workspace_schema.graphql

Comment thread crates/wesley-core/src/adapters/apollo.rs Outdated
Comment thread crates/wesley-core/src/domain/optic.rs Outdated
Comment thread crates/wesley-core/tests/runtime_optic_artifact.rs
Comment thread docs/NORTHSTAR.md Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

🔍 The Case of Pull Request #504

Plain-English Readout

  • Holmes (evidence investigation): Holmes says this change should not ship in its current state. Main reasons: No evidence citations were available for trust analysis; test evidence is incomplete; schema coverage is incomplete.
  • Watson (independent verification): Watson found verification concerns. Most important concern: Low migration risk claimed but schema incomplete.
  • Moriarty (trend forecast): Moriarty sees progress as stalled right now, so forecast confidence is limited.

Suggested next actions

  1. Tighten citations so the report points to exact lines instead of whole files or coarse references.
  2. Resolve Watson’s verification concerns before trusting the Holmes verdict as final.
  3. Treat the readiness forecast as stalled until new evidence or real progress moves the trend again.
  4. Add or strengthen tests for the schema elements and operations HOLMES flagged as weakly proven.
📚 Glossary (what the Holmes terms mean)
  • HOLMES: Wesley’s main evidence investigation. It decides whether the cited proof is strong enough to justify shipping this commit.
  • WATSON: An independent verification pass. It checks Holmes’s citations and score math instead of trusting them blindly.
  • MORIARTY: A readiness forecast over time. It is advisory trend analysis, not the release gate itself.
  • Schema coverage score (SCS): How much of the schema has direct supporting evidence across generated artifacts and cited proof.
  • Test confidence index (TCI): How much test evidence exists for constraints, policies, relationships, and operations.
  • Migration risk index (MRI): How risky the schema change is to roll out. Lower is better.
  • Evidence trust: Whether the report is backed by exact citations, whole-file citations, or coarse references. Weak trust means the claim may be directionally right but not specific enough to trust blindly.
  • Citation quality: A count of exact line-span citations versus whole-file or coarse references.
  • ELEMENTARY: Ready to ship based on the current evidence.
  • REQUIRES INVESTIGATION: More work or review is needed before shipping.
  • YOU SHALL NOT PASS: Do not ship this change in its current state.

🕵️ SHA-lock HOLMES full report (click to expand)

🕵️ SHA-lock HOLMES Investigation

  • Generated: 2026-05-13T00:14:26.314Z
  • Commit SHA: d6c5917
  • Bundle Version: 2.0.0

⚠️ Evidence valid only for commit d6c5917

🔍 Executive Deduction

"Watson, after careful examination of the evidence, I deduce..."

Weighted Completion: ░░░░░░░░░░ 0.0%
Scores: SCS 0.0% · TCI 0.0% · MRI 0.0%
Verification Status: 0 claims verified
Citation Quality: 0 exact · 0 whole-file · 0 coarse
Evidence Trust: missing
Ship Verdict: YOU SHALL NOT PASS

🧩 SCS Breakdown

Component Score Coverage
Sql 0.0% 0.00/154.00
Types 0.0% 0.00/154.00
Validation 0.0% 0.00/154.00
Tests 0.0% 0.00/154.00

🧪 TCI Breakdown

Component Score Coverage Note
Unit Constraints 0.0% 0/104 N/A
Unit Rls 0.0% N/A
Integration Relations 0.0% 0/3 N/A
E2e Ops N/A Query operation test tracking not yet implemented

⚠️ MRI 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..."

⚠️ Low migration risk claimed but schema incomplete

🩺 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)
⚠️ PLATEAU DETECTED - Low SCS movement and low recent Git activity.

⏰ 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

@flyingrobots
Copy link
Copy Markdown
Owner Author

@coderabbitai review pls 🥕

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

@flyingrobots Understood — pedantic mode engaged. No mercy. Reviewing now. 🥕

✅ Actions performed

Review triggered.

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.

@flyingrobots
Copy link
Copy Markdown
Owner Author

@coderabbitai review please?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

@flyingrobots On it! Triggering a fresh review of the latest commits on wip/stack-witness-0001 now. 🥕

✅ Actions performed

Review triggered.

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.

@flyingrobots
Copy link
Copy Markdown
Owner Author

Issue Severity Addressed by Regression coverage Outcome
Non-root @wes_footprint directives could influence runtime optic admission metadata. P1 ef80ed6 runtime_optic_rejects_non_root_footprint_directives; cargo test -p wesley-core --test runtime_optic_artifact @wes_footprint is now root-field-only for v0; nested/fragment/inline placements reject before artifact emission.
Input object literals and enum values were not recursively validated before shape.valid.v1. P1 57270fc runtime_optic_rejects_invalid_input_object_literals; cargo test -p wesley-core --test runtime_optic_artifact Literal validation now checks nested input fields, missing required fields, unknown fields, duplicate fields, scalar kinds, and enum membership.
Impossible fragment type conditions could contribute payload/directive/argument metadata. P1 4dfe2e6 runtime_optic_rejects_impossible_fragment_type_conditions; cargo test -p wesley-core --test runtime_optic_artifact Runtime optic lowering now compares possible runtime types for fragment spreads and inline fragments.
Nested list argument literals were flattened during validation. P1 0d0216c runtime_optic_rejects_flat_literals_for_nested_list_arguments; cargo test -p wesley-core --test runtime_optic_artifact List validation now preserves nested list wrappers while descending literal values.
ArtifactIdMismatch was an unreachable v0 resolver error. P2 6c626d7 resolves_artifact_by_registration_descriptor_and_rejects_tampering; cargo test -p wesley-core --test runtime_optic_artifact Removed the dead variant and branch; unknown descriptor artifact ids resolve as ArtifactNotFound.
Duplicate footprint labels were accepted inside admission-facing arrays. P2 0cf5837 runtime_optic_rejects_duplicate_footprint_labels; cargo test -p wesley-core --test runtime_optic_artifact reads, writes, and forbids now reject duplicate labels.
Authority and witness boundary types lacked wire-shape snapshots. P2 3aba9f7 optic_wire_shapes_serialize_with_stable_field_names; cargo test -p wesley-core --test runtime_optic_artifact Added snapshots for CapabilityGrant, LawWitness, and key authority/witness enum spellings.
Invalid-operation tests matched error message substrings. P3 8afe6e3 runtime_optic_rejects_invalid_root_argument_bindings; cargo test -p wesley-core --test runtime_optic_artifact Replaced substring assertions with structured LoweringError { area: "operation" } assertions.

Validation run before push:

  • cargo test -p wesley-core
  • cargo xtask docs-check
  • cargo fmt -- --check
  • git diff --check
  • pnpm run preflight
  • pre-push hook repository preflight

@flyingrobots
Copy link
Copy Markdown
Owner Author

Follow-up backlog note added after the review-resolution table: 5f83675 docs(backlog): track optic validation coverage audit records a bad-code item for a dedicated runtime optic GraphQL validation coverage matrix before shape.valid.v1 becomes a broader Echo trust anchor.

@flyingrobots
Copy link
Copy Markdown
Owner Author

Resolution accepted with one follow-up doctrine note:

For v0, @wes_footprint is legal only on the selected root field because Wesley is compiling an Echo-consumed admission artifact, not defining scoped GraphQL field metadata.

Longer term, I agree the spelling should likely become @echo_footprint or another runtime-owned admission directive. The current PR keeps @wes_footprint stable to avoid widening this already-large review slice, but the ownership boundary is now clearer:

  • Wesley validates and compiles the declared footprint.
  • Echo interprets the footprint as admission requirements.
  • Nested/scoped footprints are rejected until deliberately designed.
  • shape.valid.v1 now covers the concrete executable-validation gaps found in review, with a follow-up backlog item for a full validation coverage matrix.

Current behavior is correct; naming deserves a separate migration slice. I logged that follow-up in 27f2c36 docs(backlog): track Echo footprint directive migration.

@flyingrobots
Copy link
Copy Markdown
Owner Author

Self-review follow-up findings for reviewer visibility. @codex please confirm whether this interpretation of the remaining runtime-optic validation issues matches your read.

Issue Severity Evidence Proposed resolution
Runtime optic accepts composite fields without required subselections while still emitting shape.valid.v1. P1 crates/wesley-core/src/adapters/apollo.rs payload traversal around payload_codec_shape / collect_payload_codec_fields Add RED tests for composite fields without subselections and scalar/enum fields with subselections; reject unsupported invalid selection shapes with structured LoweringError; document the supported executable subset.
Conflicting same-response-name selections are silently collapsed by payload codec collection. P1 push_unique_codec_field dedupes only by response path Add RED tests for alias conflicts; introduce a minimal shared runtime-optic selection validation helper called before payload shape, directive preservation, selection argument binding, and law claim generation. Longer-term hill: a single validated runtime-optic selection plan.
Nested-list variable compatibility accepts nullable leaves for non-null leaf requirements. P1 variable_type_is_compatible / list_items_are_compatible Add RED test for $matrix: [[Int]!]! against [[Int!]!]!; fix nested leaf nullability compatibility.
Duplicate executable directive arguments are last-write-wins. P1 extract_executable_directive_arguments inserts into IndexMap without duplicate detection Add RED tests for duplicate @wes_footprint and @wes_law args; reject duplicates with structured operation lowering errors.
Interface possible-type calculation does not support interface inheritance. P2 / subset doctrine SchemaIndex::possible_runtime_types only checks direct object implements Runtime optic v0 should reject unsupported GraphQL features explicitly and document the executable subset. Do not claim full GraphQL spec coverage. Interface inheritance should be an explicit unsupported feature/backlog item unless implemented through a real executable validator.
New backlog files use ## Done Looks Like instead of local ## Done looks like style. Docs SOURCE_echo-footprint-directive-migration.md, SOURCE_runtime-optic-graphql-validation-coverage.md Normalize heading style.
Bad-code backlog front door does not surface the new runtime-optic bad-code items. Docs docs/method/backlog/bad-code/README.md Add a small index for the runtime optic debt entries.

Doctrine answers being applied:

  • Runtime optic v0 should reject unsupported GraphQL features explicitly and document the executable subset. shape.valid.v1 means valid within Wesley's declared runtime-optic executable subset, not full GraphQL spec forever.
  • Response-name conflict validation should not be another isolated patch. Short term: shared helper used by every runtime-optic traversal. Medium term: validate_runtime_optic_executable_selection(...) -> validated selection plan consumed by payload codec extraction, directive extraction, selection arguments, and law claims.
  • @wes_footprint remains stable in this PR, but it is a vocabulary ownership smell. Future spelling should likely be @echo_footprint or another runtime-owned directive; Wesley compiles it, Echo owns runtime admission meaning.

Copy link
Copy Markdown

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

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: 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".

Comment thread crates/wesley-core/src/adapters/apollo.rs
Comment thread crates/wesley-core/src/adapters/apollo.rs
Comment thread crates/wesley-core/src/adapters/apollo.rs
Comment thread crates/wesley-core/src/adapters/apollo.rs
Comment thread crates/wesley-core/src/adapters/apollo.rs
@flyingrobots
Copy link
Copy Markdown
Owner Author

Resolved the self-review findings from the table above. @codex please re-check these deltas against the concerns called out in #504 (comment).

Issue Severity Addressed by Regression coverage Outcome
Runtime optic accepted composite fields without required subselections and leaf fields with subselections. P1 b7e9b55 runtime_optic_rejects_invalid_subselection_shapes; cargo test -p wesley-core --test runtime_optic_artifact Added shared runtime optic executable-selection validation and reject invalid subselection shapes before shape.valid.v1.
Conflicting same-response-name selections could be collapsed by payload codec extraction. P1 0eb04a7 runtime_optic_rejects_conflicting_response_names; cargo test -p wesley-core --test runtime_optic_artifact Added response-name field signatures in the shared validator; incompatible aliases/args/fragments now reject before downstream traversals.
Nested-list variable compatibility accepted nullable leaves for non-null leaf requirements. P1 7c8f105 runtime_optic_rejects_nullable_leaf_nested_list_variables; cargo test -p wesley-core --test runtime_optic_artifact Fixed nested list compatibility so nullable actual leaves cannot satisfy non-null expected leaves.
Duplicate executable directive arguments were last-write-wins. P1 9c742ee runtime_optic_rejects_duplicate_footprint_directive_arguments, runtime_optic_rejects_duplicate_law_directive_arguments; cargo test -p wesley-core --test runtime_optic_artifact Executable directive argument extraction now rejects duplicate argument names.
Runtime optic subset doctrine needed explicit unsupported-feature behavior. P2 / Doctrine 2623f38 runtime_optic_rejects_unsupported_executable_features; cargo test -p wesley-core --test runtime_optic_artifact Runtime optic v0 now rejects variable defaults, __typename, and interface inheritance explicitly; docs define shape.valid.v1 as validity within Wesley's declared executable subset.
New backlog files used Done Looks Like instead of local Done looks like style. Docs 7a0d789 cargo xtask docs-check; git diff --check Normalized heading style.
Bad-code backlog front door did not surface the new runtime-optic debt. Docs 7a0d789 cargo xtask docs-check; git diff --check Added a Runtime Optic And Admission index to docs/method/backlog/bad-code/README.md.

Validation before push:

  • cargo test -p wesley-core
  • cargo fmt -- --check
  • git diff --check
  • cargo xtask docs-check
  • pnpm run preflight
  • pre-push repository preflight

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ 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 685d301 into main May 13, 2026
23 checks passed
@flyingrobots flyingrobots deleted the wip/stack-witness-0001 branch May 13, 2026 03:19
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