Skip to content

ci-gate: fold the tamper guard into CI/gate; retire the template header - #190

Open
hyperpolymath wants to merge 2 commits into
mainfrom
claude/ci-gate-fold-guard
Open

hyperpolymath wants to merge 2 commits into
mainfrom
claude/ci-gate-fold-guard

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Why

Owner rulings of 2026-11-30: the tamper guard becomes part of the CI/gate verdict (so no ruleset change is ever needed for it), and the long prose header of templates/ci-gate-caller.yml is retired in favour of docs/CI-GATE.adoc.

What

  • scripts/ci-gate-tamper-status.sh now RETURNS a verdict (ok / unapproved + paths / error) through a result file and posts nothing. The guard writes its own result file with jq, so an API-supplied file name cannot forge the description.
  • scripts/ci-gate-publish.sh combines it: an unapproved gate-file PR at the head, or any guard error, turns success/pending into failure (gate files changed without owner approval: <paths>, clipped to 140). No CI/gate-tamper-guard status is posted any more.
  • PR discovery as in ci-gate: run the tamper guard from the gate, not from pull_request_target #163: the publisher lists open PRs itself (all pages, forks included) through the REST layer; a failed or malformed listing is a failure. The sweep hands over its own listing, and hands nothing when that failed.
  • gate-pr judges its own PR too (PR_NUMBER augments the listing), so its success cannot overwrite the default branch's failure.
  • Protected set: ci-gate: run the tamper guard from the gate, not from pull_request_target #163 did NOT protect the workflows named in a repository's profile, so a PR could rewrite a producer workflow into a no-op job of the same name. Every profile workflow is now a gate file. A changed file name with a newline is refused.
  • Template: header cut to a pointer; permissions: {} + four grants per job; gate-pr excludes dependabot[bot]; a non-default-ref workflow_dispatch does nothing; # zizmor: ignore[dangerous-triggers] with its reason. Mirrored in the suite's own caller. The rules the header held, and the lock note (empty file-level [] entry, never de-onboarded), moved to docs/CI-GATE.adoc.

Limits

The gate-pr path is PR-controlled: a malicious same-repo PR can edit it and post any status. This is the same residual hole as before; only the A3 signed estate-gate closes it. docs/CI-GATE.adoc says so.

Tests

tests/ci-gate.sh 746, tests/ci-gate-tamper-guard.sh 192, tests/ci-gate-api.sh 96, tests/ci-gate-caller.sh 200, tests/ci-gate-api-budget.sh after <= before in every scenario. jq 1.7 only (1.6, 1.7.1, 1.8.1 not fetched). Go yq v4.44.3, actionlint 1.7.7 (only the four known job.workflow_* false positives on ci-gate.yml).


Generated by Claude Code

The tamper guard's result is now part of the CI/gate verdict. The separate
CI/gate-tamper-guard context (added by #163) is no longer published, so no
ruleset step exists for the guard.

- ci-gate-tamper-status.sh returns a verdict (ok / unapproved + paths /
  error) to the publisher through a result file; it posts nothing. The
  guard (ci-gate-tamper-guard.sh) writes its own result file with jq, so an
  API-supplied file name cannot forge the description.
- ci-gate-publish.sh combines it: an unapproved gate-file pull request at
  the head, or any guard error, turns success or pending into failure
  ("gate files changed without owner approval: <paths>", clipped to 140).
- gate-pr judges its own pull request too (PR_NUMBER augments the
  listing), so its success cannot overwrite the default branch's failure.
- The sweep hands the publisher the pull requests of each head instead of
  running a second publisher.
- Every workflow a repository's profile names is now a gate file (#163 left
  them out). A file name containing a newline is refused (fail closed).
- Template: header retired to a pointer at docs/CI-GATE.adoc; permissions
  {} with the four grants per job; gate-pr excludes dependabot[bot]; a
  workflow_dispatch from a non-default ref does nothing; zizmor ignore on
  workflow_run. Mirrored in the suite's own caller. The rules the header
  held, and the lock entry note (empty file-level [] entry, never
  de-onboarded), move to docs/CI-GATE.adoc.
- Tests: new cases (each failing on main), a caller-shape check, and the
  API budget compares main's publisher plus its tamper step with this
  publisher.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiMyCm8ZsXCiC5UeBH
@gitnotebooks

gitnotebooks Bot commented Nov 30, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 50581532-7dd8-459c-88fa-56fe9cda802a
Commits

Reviewing files that changed from the base of the PR and between 47616cb and 4cd6f93.

Files selected for processing: 11

  • .github/workflows/ci-gate-caller.yml
  • .github/workflows/ci-gate.yml
  • docs/CI-GATE.adoc
  • scripts/ci-gate-publish.sh
  • scripts/ci-gate-sweep.sh
  • scripts/ci-gate-tamper-guard.sh
  • scripts/ci-gate-tamper-status.sh
  • templates/ci-gate-caller.yml
  • tests/ci-gate-api-budget.sh
  • tests/ci-gate-tamper-guard.sh
  • tests/ci-gate.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

… are failure

Agrees the job-level grants with the unavailable-pending branch. The REST layer
separates a rate limit from other failures but not an outage from a malformed
answer, so every guard error other than a rate limit stays failure (fail closed).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDiMyCm8ZsXCiC5UeBH

Copy link
Copy Markdown
Owner Author

CI/gate-tamper-guard = failure here is expected, not a defect of this PR. The guard still running on main (the old separate-context version) is correctly reporting that this PR touches gate files and the owner has not applied gate-change-approved. Only the owner may apply that label, and agents must not. After this PR merges the guard is part of CI/gate and that context is no longer posted.


Generated by Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-30T16:37:32.648367Z
We couldn’t complete this review. Comment @codex review to try again.
4cd6f93 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

hyperpolymath added a commit that referenced this pull request Nov 30, 2026
## 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>
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.

2 participants