Skip to content

fix(pre-commit-advisory): stop a failed cache-seed run from reddening main - #51

Merged
blairham merged 1 commit into
mainfrom
fix/precommit-seed-nonblocking
Aug 5, 2026
Merged

fix(pre-commit-advisory): stop a failed cache-seed run from reddening main#51
blairham merged 1 commit into
mainfrom
fix/precommit-seed-nonblocking

Conversation

@blairham

@blairham blairham commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make the advisory job continue-on-error on push only. The push-to-default-branch run gates nothing — its hook steps already end in || true and the exit-code-reflecting step is pull_request-only — so it exists purely to populate the default-branch cache scope for PR branches.
  • It could still fail on an infrastructure step, and did: a transient curl: (35) Recv failure: Connection reset by peer downloading the go-pre-commit release archive failed the install step and turned an otherwise-green k5s main red (run 30964880559). Test and build both passed; a plain re-run went green with no change. Because callers pin @main, that failure mode was reachable from every service repo's default branch.
  • PR runs are deliberately untouched — they keep failing loudly, because that ❌ is what makes the sticky advisory comment worth reading.
  • AGENTS.md documents the new behavior alongside the existing "non-blocking by design" section.

Context

The root cause is fixed separately in the action itself — blairham/go-pre-commit#33, released as v4.6.1. curl --retry only retries transient HTTP responses (5xx/408/429) and timeouts; a mid-transfer connection reset is a transport error, so --retry 3 never engaged. That fix adds --retry-all-errors.

This PR is the defense-in-depth half: even with retries in place, an infra step failing on a run that gates nothing should not redden a service repo's default branch. Bumping the pinned action to v4.6.1 is a separate change — this PR leaves the pin at v4.6.0.

Test plan

  • actionlint .github/workflows/pre-commit-advisory.yml — clean
  • YAML parses
  • Change is scoped to the push event via ${{ github.event_name == 'push' }}; the if: gating and every step are unchanged
  • Needs a real caller to verify: per this repo's AGENTS.md, semantic changes need a PR in a real caller pointing its uses: at this branch. The specific behavior to confirm is that job-level continue-on-error inside a workflow_call reusable propagates success back to the calling job — that can't be proven from static analysis.
  • Confirm a PR run in that caller still reports ❌ on hook failure (the path this PR must not change)

🤖 Generated with Claude Code

… main

The push-to-default-branch run gates nothing. Its hook steps already end in
`|| true`, and the step that reflects pre-commit's exit code as the job
status is `pull_request`-only — the run exists solely to populate the
default-branch cache scope so PR branches can restore hook envs.

It could still fail on an *infrastructure* step, and did. A transient

    curl: (35) Recv failure: Connection reset by peer

while downloading the go-pre-commit release archive failed the install step
and turned an otherwise-green k5s main red (run 30964880559) — test and
build both passed, nothing was wrong with the repo or its hooks, and a
plain re-run went green with no change. Because callers pin `@main`, that
failure mode was reachable from every service repo's default branch.

A seed run that fails costs PRs a cold cache, not correctness. That is not
worth a red ❌ on a service repo's default branch, so the job is now
`continue-on-error` on push.

PR runs are deliberately untouched: they keep failing loudly, because that
❌ is what makes the sticky advisory comment worth reading.

The root cause is fixed separately in the action itself (blairham/go-pre-commit#33,
released as v4.6.1 — `curl --retry` only covers transient HTTP responses and
timeouts, never transport errors like a mid-transfer reset). This is the
defense-in-depth half: even with retries, an infra step failing on a seed run
should not gate anything. Bumping the pinned action version to v4.6.1 is a
separate change.
@blairham
blairham merged commit 295a206 into main Aug 5, 2026
2 checks passed
@blairham
blairham deleted the fix/precommit-seed-nonblocking branch August 5, 2026 02:00
blairham added a commit that referenced this pull request Aug 5, 2026
…l retry fix (#52)

v4.6.0's install step fetched the release archive with `curl -fsSL --retry 3`,
which only retries transient HTTP responses (5xx, 408, 429) and timeouts. A
connection reset mid-transfer is a transport-level error, so curl exited 35
immediately without ever using its retry budget:

    curl: (35) Recv failure: Connection reset by peer

That failed the install step and turned an otherwise-green k5s main red
(run 30964880559); a plain re-run went green with no change. #51 stopped that
class of failure from reddening a caller's default branch, but the seed run
still fails and the PR path still pays a cold cache — this is the half that
actually stops the flake.

v4.6.1 adds `--retry-all-errors` (and raises --retry to 5), which extends the
budget to the transport failures we actually hit.

The bump is as narrow as it looks: v4.6.0..v4.6.1 touches only the action's
own action.yml (2 lines). No Go source changed, so the installed pre-commit
binary is byte-for-byte equivalent in behavior — no hook-execution or
cache-layout risk. Both the `uses:` ref (which carries the fixed install
script) and the `version:` input (which selects the downloaded release) move
together so they can't drift.
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