Skip to content
Projects
Reference implementation

evidence-gate

Decides whether a revision is ready to release from evidence, and answers with one of three verdicts: GO, NO_GO or UNDETERMINED.

Status
Reference implementation of the decision step only. Evidence is supplied as JSON and trusted as given; no collectors, no signing, no history.
Authorship
"Implemented with AI coding agents (Claude Code)," in the repository's own words: an independent reference implementation written from scratch, with fictional example data.
Stack
TypeScript · Node.js 22 · Vitest · No runtime dependencies
Demonstrates
Three-valued (strong Kleene) evaluation · Policy as data with strict validation · Evidence binding to one revision, with expiry · Explicit, time-boxed waivers · Reproducible, explained verdicts with CI exit codes
Verified
76 Vitest tests pass; lint, type check and build are clean; the CLI returned exit codes 0, 1, 2 and 3 for GO, NO_GO, UNDETERMINED and invalid input. Observed at commit e26ad95a4a57adde030a7117e46daa59abe9c163.
Commands run
npm ci
npm run lint
npm run typecheck
npx vitest run
npm run build
Repository
github.com/Donovanfitch-dev/evidence-gate

Engineering problem

Release gates usually answer yes or no, so somewhere they decide what no data means. A check that never ran, a scan from last week, a health probe that looked at the previous deploy: each gets rounded to green or to red. Rounding to green ships a revision nobody actually checked. Rounding to red makes the gate noisy, and a gate people route around protects nothing.

Representative solution

Keep the third answer. Every requirement is met, unmet or unknown; the gate combines them with three-valued logic; and the verdict says which of the three it is and why. "We cannot tell yet" becomes a result a pipeline can act on, separate from "no".

A JSON policy lists requirements and a gate expression of all, any and not over them. Evidence records name a kind, a revision, an outcome, an observation time, a source and an actor. The evaluator is a pure function of policy, evidence, waivers, revision and the current instant, so a past verdict can be recomputed exactly.

Architecture

Each evidence record is filtered in order: does its kind match the requirement, is it about the revision being judged, is it within the requirement's maximum age and not future-dated. The latest observation per source and actor is kept. Passes and failures from different sources conflict, which is unknown by default or unmet when the policy fails closed. Enough distinct actors makes a requirement met. An active waiver can then make a requirement met while the report still shows what the evidence alone said. Finally the gate expression is evaluated in strong Kleene logic.

  • all.One unmet operand decides the result; otherwise unknown propagates.
  • any.One met operand decides the result, even when the others are unknown.
  • Advisory requirements.A requirement the gate does not reference is evaluated and reported but never decides the verdict.
  • Supplied by the pipeline

    Trusted as given; nothing here authenticates a record

    • policy JSON
    • evidence JSON or JSONL
    • waivers JSON
    • revision
    • the current instant
  • Evaluator

    A pure function of its inputs; never reads the system clock

    validate.ts

    • strict parsing
    • unknown keys rejected
    • offsets required

    evaluate.ts

    • revision binding
    • expiry
    • supersession
    • conflict
    • distinct actors
    • waivers

    tri.ts

    • all
    • any
    • not

    strong Kleene logic

  • Report

    • verdict
    • state and reason per requirement
    • ignored evidence and why
    • inputs SHA-256
    • exit code

    text or JSON

The inputs, the evaluation core, and the report. Containment only; the evaluation order is described in the prose.

Core components

  • tri.ts.The three-valued logic: strong Kleene all, any and not.
  • evaluate.ts.Revision binding, evidence age with clock-skew allowance, supersession of re-runs, conflict handling, distinct-actor counting, waivers, and the reproducibility digest.
  • validate.ts.Strict parsing of policies, evidence and waivers. Unknown keys are errors, and instants must carry a UTC offset.
  • render.ts.The text and JSON reports, including what was ignored and why, and how to settle each unknown requirement.
  • cli.ts.Argument handling and the exit codes: 0 GO, 1 NO_GO, 2 UNDETERMINED, 3 invalid input, 4 internal error.

