Skip to content

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

Done

Description

@athvin

Why

#1286 committed a tree from an old worktree on top of a fresh main and silently reverted 78 files: most of epic #1253, plus #1279's duplicates Parquet export. Restored by #1300 (#1299).

No gate could see it:

  • the squash was CLEAN;
  • the old code is self-consistent, so every test passed;
  • pull request contract reads the body, not the tree.

Proposal

Add a check, in pr-contract.yml or its own workflow. For each file the PR changes, compare its blob in the PR head with the blobs that path has held on main. If the PR's version equals a version main held before a later commit changed it, flag the file, naming the commits whose change it undoes.

That is exactly the test that found this one. 75 of 75 blobs matched dc45fd16. A short script over git log --format=%h -- <path> and git rev-parse <c>:<path> did it, in seconds.

  • Start as a warning. Post a PR comment listing the files and the PRs they undo.
  • Promote it to failing only after it has been seen catching the case and passing everything else. Deliberate reverts are exempt, as pull request contract exempts them: a Revert "…" title or a revert label.

Done when

  • Replaying d245d4ad on top of 8b5b25ad flags all 75 files and names the PRs they undo.
  • A normal feature PR is not flagged.

Product context (2026-11-26)

Why this matters for the API product: Merge-gate trust. #1286 was itself an API PR (#518, the record allowance), and the same stale-tree mistake could just as easily revert API contract or entity changes with every gate green.

Current state:

Definition of done:

  1. Both criteria in the body.
  2. A self-test in scripts/ci/ that is seen to fail on the replay fixture before the check is trusted.
  3. A run on a deliberate Revert "…" PR that is exempt.
  4. Promotion to a required context only after an observed catch, following the order ci-and-supply-chain records for pull request contract.

Dependencies / sequencing: None.

Size: ~0.5 engineer-weeks for the warning tier. Promotion comes later.

Activity

  1. added
    ci-backlog
    on Nov 27, 2026
  2. self-assigned this
    on Nov 27, 2026
  3. athvin commented on Nov 27, 2026

    @athvin
    OwnerAuthor

    Claimed — working in #1315 (draft). Closing that PR releases the claim. The owner asked to keep every static-site change, and this class of revert has hit twice on 2026-11-27: #1286 merged one, and #1310 was caught before it merged.

  4. added 2 commits that reference this issue on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ci-backlog

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions