chore(promote): develop → main — advance-deploy-env monotonic guard - #97
Conversation
A push routinely carries commits that already shipped further down the pipeline: a staging->develop back-merge re-pushes Prod PRs to develop, and a develop==main fast-forward does the same. advance-deploy-env blindly set every PR in the push to the branch's column, un-shipping those cards (seen live: .github #87/#88/#89/#92 stranded at On dev after yesterday's ff, #95 demoted from Prod today; engine#540's back-merge would demote its whole staging history next). Now the per-PR query also reads the current Status and the update is skipped unless the target rank is strictly higher. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix(advance-deploy-env): monotonic Status — never demote a shipped card
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3bcd092. Configure here.
| | select(.project.number == ($n | tonumber)) | .status.name // ""' 2>/dev/null | head -1) | ||
| if [ "$TARGET_RANK" -gt 0 ] && [ "$(rank "$CURRENT_STATUS")" -ge "$TARGET_RANK" ]; then | ||
| echo "::notice::#$prnum already at '${CURRENT_STATUS:-none}' (>= '$STATUS_NAME') -- not demoting" | ||
| continue |
There was a problem hiding this comment.
Equal-rank skip blocks Deploy
High Severity
The monotonic guard uses -ge, so when Status is already at the target rank the loop continues and never updates Deploy environment. kanban-closure-router.yml only sets Status and usually wins the race on PR merges, so this workflow then skips the Deploy update it alone is responsible for. True demotions are strictly higher rank; -gt would still block those.
Reviewed by Cursor Bugbot for commit 3bcd092. Configure here.


Promotes #96 to
main(callers reference@main). Merge-commit per the promotion-hop rule.🤖 Generated with Claude Code
Note
Low Risk
CI-only kanban automation with a forward-only guard; no app runtime or auth changes, though incorrect rank mapping could leave some cards stale until a later forward push.
Overview
Prevents kanban cards from moving backward when
advance-deploy-envruns on pushes that re-include already-shipped commits (e.g. staging→develop back-merges or develop/main sync).The workflow now loads each PR’s current Status from the project GraphQL API, compares it to the branch’s target column using a
rank()ordering aligned withfr-gate, and skips Deploy env / Status updates when the card is already at or beyond that target—logging a notice instead of demoting (e.g. Prod → On dev).Header comments document this monotonic advancement behavior and the production incidents it addresses.
Reviewed by Cursor Bugbot for commit 3bcd092. Bugbot is set up for automated code reviews on this repo. Configure here.