Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Verification suites beyond the Turborepo pipeline: the standalone security
# suite and evaluation harness (with its negative control), plus the
# verification-gate validator tests. PRs that touch security/, evaluation/, or
# packages/domain run these on every push; the merge gate itself additionally
# demands green checks on the exact head SHA (verification/README.md).
name: Verification

on:
pull_request:
branches: [master]
push:
branches: [master]

concurrency:
group: verification-${{ github.ref }}
cancel-in-progress: true

jobs:
suites:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14

- name: Security suite (17 fail-closed access cases)
run: bun test ./security

- name: Evaluation harness (corpus vs worked example)
working-directory: evaluation
run: bun src/run.ts

- name: Evaluation negative control (broken adapter must fail)
working-directory: evaluation
run: bun src/run.ts --adapter=./src/example/broken-adapter.ts --expect-failure

- name: Verification-gate validator tests (positive + negative controls)
working-directory: verification
run: bun test ./test
18 changes: 17 additions & 1 deletion .obvious/obvious.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,23 @@ bun src/run.ts --adapter=./src/example/broken-adapter.ts --expect-failure # ne
The security suite and evaluation harness are standalone (`security/` and
`evaluation/` are not pnpm workspace members), so CI's `pnpm turbo run test`
does not cover them — run them locally whenever you touch `security/`,
`evaluation/`, or the domain contracts.
`evaluation/`, or the domain contracts. `.github/workflows/verification.yml`
runs both suites (plus the evaluation negative control and the
verification-gate validator tests) on every PR and push to `master`.

## Verification gate (executable merge workflow)

The review → repair → merge workflow below is executable in
`verification/` (see `verification/README.md`). PRs record a
`verification-manifest:v1` block (body or comment — review result, check and
suite runs, behavior/playable-flow evidence, all on the exact tested HEAD).
`bun verification/src/cli.ts validate-pr --pr=<n>` validates the latest
manifest against live PR state; the merge owner runs
`sweep --pr=<n> --owner=<name>` which refuses unless the PR is open on
master, checks are green on the exact head SHA, and the manifest validates,
then merges `--squash` and emits the evidence receipt. Arena candidate
branches are held regardless of evidence. The validator is pinned by
positive + negative controls (`cd verification && bun test ./test`).

## CI

Expand Down
93 changes: 93 additions & 0 deletions verification/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Verification Gate

Executes the repo's review → repair → merge contract (`.obvious/obvious.md`)
as an inspectable tool instead of prose. Zero dependencies, runs under Bun.

**Load-bearing assumption:** a PR-comment manifest plus live GitHub reads can
carry the contract's merge decision without inventing approvals. The gate
validates only what is recorded and observed; it can detect contradiction, not
verify intent — a fabricated-but-self-consistent manifest passes. What keeps
that honest: every field must carry a URL, the sweep re-observes live state
(checks on the exact head SHA, live diff paths), and the evidence receipt
records everything for post-hoc review. If a receipt is ever found to
misstate reality, the manifest's `reviewer`/`url` fields name who claimed it.

## Manifest format

Recorded on the PR (body or any comment; the **latest** block across
body + comments wins, and a later malformed block fails loudly rather than
falling back):

````html
<!-- verification-manifest:v1 -->
```json
{
"manifestVersion": 1,
"pr": 13,
"prUrl": "https://github.com/OCPdev25/obv-hackaton/pull/13",
"testedHeadSha": "<40-hex HEAD under review>",
"classification": "ui | backend-only | docs-only",
"classificationJustification": "required for backend-only / docs-only",
"review": { "result": "pass|pass-with-notes", "reviewer": "...",
"reviewedHeadSha": "...", "date": "YYYY-MM-DD", "url": "..." },
"checks": [{ "name": "...", "status": "green", "headSha": "...", "url": "..." }],
"evidence": [
{ "kind": "behavior-run | test-run | suite-run | playable-flow",
"name": "...", "headSha": "...", "result": "pass", "url": "..." }
],
"suites": {
"security": { "ran": true, "result": "pass", "headSha": "...", "url": "..." },
"evaluation": { "ran": true, "result": "pass", "headSha": "...",
"negativeControl": "fail-as-expected", "url": "..." }
},
"notes": "optional"
}
```
````

