Skip to content

chore(git): land the consolidated guard scripts - #68

Merged
saagpatel merged 1 commit into
mainfrom
codex/chore/land-guard-scripts
Aug 11, 2026
Merged

chore(git): land the consolidated guard scripts#68
saagpatel merged 1 commit into
mainfrom
codex/chore/land-guard-scripts

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

Lands the consolidated scripts/git guard scripts, plus the eight test suites
that come with them, onto this repository's default branch.

These files had drifted into as many as ten versions across the portfolio. The
correct behaviour turned out to live in the rarest variant rather than in the
canonical copy, every time, so canonical was fixed first and this is the result
being propagated.

What changes behaviourally:

  • guard-no-main-push reads the pre-push payload, so pushing the default branch
    from a feature branch is refused rather than silently allowed
  • guard-large-files measures the staged blob, not the working tree, so a file
    staged large and shrunk afterwards no longer slips through
  • guard-generated no longer refuses the removal of build output committed by
    mistake, which was the one action its own message asked for
  • guard-branch accepts <type>/<slug>, codex/<type>/<slug> and peer-agent
    names, and exempts dependabot and release-please branches
  • guard-atomic gains GIT_GUARD_ALLOW_LARGE_COMMIT=1 for a deliberate exception
  • guard-secrets keys its CI skip on CI being "true" rather than merely set,
    which closes three unintended bypasses
  • create-branch validates the type, bounds the slug, and resumes an existing
    branch instead of failing
  • propose-commit-message takes its scope from the staged paths

Why this is a new branch. The same commit was already applied a first time,
but onto whatever feature branch each repository happened to have checked out.
In eleven repositories that branch's pull request had merged weeks earlier, so
the commit landed on top of a closed pull request and could never reach the
default branch through it. It has been cherry-picked here onto a branch that
starts from the current default branch. The original commits were left where
they are; nothing was rewritten or force-pushed.

Verified: all eight guard suites pass in this repository, run against this
branch.

sovereign is canonical for scripts/git. These files had drifted into as many as
ten versions across the portfolio, and the correct behaviour was usually held by
the rarest one rather than by canonical, so canonical was fixed first and this
is the result being propagated.

What changes behaviourally:
  guard-no-main-push reads the pre-push payload, so pushing main from a
    feature branch is refused rather than silently allowed
  guard-large-files measures the staged blob, not the working tree, so a file
    staged large and shrunk afterwards no longer slips through
  guard-generated no longer refuses the removal of build output committed by
    mistake, which was the one action its own message asked for
  guard-branch accepts <type>/<slug>, codex/<type>/<slug> and peer-agent names,
    and exempts dependabot and release-please branches
  guard-atomic gains GIT_GUARD_ALLOW_LARGE_COMMIT=1 for a deliberate exception
  guard-secrets keys its CI skip on CI being "true" rather than merely set
  create-branch validates the type, bounds the slug, and resumes an existing
    branch instead of failing
  propose-commit-message takes scope from the staged paths and names the file

Adds scripts/git/tests: eight suites, where this repository had none.

@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: a56f180675

ℹ️ 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 on lines +15 to +16
typed_pattern='^(codex/)?(feat|fix|chore|refactor|docs|test|perf|ci|spike|hotfix)/[a-z0-9]+(-[a-z0-9]+)*$'
peer_pattern='^(codex|cc)/[a-z0-9]+(-[a-z0-9]+)+$'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep accepted branch names aligned with PR validation

When a developer uses either newly accepted form, such as fix/foo or cc/rebuild-index, this guard allows commits, but the branch-name job in .github/workflows/git-hygiene.yml lines 29-41 still accepts only codex/<type>/<slug>. Every PR from these branches will therefore fail the repository's branch-name check despite passing the local guard; update the workflow pattern alongside this expansion or retain the stricter local pattern.

Useful? React with 👍 / 👎.

@saagpatel
saagpatel merged commit 9f98831 into main Aug 11, 2026
26 checks passed
@saagpatel
saagpatel deleted the codex/chore/land-guard-scripts branch August 11, 2026 20:00
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.

1 participant