Repository navigation
fix(ci-gate): unavailable API is pending, never failure; check-run join; re-run start; sweep outage stop - #191
Conversation
…in; re-run start; sweep outage stop Ports the behaviour of the closed #148 onto main's single REST layer (scripts/ci-gate-api.sh); no second library. 1. Unavailable is not failure. api_request/api_list return 2 for an unavailable answer (429 or a rate-limit 403 past the attempts or the budget, a 5xx, no answer, a truncated transfer) and 1 for a real error. The publisher writes pending ("GitHub API rate-limited or unavailable; re-evaluating later") and exits 75 instead of "could not read the jobs of run N" = failure (run 46407496788, 2026-11-30). If the pending cannot be written either it says "pending not confirmed" or "pending refused" and still writes no failure. The workflow's failure fallback stays silent after unavailable=true (publisher or early step). A permissions 403, a 404, a malformed body and a missing total_count still fail closed. 2. Snapshot by the two-read join: one paginated commits/{sha}/check-runs?filter=latest joined to the runs on check_suite.id == check_suite_id (profiles/ci-gate/join-checks.jq) replaces one jobs read per run (22 workflows: 24 -> 4 billed reads). A snapshot with total_count above the items read, 1000 or more runs, or check runs of 1000 or more suites is incomplete: pending, never a missing-check verdict. checks: read added to the reusable, both callers and the template. 3. Re-run start: the caller job admits workflow_run in_progress only for run_attempt > 1; an admitted in_progress writes ONE deduplicated pending ("a required workflow is re-running; re-evaluating on completion") and evaluates nothing (no list, no check-run read). completed is unchanged. 4. The sweep reads the default branch, its head and the pull request list through the REST layer and stops at once on an unavailable read or a publisher exit 75: it stays red, names the heads not evaluated, and says "pending not confirmed" unless the pending was written or GitHub rejected it. Tests: tests/ci-gate.sh, tests/ci-gate-api.sh, tests/ci-gate-api-budget.sh (census), fake gh with check-runs, 5xx, no-answer and listing endpoints. The mutation helpers of the three ci-gate test files now use perl, not python (estate language policy). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J4QvDixLBHyVxqpp8crrsi
|
Review these changes at https://app.gitnotebooks.com/hyperpolymath/proven-cicd-and-workflows/pull/191 |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 10 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
|
Generated by Claude Code |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
## What S1 of the W49 CI programme (design: #189, section 6.1): a read-only evidence extractor. - `scripts/pr-evidence.sh OWNER/REPO PR` writes one replayable evidence record (`proven/pr-evidence/v1`) for a pull request: head, base-tip, merge-base and nearest-completed-base observations per required context, workflow runs (including zero-job and `startup_failure`), masked failure signatures (strong or weak), mergeability, reviews, ruleset and profile required set, superseded inputs. It derives no verdict. - `docs/design/pr-verdict/evidence.schema.json` and `scripts/json-schema-lite.jq` (schema validator for the subset used; no Python, no new dependency). - `tests/pr-evidence.sh` (added to `tests/unit.list`): fake-`gh` controls. ## Evidence | Check | Result | |---|---| | `bash tests/pr-evidence.sh` | 27 groups ok | | `bash tests/unit.sh` | 27 tests run, 0 failed | | `bash tests/smoke.sh` | passed | | `bash tests/inspect-pr-ci.sh` | ok (unchanged) | | Live: extractor on open PRs #188, #189, #190, #191 of this repository | rc 0, all four schema-valid, 0 violations | | Live: #188 | `mergeable_state: blocked`, `changes_requested: true`, all 12 required contexts Pass (matches the NEEDS-REVIEW reading in #189) | | Live: #190, #191 | touch gate files (7 each, reported in `touches_gate_files`); one required context Pending | | `shellcheck` | NOT RUN (not installable in this session) | | Live validation on 3 other fixture repos | NOT RUN: `add_repo` was refused for cicd-squabbler and proven-tests-and-benches; reported to the hub | ## Findings for the design owner 1. **Strong signature is ambiguous in 3.2.** "a non-empty annotation message" counts `Process completed with exit code 1.`, which every failed step emits, so any two red checks would have "equal strong signatures" and be treated as inherited (breaks property 3 / 3.8). Implemented: boilerplate (`exit code N`, `The operation was canceled`) is never an identity. Please confirm. 2. **Review-thread resolution needs GraphQL.** Unavailable from agent sessions; recorded as `null` plus the reason, never as zero. The verdict's NEEDS-REVIEW arm on unresolved threads cannot fire from such a record. 3. **Producer map (Appendix A step 9) is not computed by the extractor**; `--producers FILE` accepts it, and profile entries give a producer workflow for their own contexts. Without it `Phantom` and `TriggerGap` are not derivable from the record. Follow-up work package. ## Not in this PR S2 fixtures follow as a separate PR. No gate file, ruleset or workflow is touched. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01J4QvDjgxz1iRFdu63KxE1K **Update:** signature strength now follows 7208a2e (complete failing-test set: reported count n > 0 and exactly n identities; annotations alone weak); `failed_count` and `pull.owner_acts` added to the schema; tests 28 groups ok. Finding 1 above is superseded by that revision. --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>



Ports the four parts of the closed #148 that
mainstill lacked, ontomain's own REST layer (scripts/ci-gate-api.sh, from #169). There is no second library. The owner chose this route on 2026-11-30.Why
On 2026-11-30 a scheduled sweep from
main(run 46407496788, gate at47616cb) postedCI / gate= failure, "ci-gate: could not read the jobs of run 45935619420", on a commit whose required checks had all passed. A read thatmaingave up on went todie()and wrote failure. That is the false red from hyperpolymath/resource-algebra#50.Change
api_requestandapi_listreturn 0 (ok), 1 (real error) or 2 (unavailable).unavailable()posts pending ("GitHub API rate-limited or unavailable; re-evaluating later"), writesunavailable=trueand exits 75. The workflow's failure fallback skips when either step reports unavailable.total_count.check-runs?filter=latestread, joined to the runs on the check suite (newprofiles/ci-gate/join-checks.jq), replaces the per-run jobs reads. Third-party suites match nothing.total_countexceeds the items read, if there are 1000 or more runs, or if the check runs span 1000 or more distinct suites.checks: readis added to the reusable, both callers and the template.types: [completed, in_progress]and ci-gate: spend fewer API calls per evaluation #179's explicit workflow list. The jobif:admitsin_progressonly whenrun_attempt > 1.completedevaluates in full.Census: billed REST requests per gate job (
tests/ci-gate-api-budget.sh)main47616cbTests
Run locally on 605103c with Go yq v4.44.3:
tests/ci-gate.shtests/ci-gate-api.shtests/ci-gate-tamper-guard.shtests/ci-gate-caller.shci-gate.yml, the suite caller and the template.python3. They are now Perl, so no Python runs in validation.Behaviour changes and limits
A 5xx or no answer is not retried. It gives pending and exit 75 at once, where
mainwrote an immediate false failure.A first-attempt
in_progressno longer writes pending, so a standing success on that commit stays untilcompletedevaluates.Not verified live:
run_attemptis set onworkflow_runevents;in_progressis delivered for re-runs;check_suite.idmatches the run'scheck_suite_id.After merge, re-run one required workflow and check that
CI / gateturns pending at the re-run's start.This PR overlaps
claude/ci-gate-fold-guard(folding the tamper guard into the verdict). It was agreed that whichever merges second mergesmainand resolves the conflicts, and that neither pushes to the other's branch.Consumer re-pins wait for both PRs and are regenerated with feat(ci-gate): caller render and drift-check script #167's tool.
Generated by Claude Code