Skip to content

feat(adf): introduce unified evidence/enforcement pipeline #9

@SmartBrandStrategies

Description

@SmartBrandStrategies

Linked feedback: ADX-007

Problem

Enforcement is fragmented:

  • metric/weight evidence is computed in validator.ts
  • token budget/module budget checks are computed in bundler.ts

This creates multiple result shapes and multiple enforcement entry points.

Evidence:

  • Metric evidence: packages/adf/src/validator.ts:27
  • Bundle budget checks: packages/adf/src/bundler.ts:252

Scope

  • Introduce a single evaluator API (e.g. evaluateEvidence(...)) under packages/adf/src/evidence.ts.
  • Combine:
    • metric constraint results (pass/warn/fail)
    • weight summary
    • token budget utilization
    • per-module budget overruns
    • advisory-only module warnings
  • Update bundler and CLI evidence flows to consume shared evaluator output.

Acceptance Criteria

  • One typed result envelope is used by both bundle and evidence flows.
  • Validator semantics for metric status remain backward compatible.
  • No loss of fields currently emitted in bundle/evidence outputs.
  • Tests cover both metric and budget enforcement in one pipeline.

Test Plan

  • pnpm run test --filter @stackbilt/adf
  • Add tests for:
    • under/at/over ceiling metric statuses
    • bundle token budget utilization
    • per-module budget overrun emission
    • advisory-only module warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:adfADF parser/bundler/patcher packagepriority:p0Must ship this cycletype:featureNew capability or extension point

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions