Skip to content

feat(core): add optic invocation admission skeleton#331

Merged
flyingrobots merged 3 commits into
mainfrom
stack/optic-invocation-admission-skeleton
May 12, 2026
Merged

feat(core): add optic invocation admission skeleton#331
flyingrobots merged 3 commits into
mainfrom
stack/optic-invocation-admission-skeleton

Conversation

@flyingrobots
Copy link
Copy Markdown
Owner

@flyingrobots flyingrobots commented May 12, 2026

Summary

Adds the first Echo-side optic invocation admission boundary.

This proves that a registered OpticArtifactHandle is not authority. Echo resolves the handle internally, checks the requested operation against registered metadata, and obstructs invocations that use unknown handles, mismatched operations, or registered handles without capability presentation.

This slice intentionally does not add grant validation, AdmissionTicket, LawWitness, runtime execution, scheduler integration, WASM ABI changes, app nouns, or Continuum schema publication.

What this unlocks

The stack now has three vertebrae:

  1. Wesley compiles lawful optic artifact.
  2. Echo registers artifact and returns opaque handle.
  3. Echo obstructs invocation without authority.

Verification

  • cargo test -p warp-core optic_invocation
  • cargo test -p warp-core optic_artifact_registry
  • cargo check -p warp-core
  • scripts/ban-nondeterminism.sh
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added optic invocation admission checks that validate artifact handles, operation IDs, and capability presentation.
    • Admission will block invocations for unknown handles, operation mismatches, missing capabilities, or when capability validation is not yet available.
  • Tests
    • Added tests covering the above invocation admission scenarios.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

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 4 minutes and 58 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d44865fa-cad4-4f8c-b104-5e1fa5e9de4e

📥 Commits

Reviewing files that changed from the base of the PR and between a0f7858 and a3f50c8.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • crates/warp-core/src/optic_artifact.rs
  • crates/warp-core/tests/optic_artifact_registry_tests.rs
  • crates/warp-core/tests/optic_invocation_admission_tests.rs

Walkthrough

Adds v0 optic invocation request types and an admission-only admission method on OpticArtifactRegistry that resolves artifact handles, checks operation id and capability presentation, and always returns an obstruction outcome; includes tests for each obstruction reason and small export/changelog edits.

Changes

Optic Invocation Admission

Layer / File(s) Summary
Invocation types and contracts
crates/warp-core/src/optic_artifact.rs
Adds OpticBasisRequest, OpticApertureRequest, OpticCapabilityPresentation, OpticInvocation, OpticInvocationObstruction, and OpticInvocationAdmissionOutcome (obstruction-only).
Admission implementation
crates/warp-core/src/optic_artifact.rs
Adds OpticArtifactRegistry::admit_optic_invocation that resolves handles, returns UnknownHandle on missing resolution, OperationMismatch on operation id mismatch, MissingCapability when no presentation is supplied, and otherwise CapabilityValidationUnavailable.
Admission validation tests
crates/warp-core/tests/optic_invocation_admission_tests.rs
Fixtures and four tests asserting Obstructed outcomes for UnknownHandle, OperationMismatch, MissingCapability, and CapabilityValidationUnavailable.
Public exports and docs
crates/warp-core/src/lib.rs, CHANGELOG.md
Reformats pub use optic_artifact re-export layout and adds a changelog entry documenting the admission skeleton and its obstruction behavior.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels: tooling

Types laid down, gates in place,
Handles searched, operations traced,
Capabilities demanded, checks unpaid—
Every path returns a blockade,
Tests confirm the scaffold's shade.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: adding an optic invocation admission skeleton with handle resolution, operation matching, and capability checking.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 stack/optic-invocation-admission-skeleton

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.

Copy link
Copy Markdown
Contributor

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

