Skip to content

feat: F2/F10 evidence parser + warning-only pr-policy wiring#19

Merged
ArchonVII merged 7 commits into
mainfrom
agent/claude/f2-f10-evidence-parser
May 20, 2026
Merged

feat: F2/F10 evidence parser + warning-only pr-policy wiring#19
ArchonVII merged 7 commits into
mainfrom
agent/claude/f2-f10-evidence-parser

Conversation

@ArchonVII

@ArchonVII ArchonVII commented May 20, 2026

Copy link
Copy Markdown
Owner

Closes #10
Closes #12

Repo-contract change: This PR introduces a minimal Node test harness (package.json, package-lock.json, .gitignore) to github-workflows solely for the F2/F10 evidence parser. Vitest is the only devDep. No build tooling, lint tooling, TypeScript, or Dependabot config is added.

Summary

Phase 1 of the F2 + F10 evidence-enforcement amendment (2026-05-19): adds a
pure ES-module parser for fenced ```evidence``` blocks under checked
verification items, wires it into pr-policy.yml in warning-only mode, and
adds a self-test CI workflow that runs the parser's vitest suite on PRs
touching scripts/**.

The amendment supersedes the earlier compact-one-liner / repo allow-list /
24h-window shape. This PR implements the amendment shape only.

What's in scope

  • scripts/parse-evidence.mjs — pure parser (no SDK imports). Caller injects
    PR body, head commit time, "now", and check-runs via the function signature.
  • scripts/parse-evidence.test.mjs — 16 vitest cases covering happy paths,
    structural errors, command validation (local-token list + ci check-run
    lookup), timestamp policy (future guard, post-head requirement, ci drift
    warning, invalid ISO), plus a grep-evidence regression case.
  • .github/workflows/pr-policy.yml — adds enforce-evidence input
    (defaults to false) and a workflow-library-ref input (defaults to
    v1) that pins the parser-source checkout to the same ref callers pin
    this reusable workflow to. Adds an evidence-check step that runs after
    the existing checks. Skips drafts and doc-only PRs. Writes errors and
    warnings to $GITHUB_STEP_SUMMARY. Only calls core.setFailed when
    enforce-evidence is true.
  • .github/workflows/self-test.yml — Node 20 vitest run on scripts/**
    changes.
  • Minimal root package.json with vitest as the sole devDep.

What's NOT in scope (per task constraints)

  • No PR-path detection for Owner Maintenance Lane. Phase 1 OM is
    direct-commit-only and never produces a PR; the exemption lives upstream.
    A comment in pr-policy.yml documents this so future-me doesn't add it.
  • No flip of enforce-evidence to true anywhere.
  • No PR-template, .agent/verification-commands.yml, or
    hook-authority.md changes — those are separate PRs in other repos.

Verification

Verification Notes

  • Parser unit tests pass locally (vitest)
command: npx vitest run
location: local
result: pass: 16/16 tests
timestamp: 2026-05-20T13:30:00Z
  • Parser is pure (no SDK imports)
command: grep -nE "@actions/|@octokit/|require\(.github" scripts/parse-evidence.mjs
location: local
result: pass: no matches
timestamp: 2026-05-20T13:30:00Z
  • CI green on this branch (will check after push)

Dogfooding note

Since enforce-evidence defaults to false in Phase 1, any malformed
evidence in this PR will only surface as warnings in the job summary —
that's the point. Once the parser is live in Phase 2 we'll flip the
input for github-workflows's own PRs first.

ArchonVII added 7 commits May 20, 2026 08:22
Pure ES-module parser for fenced ```evidence``` blocks under checked
verification items. Implements the 2026-05-19 amendment shape:

- Per-block flat YAML (command/location/result/timestamp, optional check)
- location: ci|local|manual
- local: command must contain a recognised executable token
- ci: command (or check:) must match a successful check-run on head SHA
- timestamps: future guard >now+5min; local/manual must be >=head-5min
- ci timestamp drift >5min vs check-run completed_at is a warning

Parser has no SDK or network dependencies — the caller injects already-
fetched data via the function signature. Hand-rolled key:value parser
avoids adding a YAML dep.

Also adds a minimal repo-root package.json with vitest as the sole devDep
so the parser can be unit-tested in CI. Reported as a repo-contract change.

Refs #10
Refs #12
15 cases covering all amendment-2026-05-19 requirements:
happy paths (local/ci/manual), structural errors (missing block, double
block, malformed YAML, unknown location), command validation (no token,
missing check-run, failed check-run), and timestamp validation (future,
pre-head, ci drift warning, unchecked, invalid ISO).

Refs #10
Refs #12
Adds an `enforce-evidence` boolean input (default false for Phase 1) and a
new evidence-check step in the existing policy job that:

- skips on draft PRs (advisory) and doc-only PRs (existing detection)
- fetches check-runs for the PR head SHA via github.rest.checks.listForRef
- fetches the head commit time via github.rest.git.getCommit
- dynamic-imports scripts/parse-evidence.mjs from a sibling checkout of
  ArchonVII/github-workflows (so callers don't need the script vendored)
- writes errors and warnings into $GITHUB_STEP_SUMMARY
- only calls core.setFailed when enforce-evidence === true AND errors exist

A comment block above the step documents that Owner Maintenance Lane is
direct-commit-only in Phase 1 and intentionally has no PR-path exemption.

Refs #10
Refs #12
Triggers on PR / push-to-main when scripts/, package.json,
package-lock.json, or the workflow itself changes. Uses Node 20 with the
built-in npm cache, npm ci, then `npm test` which invokes vitest run.

Refs #10
Refs #12
Source: PR #19 review patch 1 (2026-05-20). Adds common shell utility
tokens so 'location: local' evidence rows that invoke grep/awk/sed/jq
parse cleanly under enforce mode.
Source: PR #19 review patch 1 (2026-05-20). Directly guards against
the dogfood regression where 'grep -nE ...' would hard-fail under
enforce mode. 16/16 passing.
Source: PR #19 review patch 2 (2026-05-20). Pins the
ArchonVII/github-workflows checkout that supplies parse-evidence.mjs
to the same ref the caller pins this reusable workflow to. Default v1
keeps parser+workflow versioned together; callers using @main or @sha
should pass workflow-library-ref to match.

Previously the checkout had no ref and defaulted to the default branch
(main), creating 'workflow from v1, parser from main' drift.
@ArchonVII
ArchonVII marked this pull request as ready for review May 20, 2026 18:36
@ArchonVII
ArchonVII merged commit d0a5fed into main May 20, 2026
1 check passed
@ArchonVII
ArchonVII deleted the agent/claude/f2-f10-evidence-parser branch May 20, 2026 18:39
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.

F10: Verification evidence format (command + location + result + timestamp) F2: pr-policy.yml accepts checkbox shape without evidence

1 participant