Enforce LIP-0008 ingress legitimacy in validation#2
Draft
danvoulez wants to merge 2 commits into
Draft
Conversation
- Extend AdmissibilityContext with ingress_tier and ingress_grammar
(both Option, default None — legacy callers untouched).
- Add validate_ingress_context: enforces the (None,None) / (Some,Some)
/ half-context discipline and the GrammarKind::admits matrix.
- Modify validate_capability to filter manifests by LIP-0008 ingress
acceptance (no early fail across multiple manifests).
- Add three ValidationError variants:
IncompleteIngressContext
TierGrammarIllegitimate
NoCapabilityForIngress
- Map all three into RuntimeFailure in the planning compiler's
back-compat projector with ingress-specific reason codes.
- Add ..Default::default() to two test-helper AdmissibilityContext
literals so the new fields adopt None.
Tests: tier_grammar_validation.rs — 10 cases covering legacy both-None,
half-context rejection, constitutional matrix, per-manifest restriction
without alternative, multi-manifest with one accepting, legacy manifest
permissiveness, explicit acceptance.
Lib regression: 141/141, unchanged.
Tracks LIP-0008 (Proposed). Stacked on add-lip-0008-types (PR #1).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Mention LIP-0008 tier/grammar support in README - Mention LIP-0008 support in crate docs - Mark legacy permissive manifest behavior as migration bridge - No behavior changes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
6883187 to
0b91898
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #1. Adds the enforcement half of LIP-0008: validation now refuses ingress that violates the constitutional tier × grammar matrix, refuses half-context, and refuses capability when no manifest accepts the declared ingress. Per-manifest rejection does not fail early.
What changed
src/validation.rsingress_tier/ingress_grammaronAdmissibilityContext+ 3 new
ValidationErrorvariants+
validate_ingress_contextfunction+ per-manifest ingress filter in
validate_capability(no early fail)src/planning_compiler.rsvalidation_error_to_runtime_failure(ingress-tagged reason codes); +..Default::default()inctx()test helpersrc/plan_executor.rs..Default::default()inctx()test helpersrc/lib.rsvalidate_ingress_contexttests/tier_grammar_validation.rsThe three Dan-approved adjustments are in
IncompleteIngressContextrejects(Some, None)and(None, Some). Legacy(None, None)still passes.validate_capabilityiterates all manifests;NoCapabilityForIngressonly fires when none accepts the declared ingress.Tests (10)
Lib regression: 141/141 passing, unchanged.
What this PR does NOT do (intentional)
operational_grammar.rs/strong_grammar.rsto setingress_tier/ingress_grammaron the context. Caller responsibility; lands in spike PR 4.admission.rs. Those types (Boundary/Gate/Passport/Visa) are unchanged; this PR works through thevalidation.rspipeline.Gates
🤖 Generated with Claude Code