🤖 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/warp-core/src/optic_artifact.rs`:
- Around line 253-257: The module-level rustdoc is outdated: it claims
invocation admission is intentionally out of scope, but the function
admit_optic_invocation now implements admission behavior; update the module
header to reflect the new admission boundary by removing or revising the
sentence that says invocation admission is out of scope and describing that
admit_optic_invocation handles admission (mention the function name
admit_optic_invocation) and any relevant intended semantics or limitations so
readers understand the current responsibility of this module.

In `@crates/warp-core/tests/optic_invocation_admission_tests.rs`:
- Around line 89-100: Add a new test that mirrors
optic_invocation_obstructs_missing_capability_for_registered_handle but sets
invocation.capability_presentation = Some(OpticCapabilityPresentation { ... })
(use fixture_invocation(handle) and then mutate or construct the invocation to
include a capability_presentation), call
registry.admit_optic_invocation(&invocation), and assert the result equals
OpticInvocationAdmissionOutcome::Obstructed(OpticInvocationObstruction::CapabilityValidationUnavailable);
reference the functions/values admit_optic_invocation,
OpticInvocationAdmissionOutcome, OpticInvocationObstruction,
OpticCapabilityPresentation, fixture_registry_and_handle, and fixture_invocation
to locate where to add the test.
- Around line 38-40: The test currently calls
registry.register_optic_artifact(fixture_artifact(),
fixture_descriptor()).expect("fixture descriptor should register") which
triggers clippy::expect_used; replace the expect call with explicit error
handling (e.g., match the Result or use unwrap_or_else with a panic!) so
failures still produce the "fixture descriptor should register" message; update
the binding to let handle = match
registry.register_optic_artifact(fixture_artifact(), fixture_descriptor()) {
Ok(h) => h, Err(e) => panic!("fixture descriptor should register: {:?}", e) }
(or equivalent) to satisfy the lint while preserving diagnostic output for
register_optic_artifact, fixture_artifact, and fixture_descriptor.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 75309d48-9a63-4800-88d8-298bef84696e

📥 Commits

Reviewing files that changed from the base of the PR and between bce0b11 and b9a165d.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • crates/warp-core/src/lib.rs
  • crates/warp-core/src/optic_artifact.rs
  • crates/warp-core/tests/optic_invocation_admission_tests.rs

Comment thread crates/warp-core/src/optic_artifact.rs
Comment thread crates/warp-core/tests/optic_invocation_admission_tests.rs Outdated
Comment thread crates/warp-core/tests/optic_invocation_admission_tests.rs
Copy link
Copy Markdown
Contributor

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

♻️ Duplicate comments (2)
crates/warp-core/src/optic_artifact.rs (1)

254-259: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update module rustdoc to reflect that invocation admission now exists.
admit_optic_invocation is implemented, but Line 5–Line 8 still says invocation admission is out of scope. Keep docs aligned with current module responsibility.

Proposed doc patch
-//! This module intentionally stops at registration. It does not admit
-//! invocations, validate capability grants, issue admission tickets, or execute
-//! runtime work. The only authority proven here is that Echo accepted and
-//! stored a specific Wesley artifact identity and its admission requirements.
+//! This module owns registration and an admission-only invocation gate.
+//! It admits/obstructs invocation requests at the handle/operation/capability
+//! boundary, but does not validate grants, issue admission tickets, or execute
+//! runtime work.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/warp-core/src/optic_artifact.rs` around lines 254 - 259, The
module-level rustdoc incorrectly claims invocation admission is out of scope
even though admit_optic_invocation is implemented; update the comments preceding
the function admit_optic_invocation to state that invocation admission is
supported (describe that the function can admit or obstruct invocations and that
success paths now exist), remove the sentence about "no success path", and
adjust the must_use/summary text to accurately describe the current behavior of
admit_optic_invocation so docs match the implementation.
crates/warp-core/tests/optic_invocation_admission_tests.rs (1)

39-41: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Replace expect(...) in test fixture setup to satisfy enforced clippy policy.
This call site has already been flagged by CI for clippy::expect_used; keep the same failure context with explicit match/panic handling.

