GRI-582: the hook reads the branch name it was already printing #4

Merged
vivy merged 3 commits from feature/GRI-582-pre-push-issue-key into dev 2026-10-20 10:34:02 +00:00
Owner

The hook printed the branch shape in its own help text and never read it

.githooks/pre-push here refused a push to main or dev, told the reader
that a branch is called feature/GRI-nn-... — and then accepted any name at
all. Rule 10 was a paragraph the hook had never read.

It also had no test. Nothing anywhere executed it: it is the one piece of
prevention the branch rules have, scripts/local-gates.sh fails when it is not
installed, and no suite drove it. That is the GRI-424 shape, where Merge guard
was red on 38 of 38 runs because it could only ever run in CI.

What changes

  • .githooks/pre-push refuses a branch whose name carries no
    GRI-<digits> key, case-sensitively. An off-list kind is a warning and
    not a refusal. Deleting an unprotected branch stays allowed — that is how a
    finished branch leaves, and the sweep needs it. The hook reads the name
    only, so a board outage cannot block a push for a reason unrelated to the
    branch.
  • scripts/tests/pre-push-test.sh — 30 assertions, 30 passing, driven the
    way git drives it, one ref line per push: both refusals, the warning, the
    deletion case, a tag, a lower-case key, GRI- with no digits, an unresolvable
    remote head, a push with both violations at once, and the installer's four
    --check states.
  • scripts/local-gates.sh runs it as a gate, and CI runs it as a job
    that needs no toolchain. It is in the CI roll-up's needs, so a skipped run
    is not a pass.
  • Rules 10 and 11 in plan/process/branching-and-release.md, with the sweep
    that detects what the hook cannot prevent.

The sweep, with the two shortcuts that are wrong

Rule 11 deletes a branch only when both hold, in the same pass: its key
belongs to no open issue, and git cherry origin/dev <branch> reports
nothing.

  • Plain ancestry is not the test. On Helpdesk it called 96 of 132 branches
    "not in dev" when the patch-id test said 24. A sweep written against
    ancestry would have deleted 72 live branches, because a squash merge gives
    the work a new commit no ancestry test can match.
  • "The pull request is merged" is not the test either. Two branches had a
    merged pull request and still held patches dev did not have — what a
    reverted merge leaves behind.

Archive before deleting, and the order matters: a tag is a ref, so a commit a
tag holds can never be pruned. The round trip (POST /tags → DELETE /branches/{name} → POST /branches with old_ref_name) was rehearsed against
the live forge and restores the identical sha. With the tag, a wrong deletion
costs one API call to undo; without it, it is permanent.

Three statements in these documents were false, and are corrected

Not left for the next reader to believe:

  1. The hook claimed branch protection needs a paid GitHub plan (ADR 0002), so
    "nothing on the server can refuse a bad push, at any permission level".
    GitHub is gone since 2026-10-17, and this forge applies protection to dev
    and main in this repository — five required gate contexts on dev, the
    CI roll-up plus two approvals on main — for repository admins too. ADR
    0002 now records that its premise expired, and why its controls are kept
    anyway: rule 10 has no server-side half on any forge, because
    DISABLE_GIT_HOOKS correctly keeps per-repository git hooks off.
  2. The hook pointed at a branch-guard.yml this repository does not have.
  3. "Pushing is enough to hand the work over." That is the sentence that let
    22 issues reach done with their work not in dev, 16 of them with no pull
    request in existence when they were closed. A push is not the finish line;
    done means the work is an ancestor of dev.

Rule 5 also credited GitHub with running the gates, and called the runner a
clean machine. It is on the same build host as the working trees, so what it
buys is isolation from the working tree, not an independent opinion.

Merges cannot freeze on this

The new hooks job adds no required status context. dev here requires the
five named gate contexts and not an aggregate, which is the shape that avoids
GRI-683 — where one never-dispatched CI / CI requirement froze 39 of 39
Helpdesk pull requests while every real gate on them was green. Adding CI / the pre-push hook to the required list is a separate change and should come after
this merges, never before.

Verification

