Skip to content

feat: fail-closed envelope + Core-authoritative routing + proxy enforcement - #42

Merged
mrnicholasbcarter-code merged 1 commit into
masterfrom
feat/nod-002-gaps-1-5
Aug 18, 2026
Merged

feat: fail-closed envelope + Core-authoritative routing + proxy enforcement#42
mrnicholasbcarter-code merged 1 commit into
masterfrom
feat/nod-002-gaps-1-5

Conversation

@mrnicholasbcarter-code

Copy link
Copy Markdown
Owner

Summary

Combines fail-closed envelope enforcement with Core-authoritative routing and proxy envelope enforcement.

Changes

Fail-closed envelope enforcement:

  • Default requireExecutionEnvelope changed from false to true (fail closed)
  • Strict validation: unknown top-level envelope fields and unknown execution_constraints fields rejected with envelope_invalid
  • Removed permissive index signatures from ExecutionEnvelope type
  • preserveUnknownFields (request payload passthrough) unchanged per ADR-021

Core-authoritative routing (gap1):

  • Added requireCoreDecision config option (default true = fail closed)
  • Missing Core decision returns 503, no heuristic fallback
  • Heuristic routing isolated behind explicit false opt-out
  • Tests in tests/router.test.ts

Proxy envelope enforcement (gap5):

  • Import and compose enforceExecutionEnvelope() in LlmGateNode.proxy()
  • Validates Core execution envelope before any upstream fetch (JSON + SSE)
  • Enforcement only when envelope available (Core decision fetched)
  • When requireCoreDecision=false, no envelope exists and enforcement skipped
  • Reuses forwarder's enforcement logic

Verification

All local gates pass: npm test (190 pass), typecheck, format:check, build, verify:package, pack:dry-run, git diff --check

Related

Addresses Node #30 gaps 1, 2, 3, 5. Gaps 4/6 blocked by Core #220.

…(gap5)

Gap1: Default Core-authoritative routing
- Added requireCoreDecision config option (default true = fail closed)
- When true: missing Core decision returns 503, no heuristic fallback
- When false: explicit compatibility opt-out enables heuristic routing
- Heuristic routing (evaluateTier, buildDynamicLadder, Q-learning) isolated behind opt-out
- Tests in tests/router.test.ts for missing/unavailable/malformed/denied/valid Core decisions

Gap5: Proxy envelope enforcement
- Import and compose enforceExecutionEnvelope() in LlmGateNode.proxy()
- Validates Core execution envelope before any upstream fetch in both JSON and SSE paths
- Enforcement only when envelope available (Core decision fetched)
- When requireCoreDecision=false (compatibility), no envelope exists and enforcement is skipped
- Reuses forwarder's enforcement logic, no duplication
- Error codes: envelope_missing, envelope_invalid, envelope_expired, envelope_tampered, model_disallowed, tool_disallowed, budget_exceeded

Verification: 190 tests pass, typecheck clean, format clean, build clean, package verified
@mrnicholasbcarter-code
mrnicholasbcarter-code merged commit 48f8189 into master Aug 18, 2026
6 checks passed
@mrnicholasbcarter-code
mrnicholasbcarter-code deleted the feat/nod-002-gaps-1-5 branch August 18, 2026 11:06
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