Skip to content

feat(ci): flag a pull request whose files return to an older main version (#1307) - #1315

Merged
athvin merged 2 commits into
mainfrom
issue/1307-stale-tree-guard
Nov 27, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/1307-stale-tree-guard

Conversation

@athvin

@athvin athvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #1307

🚧 Claimed by an agent session — 2026-11-27T05:59:26Z, session Claude Code:30a1182e-8c7e-47e3-92ac-cda64c13fcfc on brians-MacBook-Pro.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

A new check, stale tree guard, flags a pull request whose files return to versions main already had and moved past, and names the commits merging it would undo. It is not required yet.

Why

On 2026-11-27, #1286 committed a tree from an old worktree on a fresh main and undid seven merged pull requests with every gate green: most of the cinematic marketing epic and #1279's export. #1310 nearly did the same, the same day. The owner asked that every static-site change be kept; this is the check that would have caught both.

Proof

Risk & rollback

Risk: false positives on deliberate reverts. Fewer than three source files only warns, and a Revert… title or the revert-ok label exempts. The check is not required, so a red one cannot block a merge. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:30a1182e-8c7e-47e3-92ac-cda64c13fcfc on brians-MacBook-Pro · 2026-11-27T06:48:39Z

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not: 7b34485d — rust 45953033290 ✓, frontend 45953033211 ✓, infra 45953033218 ✓, devcontainer 45953033231 ✓.
  • images built, or correctly never ran because nothing that goes into
    an image changed: n/a — a CI-only change (a workflow, scripts/ci, a skill), so images.yml correctly never ran.
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: n/a — no image was built, so nothing deployed. The guard runs on pull requests, not in a pod.
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change: nothing here reaches deploy. drift and kind are nightly and were already red before this change (kind probe red since 2026-11-10: KeyError 'token_hash' after the credential-omission fix #1106), so knowingly red and not this change.
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: CI: flag a pull request whose files revert to an older main version (the #1286 stale-tree class) #1307 closed by the pull request (closer PullRequest); card Done on board 2 through the automation.
  • follow-ups are open for everything deferred here — numbers: deferred — CI: promote stale tree guard to a required check once it has reported on real pull requests #1318 (promote stale tree guard to required once it has reported on real pull requests).
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: ci-and-supply-chain skill: a section on the guard (thresholds, exemptions, not required yet, how to run it locally). Memory stale-tree-commit-reverts-main: guard shipped.

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

bmoore813 and others added 2 commits November 26, 2026 22:14
…sion

#1286 was one commit whose parent was a fresh main but whose tree came from
an old worktree. It undid seven merged pull requests, and every gate was
green: the squash was CLEAN and the old code was self-consistent. #1310
nearly did the same that day. The diff reads as a feature that also deletes
things. What gives it away is that each file's new content is a version
main already had and moved past.

`stale tree guard` (stale-tree-guard.yml) walks each changed file's history
on main and names the commits a return would undo. A file brought back
with the content it had before main deleted it is the same finding.
Deletions alone are not findings. It is graded on main's own history:
- three or more source files returning fails;
- fewer warn (#1302 deliberately took back two lines of #877);
- screenshot baselines are reported and never counted (#1298's CTA
  baseline landed on old bytes).

Replayed against #1286's commit and main's last 40 merges, each on its true
parent:
- #1286 fails, on 33 source files;
- so does #1300, the restore, its mirror image, a revert that would
  carry `revert-ok`;
- three merges warn;
- the other 35 are silent.

The self-test runs first in the job. It covers the #1286 shape, a partial
revert, a baseline on old bytes, a genuine change, both exemptions (a
`Revert…` title and the `revert-ok` label) and a shallow clone, which is
refused rather than passed. The check is not required yet, by the order the
ci-and-supply-chain skill gives.

Closes #1307

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin force-pushed the issue/1307-stale-tree-guard branch from 4c366a9 to bd9014e Compare November 27, 2026 06:14
@athvin
athvin marked this pull request as ready for review November 27, 2026 06:36
@athvin
athvin merged commit 7b34485 into main Nov 27, 2026
47 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 27, 2026 06:37 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — bd9014ec Deployed Nov 27, 2026 by athvin via remove closed PR previews #99
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.

CI: flag a pull request whose files revert to an older main version (the #1286 stale-tree class)

2 participants