Skip to content

Cut the merge gate to what can run as a required CI check - #335

Merged
lamemustafa merged 28 commits into
masterfrom
tapish-codex/rectify-merge-gate-clean-20260913
Sep 15, 2026
Merged

lamemustafa merged 28 commits into
masterfrom
tapish-codex/rectify-merge-gate-clean-20260913

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Supersedes #321. Scope changed since this PR was opened: it originally hardened the merge-gate tooling; it now cuts it down and promotes the remainder into CI.

Why the change of direction

The tooling was 3,977 lines that gated nothing automaticallyscripts/merge-gate.sh does not exist on master, and master's ci.yml never referenced it. It was a manual CLI tool, so a bug in it produced a bad human judgement call rather than a failed build.

Meanwhile it had become the single largest source of work in the repository: 20 unresolved review threads on this PR and 27 open tracking issues, all against one script family representing under 5% of the codebase. Two of those issue pairs (#362/#380, #372/#376) were duplicate trackers filed for a single defect by successive review rounds of this same PR.

What was cut

removed why
PR/head/base identity binding, branch-protection contexts, checks rollup re-derived what branch protection already enforces
the final identity fence (re-validating all of the above a second time) duplicate of the above
PR-body / review-checklist / permalink / P4-template / platform-evidence validation validated that a document had the right shape
skipped-CI-job allowlist + rename-path semantics re-implemented GitHub's own path filtering — and was itself the #372/#376 defect
separate security-reviewer-comment validation ceremony
scripts/merge_gate_fake_gh.py (930 lines) API test double existing only to test the above

What is kept — and now actually gates

  1. Compatibility-surface validation — real, mechanical, and the pin-hygiene defect class ran 62% P1.
  2. The privacy/PII scan (merge_gate_privacy.py, merge_gate_diff.py) — the highest-severity class in the review corpus at 68% P1.
  3. A new minimal review-evidence check (~38 lines): a review must exist naming the current head SHA. This closes the failure recorded in Review debt on merged PRs, and the two structural causes behind it #317, where PRs merged 2–8 minutes after opening and "zero unresolved threads" was read as "reviewed clean" when it meant "the reviewer had not started". It treats absent review evidence as FAIL, never a silent pass, and handles the case where a clean review produces no review object at all — only a reaction and a summary comment.

Proposed CI wiring is in docs/proposed-merge-gate-ci.md (a separate merge-gate.yml, because the review-evidence check needs pull_request_review/issue_comment triggers and folding those into ci.yml would re-run the whole native matrix on every PR comment).

Size

file before after
merge-gate.sh 1587 552
merge-gate.test.py 931 400
merge_gate_fake_gh.py 930 deleted
merge_gate_privacy.py 321 359
merge_gate_diff.py 208 220
merge_gate_test_gh.py (new, smaller replacement double) 316
total 3,977 1,847

44 tests pass on the merged tree.

The 20 review threads

  • 9 are fixed by removal — the code carrying them is gone.
  • 11 were already fixed on this branch and had simply never been resolved. That was verified by reverting each fix in isolation, observing the covering test FAIL, restoring it, and observing PASS — not by reading the code. The fixes landed in d16416d4, 7a29762e, c033dd40, 57799cb0 and f41d6341.

No prior test exercised those 11 sub-cases, so 22 regression tests were added — one positive and one paired negative per finding. The negatives are deliberate: #328 was a PII pattern widened until it flagged ordinary date ranges, and a false positive in a required check is worse than the gap it closes.

Honest notes

  • The cut plan's original line ranges were wrong in two places and were corrected against the code: lines 83–160 are plumbing every kept feature depends on, and the privacy scan's input pipeline sits at 394–441, before the range it was assumed to occupy.
  • merge_gate_test_gh.py (316 lines) was added beyond the literal instruction to delete the test double — the kept tests still need an offline gh stand-in. Flagged rather than absorbed.
  • The Fail closed when privacy payload serialization fails #358 regression test forces a hard I/O failure (target path pre-occupied as a directory), not the partial write the issue literally describes. The fix handles both identically, but only the hard case is directly demonstrated.
  • The "PR is OPEN", "not draft" and "based on master" sanity guards were dropped with the identity-binding block. Moot under the proposed CI wiring, where event filters already scope to open non-draft PRs against master — but a human running the script by hand against an arbitrary PR gets less guidance than before.
  • A pre-existing false-positive risk was found in IDENTIFIER_RE (a PAN-shaped pattern can match ordinary prose) and deliberately not changed — unrelated to these findings, flagged rather than silently fixed.

Once this lands, 16 of the open merge-gate tracking issues describe code that genuinely no longer exists and become closeable; the rest were duplicates or already fixed.

🤖 Generated with Claude Code

Carry forward the reviewed implementation from PR #321. The original PR preserves its review and authorship record. Assemble synthetic grouped-number probes without embedding complete identifier-shaped literals in source.
@lamemustafa lamemustafa added the type:rectify Regression rectification label Sep 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-14T09:43:32.529668Z 92d151c New commits
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99623f78d4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge_gate_diff.py
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae12d1b92b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2023ab4b46

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5222cdde8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 91404d7f2f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fda1e2e9e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c73c64e1f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f958f22c3

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78a3931270

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh
Comment thread scripts/merge-gate.sh
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c033dd40ec

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge_gate_privacy.py
Comment thread scripts/merge_gate_privacy.py
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
@gitguardian

gitguardian Bot commented Sep 14, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Avoid static secret-like literals in the regression fixture so external secret scanning can evaluate the final PR range without suppressing the privacy-gate coverage.
@lamemustafa
lamemustafa force-pushed the tapish-codex/rectify-merge-gate-clean-20260913 branch from 60fc50c to 57799cb Compare September 14, 2026 07:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57799cb020

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge_gate_privacy.py Outdated
Comment thread scripts/merge_gate_privacy.py Outdated
Comment thread scripts/merge-gate.sh Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f41d6341a2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/merge_gate_privacy.py Outdated
Comment thread scripts/merge_gate_privacy.py Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
Comment thread scripts/merge-gate.sh Outdated
t and others added 4 commits September 14, 2026 14:50
The merge-gate tooling was 3977 lines that gated nothing automatically
(a manual CLI; master's ci.yml never invoked it). Review produced 20
unresolved threads and 27 tracking issues. Per the owner's decision,
keep only what can run as a real required CI check and delete the rest.

Kept:
- Compatibility-surface validation (read_surface_paths() and callers).
- Privacy/PII scan (merge_gate_privacy.py, merge_gate_diff.py in full,
  plus their input pipeline: commit author/committer metadata
  validation and the diff-coverage scan in merge-gate.sh).
- A new, minimal (38-line) check that a review exists naming the
  current head SHA, closing #317: PRs merged 2-8 minutes after
  opening, where "zero unresolved threads" meant "review had not
  started". Treats "no review evidence for this head" as FAIL.

Cut entirely:
- PR/head/base identity binding, branch-protection context
  derivation, and the checks rollup.
- PR body/review-checklist/P4/platform-evidence validation.
- Skipped-CI-job allowlist and security-reviewer-comment validation.
- scripts/merge_gate_fake_gh.py (a GitHub API test double that existed
  only to test the cut concerns).

merge-gate.sh: 1587 -> 552 lines. merge-gate.test.py shrunk to cover
only the kept surface, backed by a new, much smaller fake `gh`
(merge_gate_test_gh.py) replacing the deleted one.

Also fixes 7 verified live defects in the kept code (#346, #358, #360,
#365, #366, #373, #377), each with a regression test in
merge-gate.test.py verified to fail against the pre-fix code and pass
after.

docs/proposed-merge-gate-ci.md proposes the CI wiring to actually make
this a required check (a new workflow file, not touching .github/ per
this change's scope) and explains why the review-evidence check needs
pull_request_review/issue_comment triggers, not just push/synchronize.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…cy findings

Investigated all 11 unresolved review findings against the promoted-to-
required scripts/merge_gate_privacy.py. All 11 turned out to already be
fixed on fix/merge-gate-cut-336: each fix landed in an earlier commit
(d16416d, 7a29762, c033dd4, 57799cb, f41d634) that is an ancestor of
this branch's head, confirmed by direct behavioral testing against the
scanner plus git ancestry checks.

Add PrivacyScannerFindingsPR335, a direct-unit-test class against
merge_gate_privacy.scan(), with one positive + one negative test per
finding (22 tests total) so this behavior has explicit regression coverage
-- no prior test exercised these specific sub-cases. Each was verified to
fail when the specific historical defect described in its review thread is
reintroduced, and pass once reverted back out (see task report for the
per-finding before/after transcripts).

All fixtures use fabricated values (fake UUIDs, .test-domain emails,
placeholder credential strings, truncated non-decodable PEM bodies) --
no real PII or credentials.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Only the two compatibility manifests conflicted; pin sets were identical on
both sides (212 entries) and no merge-gate script is pinned, so master's
sealed manifest was taken and rehashed. rehash reported one changed entry
and a confirming pass reports zero.

The shrunk merge-gate suite runs green on the merged tree: 44 tests OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@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.

@lamemustafa lamemustafa changed the title Rectify incomplete merge preflight evidence Cut the merge gate to what can run as a required CI check Sep 15, 2026
@lamemustafa
lamemustafa merged commit 0f11118 into master Sep 15, 2026
13 checks passed
@lamemustafa
lamemustafa deleted the tapish-codex/rectify-merge-gate-clean-20260913 branch September 15, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:rectify Regression rectification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant