Beth automatic review connection

Purpose
Run approved tests against an assigned build, preserve results in Beth and post a preliminary comment to its existing Infinity card. AI assesses reported text evidence only. Human decisions and independent sign-off are unchanged.

Setup
1. Coordinator: assign the three people, exact test-build URL/version and synthetic examples in Beth. The business reviewer starts and saves the review.
2. Coordinator: in Automatic checks and AI findings, enter the repository URL and full commit ID. Create a seven-day credential.
3. Developer: store BETH_REVIEW_RUNNER_TOKEN and BETH_REVIEW_RUN_ID as private secrets in a trusted build job. Never expose them to untrusted pull requests or test subprocesses.
4. Copy run-review-checks.mjs and beth-review-checks.json into the repository. The mapping is deliberately empty until approved.
5. Retrieve the contract using GET https://beth2.top/api/reviews/runs/{run-id}/automation/runner with Authorization: Bearer {private-token}. Its numbered check IDs and expectations are frozen for this review.
6. With the independent reviewer, map each executable test to the appropriate checkId. Each tests entry needs command (an argument array), checkId, and evidence (a protected CI-artifact URL for this exact build). Optional timeoutMs is capped at 300000. Test subprocesses receive only a small environment; explicitly list synthetic test credentials as BETH_TEST_* names in testEnvironment when needed.
7. A test writes exactly one JSON object to stdout: status (Passed, Failed or Not verified) and actual (a meaningful observed result). Diagnostics may go to stderr. Exit zero alone is insufficient. Do not put real client data, credentials or secrets in any result. The test must actually assert the stated acceptance requirement.
8. After staging deployment, from the approved checkout run: node run-review-checks.mjs --config beth-review-checks.json --report beth-review-result.json
9. For a safe upload retry, retain the local report and POST its identical content with the same requestKey to the runner endpoint. For a fresh execution, use a new requestKey; BETH_REVIEW_REQUEST_KEY can supply the trusted pipeline-run ID.
10. Reconnect for a new commit or handoff. Replacing or revoking the credential invalidates the old one; sealed reviews reject uploads.

Important
Unmapped checks stay Not verified. A stored evidence URL is a locator, not proof that the server or model has opened it. The model receives bounded, redacted text results; it does not run tests or inspect source/screenshots. Independent reviewers must inspect evidence and validate test coverage.

Local/offline check
Use --contract path/to/contract.json to run without uploading; the checkout must still match the contract commit. No task is changed in this mode.

Reference
https://beth2.top/integration#automatic-reviews