scripts/tests/pre-push-test.sh 30/30, bash -n scripts/local-gates.sh, the
workflow parses and the ci job's needs reads back with hooks in it. No
Rust or front-end file is touched, so the cargo and npm gates are the forge's to
confirm on this pull request.

## The hook printed the branch shape in its own help text and never read it `.githooks/pre-push` here refused a push to `main` or `dev`, told the reader that a branch is called `feature/GRI-nn-...` — and then accepted any name at all. Rule 10 was a paragraph the hook had never read. It also had **no test**. Nothing anywhere executed it: it is the one piece of prevention the branch rules have, `scripts/local-gates.sh` fails when it is not installed, and no suite drove it. That is the GRI-424 shape, where `Merge guard` was red on 38 of 38 runs because it could only ever run in CI. ## What changes - **`.githooks/pre-push`** refuses a branch whose name carries no `GRI-<digits>` key, case-sensitively. An off-list kind is a **warning** and not a refusal. Deleting an *unprotected* branch stays allowed — that is how a finished branch leaves, and the sweep needs it. The hook reads the **name** only, so a board outage cannot block a push for a reason unrelated to the branch. - **`scripts/tests/pre-push-test.sh`** — 30 assertions, 30 passing, driven the way git drives it, one ref line per push: both refusals, the warning, the deletion case, a tag, a lower-case key, `GRI-` with no digits, an unresolvable remote head, a push with both violations at once, and the installer's four `--check` states. - **`scripts/local-gates.sh`** runs it as a gate, and **CI** runs it as a job that needs no toolchain. It is in the `CI` roll-up's `needs`, so a skipped run is not a pass. - **Rules 10 and 11** in `plan/process/branching-and-release.md`, with the sweep that detects what the hook cannot prevent. ## The sweep, with the two shortcuts that are wrong Rule 11 deletes a branch only when **both** hold, in the same pass: its key belongs to no open issue, **and** `git cherry origin/dev <branch>` reports nothing. - **Plain ancestry is not the test.** On Helpdesk it called 96 of 132 branches "not in `dev`" when the patch-id test said 24. A sweep written against ancestry would have deleted **72 live branches**, because a squash merge gives the work a new commit no ancestry test can match. - **"The pull request is merged" is not the test either.** Two branches had a merged pull request and still held patches `dev` did not have — what a reverted merge leaves behind. Archive before deleting, and the order matters: a tag is a ref, so a commit a tag holds can never be pruned. The round trip (`POST /tags` → `DELETE /branches/{name}` → `POST /branches` with `old_ref_name`) was rehearsed against the live forge and restores the identical sha. With the tag, a wrong deletion costs one API call to undo; without it, it is permanent. ## Three statements in these documents were false, and are corrected Not left for the next reader to believe: 1. The hook claimed branch protection needs a paid GitHub plan (ADR 0002), so "nothing on the server can refuse a bad push, at any permission level". GitHub is gone since 2026-10-17, and this forge applies protection to `dev` and `main` **in this repository** — five required gate contexts on `dev`, the `CI` roll-up plus two approvals on `main` — for repository admins too. ADR 0002 now records that its premise expired, and why its controls are kept anyway: rule 10 has no server-side half on any forge, because `DISABLE_GIT_HOOKS` correctly keeps per-repository git hooks off. 2. The hook pointed at a `branch-guard.yml` this repository does not have. 3. **"Pushing is enough to hand the work over."** That is the sentence that let 22 issues reach `done` with their work not in `dev`, 16 of them with no pull request in existence when they were closed. A push is not the finish line; `done` means the work is an ancestor of `dev`. Rule 5 also credited GitHub with running the gates, and called the runner a clean machine. It is on the same build host as the working trees, so what it buys is isolation from the working tree, not an independent opinion. ## Merges cannot freeze on this The new `hooks` job adds no **required** status context. `dev` here requires the five named gate contexts and not an aggregate, which is the shape that avoids GRI-683 — where one never-dispatched `CI / CI` requirement froze 39 of 39 Helpdesk pull requests while every real gate on them was green. Adding `CI / the pre-push hook` to the required list is a separate change and should come after this merges, never before. ## Verification `scripts/tests/pre-push-test.sh` 30/30, `bash -n scripts/local-gates.sh`, the workflow parses and the `ci` job's `needs` reads back with `hooks` in it. No Rust or front-end file is touched, so the cargo and npm gates are the forge's to confirm on this pull request.
GRI-582: the hook reads the branch name it was already printing
Some checks failed
CI / the pre-push hook (pull_request) Has been cancelled
CI / cargo fmt (pull_request) Has been cancelled
CI / cargo clippy (pull_request) Has been cancelled
CI / cargo test (pull_request) Has been cancelled
CI / cargo deny (pull_request) Has been cancelled
CI / cargo deny advisories (pull_request) Has been cancelled
CI / frontend-web (pull_request) Has been cancelled
CI / CI (pull_request) Has been cancelled
1b8e6bfe44
This repository's pre-push hook refused a push to main or dev, printed
'feature/GRI-nn-...' in its own help text as the shape a branch has — and then
accepted any name at all. Rule 10 was a paragraph the hook had never read.

It also had no test. Nothing anywhere executed it: it is the one piece of
prevention the branch rules have, local-gates.sh fails when it is not
installed, and no suite drove it. That is the GRI-424 shape, where Merge guard
was red on 38 of 38 runs because it could only ever run in CI.

What changes:

- .githooks/pre-push refuses a branch whose name carries no GRI-<digits> key,
  case-sensitively, and warns on a kind that is off the list rather than
  refusing it. Deleting an unprotected branch stays allowed — that is how a
  finished branch leaves, and the sweep needs it.
- scripts/tests/pre-push-test.sh drives every branch of it the way git does,
  one ref line per push: 30 assertions, 30 passing. Both scripts/local-gates.sh
  and CI run it, the CI job needs no toolchain, and it is in the CI roll-up's
  needs so a skipped run is not a pass.
- Rules 10 and 11 are in plan/process/branching-and-release.md, with the sweep
  that detects what the hook cannot prevent: no open issue AND no patch dev is
  missing, both in the same pass, archive tag before deletion.

Three statements in those documents were out of date and are corrected, not
left for the next reader to believe:

- The hook claimed branch protection needs a paid GitHub plan (ADR 0002), so
  nothing on the server could refuse a bad push. GitHub is gone since
  2026-10-17 and this forge applies protection on dev and main here, for
  repository admins too. ADR 0002 now says its premise expired and why its
  controls are kept anyway — rule 10 has no server-side half on any forge,
  because DISABLE_GIT_HOOKS correctly keeps per-repository git hooks off.
- The hook pointed at a branch-guard.yml this repository does not have.
- 'Pushing is enough to hand the work over' is the sentence that let 22 issues
  reach done with their work not in dev, 16 with no pull request at all. A push
  is not the finish line; done means the work is an ancestor of dev.

The new CI job adds no required status context, so it cannot freeze merges:
dev requires the five named gate contexts and not an aggregate.
The conflict was two branches appending to the same `needs:` list: dev added
`boundary` (GRI-581), this branch added `hooks`. The resolution is the union,
and the roll-up's echo block already names both.

Without dev's `boundary` job in this branch's workflow, the required context
`CI / repository boundary` could never be reported on this head, so the merge
was frozen by a check nobody would produce (the GRI-683 shape).

`repo-boundary --repo .` passes: this branch's edit to
plan/process/branching-and-release.md is a named GRI-715 exception.
GRI-582: the forge runner is not a clean machine
Some checks failed
CI / the pre-push hook (pull_request) Successful in 6s
CI / cargo fmt (pull_request) Successful in 5s
CI / cargo deny (pull_request) Successful in 39s
CI / cargo deny advisories (pull_request) Failing after 39s
CI / cargo clippy (pull_request) Successful in 9m40s
CI / repository boundary (pull_request) Successful in 6s
CI / cargo test (pull_request) Successful in 9m51s
CI / frontend-web (pull_request) Successful in 9m38s
CI / CI (pull_request) Successful in 4s
d71a8d424c
Same correction as rule 5 in the branching document on this branch: the
pull-request gates run in a fresh container isolated from the working tree,
on this same build host. Calling it a clean machine has already been read as
"an independent measurement", which it is not.
vivy merged commit 3480af4c91 into dev 2026-10-20 10:34:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!4
No description provided.