Proposed patch
-    let handle = registry
-        .register_optic_artifact(fixture_artifact(), fixture_descriptor())
-        .expect("fixture descriptor should register");
+    let handle = match registry.register_optic_artifact(fixture_artifact(), fixture_descriptor()) {
+        Ok(handle) => handle,
+        Err(err) => panic!("fixture descriptor should register: {err:?}"),
+    };
As per coding guidelines, "`**/*.rs`: Run `cargo clippy --all-targets` for linting with a zero warnings policy."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/warp-core/tests/optic_invocation_admission_tests.rs` around lines 39 -
41, Change the test setup to avoid using expect(...) on the call to
registry.register_optic_artifact(fixture_artifact(), fixture_descriptor()) by
matching its Result and panicking with the same message on Err; specifically,
replace the expect call on register_optic_artifact so that the Result is matched
(e.g., match registry.register_optic_artifact(...)) and on Err call
panic!("fixture descriptor should register: {:?}", err) (or similar) while
binding the Ok value to handle, preserving the original failure context and
message.
🤖 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.

Duplicate comments:
In `@crates/warp-core/src/optic_artifact.rs`:
- Around line 254-259: The module-level rustdoc incorrectly claims invocation
admission is out of scope even though admit_optic_invocation is implemented;
update the comments preceding the function admit_optic_invocation to state that
invocation admission is supported (describe that the function can admit or
obstruct invocations and that success paths now exist), remove the sentence
about "no success path", and adjust the must_use/summary text to accurately
describe the current behavior of admit_optic_invocation so docs match the
implementation.

In `@crates/warp-core/tests/optic_invocation_admission_tests.rs`:
- Around line 39-41: Change the test setup to avoid using expect(...) on the
call to registry.register_optic_artifact(fixture_artifact(),
fixture_descriptor()) by matching its Result and panicking with the same message
on Err; specifically, replace the expect call on register_optic_artifact so that
the Result is matched (e.g., match registry.register_optic_artifact(...)) and on
Err call panic!("fixture descriptor should register: {:?}", err) (or similar)
while binding the Ok value to handle, preserving the original failure context
and message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 936f1adc-12ce-47dd-8f9f-483ac72e4097

📥 Commits

Reviewing files that changed from the base of the PR and between b9a165d and a0f7858.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • crates/warp-core/src/optic_artifact.rs
  • crates/warp-core/tests/optic_invocation_admission_tests.rs

@flyingrobots
Copy link
Copy Markdown
Owner Author

Issue Severity Addressed by Regression coverage Outcome
Placeholder capability presentation was not directly covered, risking fake authority success before grant validation exists. P2 a0f7858 optic_invocation_obstructs_placeholder_capability_presentation_until_grant_validation_exists; cargo test -p warp-core optic_invocation Placeholder presentations obstruct with CapabilityValidationUnavailable; no success path was added.
OpticInvocationAdmissionOutcome could be silently ignored by future callers. P2 a0f7858 cargo check -p warp-core; pre-commit cargo clippy -p warp-core --lib Admission outcome and admit_optic_invocation(...) are now #[must_use].
Module rustdoc still described invocation admission as out of scope after adding admit_optic_invocation. Docs a3f50c8 cargo clippy -p warp-core --all-targets -- -D warnings; cargo clippy -p warp-core --all-targets --features det_fixed -- -D warnings Module docs now describe registration plus the admission-only invocation gate and its limitations.
All-target Clippy rejected expect(...), expect_err(...), and explicit panic! in optic registration/admission test fixtures. P2 a3f50c8 cargo clippy -p warp-core --all-targets -- -D warnings; cargo clippy -p warp-core --all-targets --features det_fixed -- -D warnings; cargo test -p warp-core optic_artifact_registry; cargo test -p warp-core optic_invocation Test fixtures now use fallible test functions and ?; focused tests still pass without banned panic/expect paths.

@flyingrobots flyingrobots merged commit 1c94116 into main May 12, 2026
31 of 32 checks passed
@flyingrobots flyingrobots deleted the stack/optic-invocation-admission-skeleton branch May 12, 2026 19:36
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