Skip to content

ci(spec-sync): stop silent failures, skip re-push to existing bot branch, report results to issue - #12

Merged
pierre3 merged 2 commits into
mainfrom
ci/spec-sync-hardening
Oct 7, 2026
Merged

pierre3 merged 2 commits into
mainfrom
ci/spec-sync-hardening

Conversation

@pierre3

@pierre3 pierre3 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Hardens .github/workflows/spec-sync.yml after the first real drift (#10 / #11) exposed silent failures.

Why

  • The draft-PR step failed (repo setting Allow GitHub Actions to create and approve pull requests was off; now on).
  • The push uses --force-with-lease on a checkout with no tracking ref. If the bot branch already exists (the next weekly run before chore(spec-sync): update specs to fa5577c9 and regenerate #11 merges, or a re-run), the push is rejected as stale. pwsh ignores the non-zero exit, so the run stays green while the push fails.
  • When the build or tests fail, the result only appears in the PR body; the run itself does not fail.

What

  • git/gh failures fail the step ($PSNativeCommandUseErrorActionPreference). Only the probes whose non-zero exit is the answer are exempt.
  • No re-push to an existing spec-sync/update-<sha8> branch. Regeneration for the same SHA gives the same output, and skipping the push keeps reviewer fixups. The PR body says the push was skipped.
  • A PR that a reviewer closed without merging is not opened again.
  • New step: comment the regen/build/test/PR results and PR link on the tracking issue (!cancelled()). The comment says why no PR was opened when there is none.
  • New final step: fail the run when the regenerated client does not build or the tests fail.
  • PR body: run URL, a note that GITHUB_TOKEN PRs do not trigger ci.yml, and Closes #<issue>.
  • Validate the upstream SHA format. Step outputs are passed via env:.
  • ci.yml: permissions: contents: read, plus persist-credentials: false on checkout.
  • Docs: design §9, CLAUDE.md.

Gate

security / test-arch / code: all PASS, no blocking. Record: docs/reviews/2026-10-07-spec-sync-hardening-review.md. The non-blocking follow-ups are applied in af5796c.

Not run end-to-end yet. It will be verified on the next drift or via workflow_dispatch.

Related: #11 contains the generate.ps1 refDate fix. Merge #11 first. Merging this before the next scheduled run (Mon 05:23 UTC) is also recommended.

🤖 Generated with Claude Code

pierre3 and others added 2 commits October 7, 2026 16:52
…nch; report to issue

- Open/update draft PR: fail the step on non-zero git/gh exits
  ($PSNativeCommandUseErrorActionPreference). Previously a rejected push
  was swallowed and the run stayed green.
- Do not re-push an existing spec-sync/update-<sha8> branch: checkout has
  no tracking ref, so --force-with-lease was always rejected as stale, and
  overwriting would drop reviewer fixups. Same SHA regenerates
  deterministically; the skip is noted in the PR body.
- PR body: run URL, note that GITHUB_TOKEN PRs do not trigger ci.yml,
  "Closes #<tracking issue>".
- New step: comment build/test/PR results (or the lack of a PR) on the
  tracking issue, even when the PR step fails.
- New final step: fail the run when the regenerated client does not
  build or pass tests (previously only visible in the PR body).
- ci.yml: pin permissions to contents: read.
- Docs: design section 9 and CLAUDE.md describe the prerequisites/behaviour.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…env passing)

- Do not reopen a spec-sync PR that was closed without merging for the
  same upstream SHA (avoids weekly re-creation); say so on the issue.
- Report step: include the regenerate outcome, distinguish closed-PR /
  regeneration-failed / other no-PR causes; run on !cancelled(); pass
  step outputs through env instead of expanding them into the script.
- Validate the upstream SHA format before emitting it.
- Close-on-sync step: fail on gh errors like the other steps.
- PR body: note that build/test results are from this run when the
  existing branch was not re-pushed.
- ci.yml: persist-credentials: false on read-only checkouts.
- Docs: design section 9 (closed-PR behaviour); gate record.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@pierre3
pierre3 merged commit ebc43b1 into main Oct 7, 2026
3 checks passed
@pierre3
pierre3 deleted the ci/spec-sync-hardening branch October 7, 2026 08:16
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