Engineering decisions

  • Three values, not a score.A weighted score hides which requirement was missing. Three explicit states keep each requirement inspectable and make the combination rule a small truth table anyone can check.
  • Expired evidence is unknown in both directions.An old pass does not approve and an old failure does not block. A policy author can still fail closed by requiring fresh evidence.
  • Conflict defaults to unknown.When two sources disagree, picking the newer or the stricter is a guess. The default surfaces the disagreement; onConflict unmet is available where any failure should stop a release.
  • The clock is an input.evaluate never reads the system time, so tests are deterministic and a past verdict can be recomputed.
  • Waivers change the gate, not the record.A waived requirement still reports the state its evidence supports, so a waiver cannot quietly become "it passed". A waiver for an unknown requirement, or one the gate negates, is rejected.

Tradeoffs

  • JSON policy, not a rule language.all, any and not over named requirements covers common release shapes and stays readable in review. Thresholds and per-path rules are deliberately out of scope.
  • Pass or fail outcomes only.Numeric signals such as coverage or latency must be reduced to pass or fail by whatever produces the evidence.
  • Strictness has a cost.Rejecting unknown keys and offset-less timestamps makes inputs more tedious to write, and is what prevents a typo from silently removing a rule.

Verified functionality

Marked implemented and tested in the repository's status table, and exercised by the suite and the recordings below:

  • Three-valued evaluation, gate expressions and advisory requirements
  • Revision binding, evidence age, clock-skew handling, supersession and both conflict modes
  • Distinct-actor counting, waivers and the reproducibility digest
  • Strict input validation, the CLI, text and JSON reports, and the exit codes

Demonstration

The same policy evaluated against the repository's three example evidence files, then against a two-requirement policy with one misspelled key, written for this demonstration and not part of the repository. The clock is passed in with --now, so each report, including its SHA-256 of the inputs, is reproducible exactly. The data is fictional.

GO (exit 0)

Command: $ node dist/cli.js --policy examples/policy.json --evidence examples/evidence/go.json --revision 4be1c02 --now 2026-03-02T12:00:00Z

policy    service-release
revision  4be1c02
as of     2026-03-02T12:00:00.000Z

VERDICT   GO

  met      tests-pass         PASSED
                              passing observation from ci/main-pipeline
  met      lint-pass          PASSED
                              passing observation from ci/main-pipeline
  met      review-approved    PASSED
                              2 distinct actor(s): reviewer-ana, reviewer-bo
  met      dependency-scan    PASSED
                              passing observation from scanner/nightly
  met      staging-healthy    PASSED
                              passing observation from probe/staging
  unknown  canary-healthy     MISSING
                              no `deploy.canary-health` evidence for 4be1c02
  unknown  changelog-updated  MISSING  [advisory]
                              no `docs.changelog` evidence for 4be1c02

inputs sha256  d68aadd6a0f5bca1aaa7202e57f16806cd89eda7efffefe2dc6cc150bc22b136
Exit code 0. Recorded output, unedited.Every operand of the gate's all is met. canary-healthy is still unknown, but it sits inside an any with staging-healthy, which is met, and one met operand decides an any. The advisory changelog requirement is reported but never decides the verdict.

NO_GO (exit 1)

Command: $ node dist/cli.js --policy examples/policy.json --evidence examples/evidence/no-go.json --revision 4be1c02 --now 2026-03-02T12:00:00Z

policy    service-release
revision  4be1c02
as of     2026-03-02T12:00:00.000Z

VERDICT   NO_GO

  unmet    tests-pass         FAILED
                              latest observation from ci/main-pipeline is a failure
  met      lint-pass          PASSED
                              passing observation from ci/main-pipeline
  unknown  review-approved    INSUFFICIENT_ACTORS
                              1 of 2 required distinct actors
  unknown  dependency-scan    MISSING
                              no `scan.dependencies` evidence for 4be1c02
  unknown  staging-healthy    MISSING
                              no `deploy.staging-health` evidence for 4be1c02
  unknown  canary-healthy     MISSING
                              no `deploy.canary-health` evidence for 4be1c02
  unknown  changelog-updated  MISSING  [advisory]
                              no `docs.changelog` evidence for 4be1c02

To settle it:
  - tests-pass: fix the failure, or record an explicit time-boxed waiver
  - review-approved: another distinct actor must supply passing evidence
  - dependency-scan: collect this evidence for the revision
  - staging-healthy: collect this evidence for the revision
  - canary-healthy: collect this evidence for the revision