## What the validator enforces (each pinned by a test)

| Code | Meaning |
| --- | --- |
| `invalid_manifest` | structure: version, SHA shapes, evidence item shape |
| `pr_mismatch` | manifest points at a different PR than the one validated |
| `arena_hold` | branch is `arena/candidate-*` — excluded from auto-merge (rule 8) |
| `stale_head_sha` | `testedHeadSha` ≠ live PR head (rule 5: results don't carry over) |
| `mismatched_sha` | review/check/evidence/suite recorded against a different commit |
| `missing_review` / `review_not_passing` / `invalid_review_fields` | rule 2–3 review record |
| `missing_checks` | no named green CI check recorded (rule 4) |
| `missing_evidence` / `evidence_result_not_passing` | failing/absent behavior evidence |
| `no_playable_flow` / `invalid_playable_flow` | UI PRs need scenario + assertions + environment |
| `native_claim_unsupported` | on-device/simulator/TestFlight claims need playable-flow evidence |
| `classification_mismatch` | claimed classification contradicts the live diff paths |
| `classification_justification_required` | backend-only/docs-only need a justification |
| `suite_not_recorded` / `suite_not_passing` / `suite_negative_control_missing` | security + evaluation runs on the tested HEAD |

Suite applicability is derived from the **live diff**: any change under
`apps/`, `backend/`, `packages/`, `security/`, or `evaluation/` requires both
suites; docs-only changes require neither.

## CLI

```bash
bun verification/src/cli.ts validate-pr --pr=<n> # CI-safe advisory
bun verification/src/cli.ts validate-pr --pr=<n> --require # strict (merge owner)
bun verification/src/cli.ts check --file=f.json --pr=<n> --head=<sha> --branch=<b> --paths=a,b
bun verification/src/cli.ts sweep --pr=<n> --owner=<name> [--dry-run] [--smoke] [--post-receipt]
```

The **sweep** is the serialized merge owner's gate, in order: open PR on
master, not draft → not an arena candidate → live checks green on the exact
head SHA → latest manifest parses → validator merge → `gh pr merge --squash`
→ receipt. `--smoke` re-runs the full local verification table on the merge
commit from a temp worktree. Exit codes: 0 merge/would-merge, 1 refuse/hold,
2 environment error.

Factual limits: checks/comments are read from a single page (~100); check-run
pagination would be needed past that. The sweep trusts `gh` auth entirely.

## Tests

```bash
cd verification && bun test ./test # 2 positive controls + 9 negative controls + extraction tests
```
48 changes: 48 additions & 0 deletions verification/fixtures/nc1-stale-sha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"manifestVersion": 1,
"pr": 99,
"prUrl": "https://github.com/OCPdev25/obv-hackaton/pull/99",
"testedHeadSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"classification": "backend-only",
"classificationJustification": "touches backend/convex and packages/domain only — no UI surface",
"review": {
"result": "pass",
"reviewer": "sibling-qa-worker (independent of the PR author)",
"reviewedHeadSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"date": "2026-09-17",
"url": "https://github.com/OCPdev25/obv-hackaton/pull/99#review"
},
"checks": [
{
"name": "CI / Typecheck, test, build",
"status": "green",
"headSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999001"
}
],
"evidence": [
{
"kind": "behavior-run",
"name": "convex entries adapter round-trip behavior against synthetic family data",
"headSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"result": "pass",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999002"
}
],
"suites": {
"security": {
"ran": true,
"result": "pass",
"headSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999003"
},
"evaluation": {
"ran": true,
"result": "pass",
"headSha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"negativeControl": "fail-as-expected",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999004"
}
},
"notes": "fixture: NEGATIVE CONTROL nc1 — testedHeadSha is an older commit; internal SHAs are internally consistent, so the ONLY refusal must be stale_head_sha"
}
48 changes: 48 additions & 0 deletions verification/fixtures/nc1b-mismatched-sha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"manifestVersion": 1,
"pr": 99,
"prUrl": "https://github.com/OCPdev25/obv-hackaton/pull/99",
"testedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"classification": "backend-only",
"classificationJustification": "touches backend/convex and packages/domain only — no UI surface",
"review": {
"result": "pass",
"reviewer": "sibling-qa-worker (independent of the PR author)",
"reviewedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date": "2026-09-17",
"url": "https://github.com/OCPdev25/obv-hackaton/pull/99#review"
},
"checks": [
{
"name": "CI / Typecheck, test, build",
"status": "green",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999001"
}
],
"evidence": [
{
"kind": "behavior-run",
"name": "convex entries adapter round-trip behavior — recorded against an EARLIER commit than testedHeadSha",
"headSha": "cccccccccccccccccccccccccccccccccccccccc",
"result": "pass",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999002"
}
],
"suites": {
"security": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999003"
},
"evaluation": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"negativeControl": "fail-as-expected",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999004"
}
},
"notes": "fixture: NEGATIVE CONTROL nc1b — evidence recorded against a different commit than testedHeadSha; ONLY refusal must be mismatched_sha"
}
40 changes: 40 additions & 0 deletions verification/fixtures/nc2-missing-evidence.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"manifestVersion": 1,
"pr": 99,
"prUrl": "https://github.com/OCPdev25/obv-hackaton/pull/99",
"testedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"classification": "backend-only",
"classificationJustification": "touches backend/convex and packages/domain only — no UI surface",
"review": {
"result": "pass",
"reviewer": "sibling-qa-worker (independent of the PR author)",
"reviewedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date": "2026-09-17",
"url": "https://github.com/OCPdev25/obv-hackaton/pull/99#review"
},
"checks": [
{
"name": "CI / Typecheck, test, build",
"status": "green",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999001"
}
],
"evidence": [],
"suites": {
"security": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999003"
},
"evaluation": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"negativeControl": "fail-as-expected",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999004"
}
},
"notes": "fixture: NEGATIVE CONTROL nc2 — no evidence items; refusal must be missing_evidence (no review or SHA noise)"
}
47 changes: 47 additions & 0 deletions verification/fixtures/nc3-invalid-playable-flow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"manifestVersion": 1,
"pr": 98,
"prUrl": "https://github.com/OCPdev25/obv-hackaton/pull/98",
"testedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"classification": "ui",
"review": {
"result": "pass",
"reviewer": "sibling-qa-worker (independent of the PR author)",
"reviewedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date": "2026-09-17",
"url": "https://github.com/OCPdev25/obv-hackaton/pull/98#review"
},
"checks": [
{
"name": "CI / Typecheck, test, build",
"status": "green",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/998001"
}
],
"evidence": [
{
"kind": "playable-flow",
"name": "capture flow walkthrough",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"result": "pass",
"url": "https://github.com/OCPdev25/obv-hackaton/pull/98#walkthrough"
}
],
"suites": {
"security": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/998003"
},
"evaluation": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"negativeControl": "fail-as-expected",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/998004"
}
},
"notes": "fixture: NEGATIVE CONTROL nc3 — playable-flow item without scenario/assertions/environment; ONLY refusal must be invalid_playable_flow"
}
48 changes: 48 additions & 0 deletions verification/fixtures/nc4-native-claim.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"manifestVersion": 1,
"pr": 99,
"prUrl": "https://github.com/OCPdev25/obv-hackaton/pull/99",
"testedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"classification": "backend-only",
"classificationJustification": "verified on-device with the native build on TestFlight — no simulator needed",
"review": {
"result": "pass",
"reviewer": "sibling-qa-worker (independent of the PR author)",
"reviewedHeadSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date": "2026-09-17",
"url": "https://github.com/OCPdev25/obv-hackaton/pull/99#review"
},
"checks": [
{
"name": "CI / Typecheck, test, build",
"status": "green",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999001"
}
],
"evidence": [
{
"kind": "behavior-run",
"name": "convex entries adapter round-trip behavior against synthetic family data",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"result": "pass",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999002"
}
],
"suites": {
"security": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999003"
},
"evaluation": {
"ran": true,
"result": "pass",
"headSha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"negativeControl": "fail-as-expected",
"url": "https://github.com/OCPdev25/obv-hackaton/actions/runs/999004"
}
},
"notes": "fixture: NEGATIVE CONTROL nc4 — claims native/device verification without playable-flow evidence; ONLY refusal must be native_claim_unsupported"
}
Loading
Loading