justinmclean opened a new pull request, #297:
URL: https://github.com/apache/airflow-steward/pull/297

   Two pre-flight checks in `tools/spec-loop/loop.sh` that close the gap that 
let
     an iteration re-do merged work under the same branch name as the
     already-shipped PR.
   
     ## What went wrong (the case this fixes)
   
     A `loop.sh` build iteration forked off **local `main`**, which was behind
     `upstream/main`. The work item — a doc page — already existed on
     `upstream/main` via a merged PR, and that PR's source branch still lived on
     `origin`. The loop dutifully re-authored the file from scratch on a new 
local
     branch with the **same name** as the merged PR's source branch. The diff
     looked clean against local main (+263 lines, 2 files); against 
`upstream/main`
     it was a 45-file, ~3000-line implicit deletion + a duplicate of an
     already-merged doc. Pushing blind would have been bad.
   
     ## The two checks
     
     ### Freshness check (before `git checkout $BASE`)
   
     Fetches `BASE@{upstream}` and refuses to fork if `BASE` is behind.
     
     ```text
     ✗ Base 'main' is 24 commit(s) behind 'upstream/main'.
       Fast-forward before re-running:
         git checkout main && git merge --ff-only upstream/main
       Forking off a stale base re-does merged work — the new branch
       may collide with one already on the remote for the same change.
   
     Branch-name collision check (after the agent forks its branch)
     
     Walks every configured remote (git remote) and warns if any already has a
     branch with that name. Covers fork-based workflows where the merged PR's
     source branch lingers on origin and canonical history lives on upstream.
   
     ⚠ Remote 'origin' already has a branch named 'mode-economics-doc'.
       Likely the source branch of a PR that already shipped under this slug.
       Inspect before pushing — do not push blind:
         git fetch --all && git log --oneline --all -- <changed-file>
     [ new branch ] mode-economics-doc  (forked off main)
   
     Graceful degradation
   
     Both checks are warn-and-skip, not hard fails, when:
   
     - BASE has no upstream tracking branch (freshness skipped with ⚠).
     - The fetch fails — offline, sandbox network blocked, auth missing
     (freshness skipped with ⚠).
     - ls-remote to a configured remote fails (collision skipped silently for
     that remote, others still checked).
   
     Sandbox-only runs that never reach the network still complete; the loop
     just doesn't get the safety net those checks provide.
   
     Verification
   
     - bash -n tools/spec-loop/loop.sh — syntax clean.
     - All prek hooks green at commit time.
   
     ## Important Note
   
     Based on spec-driven because tools/spec-loop/loop.sh doesn't exist on
     main yet (it lands via #250). Merge order: #250 first, then this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to