Skip to content

ci: re-run stale stack-dependent checks on stack shape changes - #54

Merged
thecodedrift merged 3 commits into
mainfrom
jakob/stack-recheck
Jul 7, 2026
Merged

ci: re-run stale stack-dependent checks on stack shape changes#54
thecodedrift merged 3 commits into
mainfrom
jakob/stack-recheck

Conversation

@thecodedrift

Copy link
Copy Markdown
Member

"Trueing" the stack. When you push A then stack B on it, GitHub doesn't re-run A's checks — so a stack-position-dependent gate (the OpenSpec archive check) stays failing on A even though A is no longer the tip (where it should skip). This closes that gap.

Approach (as discussed)

  • Brute-force re-run, only on failure. On a stack shape change, for each PR in the affected stack, re-run any workflow run that has a FAILED job whose name is stack-prefixed. Green/skipped stack checks and non-stack failures (tests) are left alone — nothing re-runs mid-stack when everything's already correct.
  • stack job-name prefix identifies the gates. pr-check-openspec's jobs are renamed to stack: position and stack: openspec-archived. Re-running the whole run re-computes position, so the archive job flips from failingskipped once A is non-tip.
  • Hung off the breadcrumb dispatch. The recheck runs in the existing stage-2 reconcile job (from the default branch), reusing the shared stack-breadcrumb.cjs graph logic. New pure logic (hasFailedStackJob) is unit-tested (5 cases); the reconcile job gains actions: write.

⚠️ Branch-protection follow-up (do after merge)

Renaming check-openspec-archived changes its check name. If it (or Detect stack position) is a required status check in branch protection, update the names to stack: openspec-archived / stack: position right after this merges — otherwise merges hang waiting on a check that no longer reports.

Notes

  • Pure infra (.github/**); zero-dep .cjs covered by node --test (46 tests, +5). Both workflows YAML-validated. Labeled skip-changeset (no release impact).
  • Like the breadcrumb, stage-2 runs from the default branch, so this takes effect once merged to main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TEuUE3F23dgEyrkGPq3FiM

@thecodedrift thecodedrift added the skip-changeset PR intentionally ships no release note (bypasses the changeset requirement) label Jul 7, 2026
Copilot AI review requested due to automatic review settings July 7, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the stack breadcrumb reconciliation workflow to “true” stack-position-dependent CI gates by re-running stale failing stack-prefixed checks after stack shape changes, and aligns the OpenSpec archive workflow job names to that stack: naming convention.

Changes:

  • Add stage-2 “recheck” logic to re-run the latest completed workflow run per workflow on affected open PRs when a stack-prefixed job failed.
  • Rename OpenSpec PR-check job display names to stack: position and stack: openspec-archived so they’re detectable as stack-dependent gates.
  • Introduce and unit-test hasFailedStackJob helper for identifying failed stack-prefixed jobs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/stack-breadcrumb.yml Adds actions permission and stage-2 logic to re-run stale failing stack-dependent checks after stack shape changes.
.github/workflows/pr-check-openspec.yml Renames job display names to stack:-prefixed names to mark stack-dependent gates.
.github/scripts/stack-breadcrumb.test.cjs Adds unit tests covering hasFailedStackJob behavior across several cases.
.github/scripts/stack-breadcrumb.cjs Adds hasFailedStackJob helper and exports it for use by the reconcile workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/stack-breadcrumb.yml Outdated
thecodedrift added a commit that referenced this pull request Jul 7, 2026
Address Copilot review on #54: only fetch a run's jobs when the run's overall
conclusion is 'failure'. A non-failed run can't contain a failed job, so this
avoids a listJobsForWorkflowRun call per workflow per PR and reduces rate-limit
pressure on large stacks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thecodedrift
thecodedrift requested a review from Copilot July 7, 2026 00:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread .github/scripts/stack-breadcrumb.cjs
thecodedrift added a commit that referenced this pull request Jul 7, 2026
Address Copilot review on #54: the JSDoc said 'workflow run' while the parameter
is the run's job list; reword so the input (jobs) and the decision (re-run the
run) are both accurate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
thecodedrift and others added 3 commits July 6, 2026 17:25
"True" the stack: when a PR is stacked on/unstacked from another, GitHub does
not re-run the other PR's checks, so a stack-position-dependent gate (the
OpenSpec archive check) can stay failing on a PR that is no longer the tip.

Hang a recheck off the existing breadcrumb dispatch (stage 2, from the default
branch): for each PR in the affected stack, re-run any workflow run that has a
FAILED job whose name is `stack`-prefixed. Green/skipped stack checks and
non-stack failures (tests) are left alone, so nothing re-runs mid-stack when
everything is already correct.

- Name the stack-position-dependent jobs with a `stack` prefix so failures are
  identifiable: pr-check-openspec's jobs become "stack: position" and
  "stack: openspec-archived".
- Add hasFailedStackJob() to the shared zero-dep module (unit-tested) — the
  reconcile job uses it to decide which runs to re-run; grant it actions: write.

BREAKING for branch protection: renaming `check-openspec-archived` changes its
check name. Any required-status-check config referencing the old name must be
updated to "stack: openspec-archived" (and "stack: position") after this merges,
or merges will hang waiting on a check that no longer reports.
Address Copilot review on #54: only fetch a run's jobs when the run's overall
conclusion is 'failure'. A non-failed run can't contain a failed job, so this
avoids a listJobsForWorkflowRun call per workflow per PR and reduces rate-limit
pressure on large stacks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address Copilot review on #54: the JSDoc said 'workflow run' while the parameter
is the run's job list; reword so the input (jobs) and the decision (re-run the
run) are both accurate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thecodedrift
thecodedrift force-pushed the jakob/stack-recheck branch from 7a74f09 to d5731be Compare July 7, 2026 00:25
@thecodedrift
thecodedrift merged commit 2625f8f into main Jul 7, 2026
4 checks passed
@thecodedrift
thecodedrift deleted the jakob/stack-recheck branch July 7, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changeset PR intentionally ships no release note (bypasses the changeset requirement)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants