Skip to content

[NOD-002] Node Core-delegating middleware and fail-closed enforcement #21

Description

@mrnicholasbcarter-code

User story

Replace policy-adjacent routing authority with Core envelope consumption.

Problem and target state

The current audit identifies a gap that blocks the policy-first, ecosystem-neutral Verdict control plane. Implement the smallest coherent slice described here; preserve existing behavior outside this boundary.

Scope and likely files

src/index.ts, src/middleware/, src/adapters/

Acceptance criteria

  • Middleware calls Core decision API, validates envelope, enforces allowed provider/model/tool behavior, returns 503/degraded when Core unavailable, and never silently routes around denial; Express and SSE integration tests pass.

Dependencies and references

Depends on Core NOD-001 and VER-003; extends verdict-node#8 and #1.

Verification plan

  • Add or update fixtures at the contract boundary.
  • Test success, denial, degraded, unavailable, timeout, and malformed-input paths where applicable.
  • Demonstrate that advisory learning/retrieval/provider data cannot weaken hard policy.

Required implementation evidence

  • Targeted unit tests and negative-path tests
  • Integration/conformance test at the relevant repository boundary
  • Security/privacy review for any boundary, persistence, provider, or execution change
  • Documentation and migration notes updated
  • git diff --check and repository verification commands pass
  • Evidence receipt or reproducible test artifact linked in the implementation PR

Definition of done

  • Contract and implementation are versioned and backwards-compatibility impact is documented
  • Failure, timeout, stale-provider, unknown, and denial states are explicit
  • No learning, retrieval, UI, or external provider can bypass Core eligibility or envelope enforcement
  • Reviewers can reproduce the acceptance evidence from a clean checkout

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions