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
83 changes: 83 additions & 0 deletions .github/workflows/a0-evidence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Constellation A0 source-matched check evidence

# Evidence capture of four fixed VIA checks, not an AI-host orchestration run.
on:
pull_request:
paths:
- ".github/workflows/a0-evidence.yml"
- "scripts/a0_capture_checks.py"
- "docs/a0-copy-summary.md"
- "docs/a0-codex-runbook.md"
Comment on lines +6 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run evidence capture when reviewed sources change

After this workflow is merged, a PR that changes src/components/ExportButtons.tsx, src/i18n/shareSummary.ts, or their tests will not trigger this job because none of those paths are included here, even though the generated result identifies those files as the artifacts being verified. The ordinary CI workflow will still run, but it does not create the A0 receipts, so there will be no source-matched evidence for the revision that actually changes the reviewed feature; include the review scope in this filter or remove the filter.

Useful? React with 👍 / 👎.

workflow_dispatch:

permissions:
contents: read

jobs:
a0-check-evidence:
runs-on: ubuntu-latest
steps:
- name: Checkout VIA with Git provenance
uses: actions/checkout@v4
with:
path: via
persist-credentials: false
- name: Checkout pinned Polaris evidence validator
uses: actions/checkout@v4
with:
repository: pedrobritx/polaris
ref: ed10f82764685526ab69b66db7edab7a998fd0f9
path: polaris
persist-credentials: false
- name: Select Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Select Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: via/package-lock.json
- name: Install existing VIA dependencies (no extra services or credentials)
working-directory: via
run: npm ci
- name: Execute four approved VIA checks and audit local receipts
shell: bash
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/a0-evidence"
set +e
python3 via/scripts/a0_capture_checks.py \
--product-root "$GITHUB_WORKSPACE/via" \
--evidence-root "$RUNNER_TEMP/a0-evidence"
capture_exit=$?
set -e

# The validator checks local integrity, not agent execution.
python3 polaris/automation/a0.py check-result \
--result "$RUNNER_TEMP/a0-evidence/a0-result.json"
python3 polaris/automation/a0_evidence.py \
--result "$RUNNER_TEMP/a0-evidence/a0-result.json" \
--product-root "$GITHUB_WORKSPACE/via" \
--evidence-root "$RUNNER_TEMP/a0-evidence"

{
echo "### A0 — source-matched project check evidence"
echo "Four existing VIA project checks were executed directly in this GitHub Actions job."
echo "Each check produced a local receipt and SHA-256 digests of stdout/stderr."
echo "Polaris validated the reported schema and the check receipts against this clean Git checkout."
echo "**Not performed:** Codex agent orchestration, human accessibility review, privacy penetration testing, baseline experiment or acceptance."
echo "A0 execution/verification/approval statuses remain **partial / partial / pending**."
} >> "$GITHUB_STEP_SUMMARY"
exit "$capture_exit"
- name: Archive non-sensitive summary and receipts (no raw check logs)
uses: actions/upload-artifact@v4
if: always()
with:
name: a0-via-check-receipts
path: |
${{ runner.temp }}/a0-evidence/a0-result.json
${{ runner.temp }}/a0-evidence/receipts/*.json
if-no-files-found: warn
retention-days: 7
38 changes: 38 additions & 0 deletions docs/a0-evidence-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# A0 — Source-matched check evidence (CI-only, experimental)

**Status:** reviewable M1 evidence-capture slice, not A0 pilot acceptance.
**Source:** [Constellation A0 goal](https://github.com/pedrobritx/constellation/issues/2) · [Polaris evidence issue](https://github.com/pedrobritx/polaris/issues/16).
**Owner:** VIA project maintains its test commands and data boundaries; Polaris owns the reusable result/receipt validator.

## What this adds

`.github/workflows/a0-evidence.yml` checks out VIA and a **pinned, reviewed Polaris commit** with read-only token permissions and no persisted checkout credentials. It runs `npm ci`, then executes the exact four commands already mandated in VIA's `AGENTS.md`:

- `npm run test`
- `npm run typecheck`
- `npm run lint`
- `npm run build`

The limited `scripts/a0_capture_checks.py` does not accept arbitrary commands, dynamically choose test suites, download external model instructions, or invoke agents. It captures actual subprocess exit codes and stdout/stderr into **runner-temporary local files**. Receipt JSON files record the checked-out Git commit SHA, command, exit code and SHA-256 hashes of both logs. Logs over 10 MiB are rejected.

After execution, Polaris's `automation/a0.py check-result` validates **reported** execution/verification/approval states, while `automation/a0_evidence.py` confirms local receipt consistency, a clean VIA source revision, and that the referenced log bytes match recorded hashes. The workflow is failed if any of the four commands fails or if evidence validation fails.

A short-lived artifact uploads **only JSON receipt metadata**, never raw stdout/stderr logs. Raw logs remain runner-local and are deleted after execution. This avoids a new publicly downloadable copy of potentially sensitive test logs, but limits later independent replay of the hash checks. The GitHub Actions job itself gives an independently hosted record that the validation steps ran, subject to GitHub's workflow and retention policies.

## Explicitly incomplete

This workflow **does not** run Codex or verify that Codex authored VIA's existing feature. It does not prove user-interface accessibility, real clipboard permissions, privacy against malicious downstream clipboard readers, independent security review, or improvement over a control. Its A0 result deliberately remains:

- `execution: partial`
- `verification: partial`
- `approval: pending`

Coverage gaps are explicit and may not be overridden simply because the four commands succeed. The evidence validator is not a security attestation: anyone with the ability to rewrite both logs and their receipts can forge internally consistent data.

## Privacy and authority

This workflow runs on public GitHub infrastructure; use synthetic test fixtures and do not put patient records, production secrets or personal files into CI. `npm ci` and tests run existing repository code without additional service keys. No production deployment, code merge, security-policy change or spending authorization is granted.

## Human acceptance still required

Before the VIA pilot can count as Constellation A0 G1–G6, a real host session must inspect Polaris/Axis/Meridian/Sentinel, route its task, produce actual source-matched work, undergo owner review, exercise clipboard and assistive technologies, and record the planned conventional-agent baseline comparison. This CI run is **narrow verification evidence**, not the end-to-end pilot.
131 changes: 131 additions & 0 deletions scripts/a0_capture_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/env python3
"""Capture fixed VIA CI checks for A0; not a Codex or autonomous agent runtime.

This pilot-only utility executes four hard-coded, already-required project
verification commands. It records exact Git HEAD, return codes and local
stdout/stderr SHA-256 receipts, without claiming independent UI assessment.
No command, argument or arbitrary shell snippet is taken from project input.
"""

import argparse
import hashlib
import json
import os
from pathlib import Path
import subprocess
import sys

COMMANDS = (
("test", ("npm", "run", "test")),
("typecheck", ("npm", "run", "typecheck")),
("lint", ("npm", "run", "lint")),
("build", ("npm", "run", "build")),
)
MAX_LOG_BYTES = 10 * 1024 * 1024


def git_revision(product_root: Path) -> str:
return subprocess.check_output(
["git", "-C", str(product_root), "rev-parse", "HEAD"],
text=True,
).strip()


def capture(product_root: Path, evidence_root: Path) -> bool:
"""Only run the four fixed VIA checks. Returns True if all checks pass."""
product_root = product_root.resolve()
evidence_root = evidence_root.resolve()
if evidence_root == product_root or evidence_root.is_relative_to(product_root):
raise ValueError("Evidence must be outside the adopter repository")
if product_root.name != "via":
raise ValueError("The pilot capture runner only supports the VIA checkout")
evidence_root.mkdir(parents=True, exist_ok=True)
(evidence_root / "receipts").mkdir(exist_ok=True)
(evidence_root / "logs").mkdir(exist_ok=True)
revision = git_revision(product_root)
checks = []
all_passed = True
for name, argv in COMMANDS:
try:
execution = subprocess.run(
argv, cwd=product_root, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, timeout=600, check=False,
)
stdout, stderr, exit_code = execution.stdout, execution.stderr, execution.returncode
except subprocess.TimeoutExpired as error:
stdout = error.stdout or b""
stderr = (error.stderr or b"") + b"\nA0 CHECK TIMEOUT after 600s\n"
exit_code = 124
if len(stdout) > MAX_LOG_BYTES or len(stderr) > MAX_LOG_BYTES:
raise ValueError(f"{name} generated excessive evidence output")
paths = {
"stdout": evidence_root / "logs" / (name + ".stdout.log"),
"stderr": evidence_root / "logs" / (name + ".stderr.log"),
}
paths["stdout"].write_bytes(stdout)
paths["stderr"].write_bytes(stderr)
receipt = {
"version": 1,
"request_id": "via-a0-copy-summary-review-001",
"project": "pedrobritx/via",
"source_revision": revision,
"command": " ".join(argv),
"exit_code": exit_code,
"stdout_path": str(paths["stdout"].relative_to(evidence_root)),
"stdout_sha256": hashlib.sha256(stdout).hexdigest(),
"stderr_path": str(paths["stderr"].relative_to(evidence_root)),
"stderr_sha256": hashlib.sha256(stderr).hexdigest(),
}
ref = f"receipts/{name}.json"
(evidence_root / ref).write_text(json.dumps(receipt, indent=2) + "\n")
checks.append({
"command": receipt["command"],
"exit_code": exit_code,
"source_revision": revision,
"evidence_ref": ref,
})
all_passed &= exit_code == 0
print(f"{name}: exit={exit_code}", flush=True)

result = {
"version": 1,
"request_id": "via-a0-copy-summary-review-001",
"project": "pedrobritx/via",
"source_revision": revision,
"execution": "partial",
"verification": "partial",
"approval": "pending",
"checks": checks,
"artifacts": ["src/components/ExportButtons.tsx", "src/i18n/shareSummary.ts"],
"documentation": ["docs/a0-copy-summary.md", "docs/a0-codex-runbook.md"],
"coverage_gaps": [
"No Codex/Polaris execution of initial implementation observed",
"Manual screen-reader/keyboard/clipboard-denial checks outstanding",
"No preregistered conventional-agent baseline comparison",
"No independent security or accessibility review",
],
"unresolved_findings": [],
}
(evidence_root / "a0-result.json").write_text(json.dumps(result, indent=2) + "\n")
return all_passed


def main(argv=None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--product-root", type=Path, required=True)
parser.add_argument("--evidence-root", type=Path, required=True)
args = parser.parse_args(argv)
try:
passed = capture(args.product_root, args.evidence_root)
except (OSError, subprocess.CalledProcessError, ValueError) as error:
print(f"A0 capture failed: {error}", file=sys.stderr)
return 1
if not passed:
print("One or more VIA checks failed (see local receipts).", file=sys.stderr)
return 1
print("All four VIA commands returned zero; human approval and A0 pilot remain pending.")
return 0


if __name__ == "__main__":
raise SystemExit(main())
Loading