inputs sha256  a4b74cd26c28652e0a4d3c056714b1dbfd82dbb3cb11b111dc66e29a10e6cdc5
Exit code 1. Recorded output, unedited.The latest test run for this revision failed. A single unmet operand decides an all, even with other requirements still unknown.

UNDETERMINED (exit 2)

Command: $ node dist/cli.js --policy examples/policy.json --evidence examples/evidence/undetermined.json --revision 4be1c02 --now 2026-03-02T12:00:00Z

policy    service-release
revision  4be1c02
as of     2026-03-02T12:00:00.000Z

VERDICT   UNDETERMINED

  met      tests-pass         PASSED
                              passing observation from ci/main-pipeline
  met      lint-pass          PASSED
                              passing observation from ci/main-pipeline
  unknown  review-approved    INSUFFICIENT_ACTORS
                              1 of 2 required distinct actors
  unknown  dependency-scan    EXPIRED
                              the only `scan.dependencies` evidence for 4be1c02 is older than 1440 min
  unknown  staging-healthy    WRONG_REVISION
                              `deploy.staging-health` evidence exists, but none of it is about 4be1c02
  unknown  canary-healthy     MISSING
                              no `deploy.canary-health` evidence for 4be1c02
  unknown  changelog-updated  MISSING  [advisory]
                              no `docs.changelog` evidence for 4be1c02

To settle it:
  - review-approved: another distinct actor must supply passing evidence
  - dependency-scan: re-run the check; the last observation is too old to rely on
  - staging-healthy: run the check against this exact revision
  - canary-healthy: collect this evidence for the revision

inputs sha256  9da9b0e980cc0648b76452772fc7c540c4ee6f786710d4047b68cfe480648535
Exit code 2. Recorded output, unedited.Nothing failed, but one review is missing, the dependency scan is too old, the staging check was for a different revision, and the canary check never ran. The report says how to settle each one.

Invalid input (exit 3)

Command: $ node dist/cli.js --policy misspelled-policy.json --evidence examples/evidence/go.json --revision 4be1c02 --now 2026-03-02T12:00:00Z

evidence-gate: policy.requirements[1]: unknown key "minDistinctActor" (allowed: id, description, kind, maxAgeMinutes, minDistinctActors, onConflict)

usage: evidence-gate --policy <file> --evidence <file|dir>... --revision <id>
                     [--waivers <file>] [--now <iso-instant>] [--format text|json]
                     [--clock-skew-seconds <n>]

exit codes: 0 GO, 1 NO_GO, 2 UNDETERMINED, 3 invalid input, 4 internal error
Exit code 3. Recorded output, unedited.The policy misspells minDistinctActors. Ignoring the unknown key would have silently removed the two-reviewer rule; the gate rejects the input instead, and invalid input is never mistaken for a verdict.

Reproduce it

git clone https://github.com/Donovanfitch-dev/evidence-gate.git && cd evidence-gate
git checkout e26ad95
npm ci && npm run build
node dist/cli.js --policy examples/policy.json --evidence examples/evidence/undetermined.json --revision 4be1c02 --now 2026-03-02T12:00:00Z

Failure modes and limitations

  • Evidence is trusted as supplied.Nothing authenticates a record's source or actor, so in real use the files must come from a path the pipeline controls. Signed or attested evidence is conceptual only.
  • The decision step only.There are no collectors that produce evidence from a CI system or deploy platform, and acting on the exit code is the pipeline's job.
  • No history.There is no persistent evidence store or record of past verdicts.

Testing and validation

On 2026-11-10, against commit e26ad95: lint and type check exited cleanly, Vitest reported 76 passed across the logic, evaluation, validation and CLI suites, and the build succeeded. The recordings on this page were produced by the built CLI, and each exited with the code its verdict defines. The repository's GitHub Actions workflow concluded success on the same commit.

  • Evaluation.Tests pin the behavior that a two-valued gate gets wrong: no evidence at all is UNDETERMINED rather than NO_GO, evidence about a different revision is not accepted, an expired failure does not block, the result does not depend on the order evidence arrives in, and the same actor is never counted twice.
  • Strictness.CLI tests assert exit 3, not 0, when a policy key is misspelled, and exit 3 for a --now with no UTC offset, so a verdict cannot depend on the local timezone.

Source and documentation