From eab0a07f71734551fcc88c830bef407c1cdd5297 Mon Sep 17 00:00:00 2001 From: Christian Klotz Date: Wed, 4 Feb 2026 16:01:46 +0000 Subject: [PATCH] chore: replace landpr prompt with end-to-end landing workflow (#8916) --- .pi/prompts/landpr.md | 137 ++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 86 deletions(-) diff --git a/.pi/prompts/landpr.md b/.pi/prompts/landpr.md index 2220adb0c5..c36820839c 100644 --- a/.pi/prompts/landpr.md +++ b/.pi/prompts/landpr.md @@ -8,98 +8,63 @@ Input - If missing: use the most recent PR mentioned in the conversation. - If ambiguous: ask. -Do (review-only) -Goal: produce a thorough review and a clear recommendation (READY for /landpr vs NEEDS WORK). Do NOT merge, do NOT push, do NOT make changes in the repo as part of this command. +Do (end-to-end) +Goal: PR must end in GitHub state = MERGED (never CLOSED). Use `gh pr merge` with `--rebase` or `--squash`. -1. Identify PR meta + context +1. Repo clean: `git status`. +2. Identify PR meta (author + head branch): ```sh - gh pr view --json number,title,state,isDraft,author,baseRefName,headRefName,headRepository,url,body,labels,assignees,reviewRequests,files,additions,deletions --jq '{number,title,url,state,isDraft,author:.author.login,base:.baseRefName,head:.headRefName,headRepo:.headRepository.nameWithOwner,additions,deletions,files:.files|length}' + gh pr view --json number,title,author,headRefName,baseRefName,headRepository --jq '{number,title,author:.author.login,head:.headRefName,base:.baseRefName,headRepo:.headRepository.nameWithOwner}' + contrib=$(gh pr view --json author --jq .author.login) + head=$(gh pr view --json headRefName --jq .headRefName) + head_repo_url=$(gh pr view --json headRepository --jq .headRepository.url) ``` -2. Read the PR description carefully - - Summarize the stated goal, scope, and any “why now?” rationale. - - Call out any missing context: motivation, alternatives considered, rollout/compat notes, risk. +3. Fast-forward base: + - `git checkout main` + - `git pull --ff-only` +4. Create temp base branch from main: + - `git checkout -b temp/landpr-` +5. Check out PR branch locally: + - `gh pr checkout ` +6. Rebase PR branch onto temp base: + - `git rebase temp/landpr-` + - Fix conflicts; keep history tidy. +7. Fix + tests + changelog: + - Implement fixes + add/adjust tests + - Update `CHANGELOG.md` and mention `#` + `@$contrib` +8. Decide merge strategy: + - Rebase if we want to preserve commit history + - Squash if we want a single clean commit + - If unclear, ask +9. Full gate (BEFORE commit): + - `pnpm lint && pnpm build && pnpm test` +10. Commit via committer (include # + contributor in commit message): + - `committer "fix: (#) (thanks @$contrib)" CHANGELOG.md ` + - `land_sha=$(git rev-parse HEAD)` +11. Push updated PR branch (rebase => usually needs force): -3. Read the diff thoroughly (prefer full diff) + ```sh + git remote add prhead "$head_repo_url.git" 2>/dev/null || git remote set-url prhead "$head_repo_url.git" + git push --force-with-lease prhead HEAD:$head + ``` - ```sh - gh pr diff - # If you need more surrounding context for files: - gh pr checkout # optional; still review-only - git show --stat - ``` +12. Merge PR (must show MERGED on GitHub): + - Rebase: `gh pr merge --rebase` + - Squash: `gh pr merge --squash` + - Never `gh pr close` (closing is wrong) +13. Sync main: + - `git checkout main` + - `git pull --ff-only` +14. Comment on PR with what we did + SHAs + thanks: -4. Validate the change is needed / valuable - - What user/customer/dev pain does this solve? - - Is this change the smallest reasonable fix? - - Are we introducing complexity for marginal benefit? - - Are we changing behavior/contract in a way that needs docs or a release note? + ```sh + merge_sha=$(gh pr view --json mergeCommit --jq '.mergeCommit.oid') + gh pr comment --body "Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: $land_sha\n- Merge commit: $merge_sha\n\nThanks @$contrib!" + ``` -5. Evaluate implementation quality + optimality - - Correctness: edge cases, error handling, null/undefined, concurrency, ordering. - - Design: is the abstraction/architecture appropriate or over/under-engineered? - - Performance: hot paths, allocations, queries, network, N+1s, caching. - - Security/privacy: authz/authn, input validation, secrets, logging PII. - - Backwards compatibility: public APIs, config, migrations. - - Style consistency: formatting, naming, patterns used elsewhere. - -6. Tests & verification - - Identify what’s covered by tests (unit/integration/e2e). - - Are there regression tests for the bug fixed / scenario added? - - Missing tests? Call out exact cases that should be added. - - If tests are present, do they actually assert the important behavior (not just snapshots / happy path)? - -7. Follow-up refactors / cleanup suggestions - - Any code that should be simplified before merge? - - Any TODOs that should be tickets vs addressed now? - - Any deprecations, docs, types, or lint rules we should adjust? - -8. Key questions to answer explicitly - - Can we fix everything ourselves in a follow-up, or does the contributor need to update this PR? - - Any blocking concerns (must-fix before merge)? - - Is this PR ready to land, or does it need work? - -9. Output (structured) - Produce a review with these sections: - -A) TL;DR recommendation - -- One of: READY FOR /landpr | NEEDS WORK | NEEDS DISCUSSION -- 1–3 sentence rationale. - -B) What changed - -- Brief bullet summary of the diff/behavioral changes. - -C) What’s good - -- Bullets: correctness, simplicity, tests, docs, ergonomics, etc. - -D) Concerns / questions (actionable) - -- Numbered list. -- Mark each item as: - - BLOCKER (must fix before merge) - - IMPORTANT (should fix before merge) - - NIT (optional) -- For each: point to the file/area and propose a concrete fix or alternative. - -E) Tests - -- What exists. -- What’s missing (specific scenarios). - -F) Follow-ups (optional) - -- Non-blocking refactors/tickets to open later. - -G) Suggested PR comment (optional) - -- Offer: “Want me to draft a PR comment to the author?” -- If yes, provide a ready-to-paste comment summarizing the above, with clear asks. - -Rules / Guardrails - -- Review only: do not merge (`gh pr merge`), do not push branches, do not edit code. -- If you need clarification, ask questions rather than guessing. +15. Verify PR state == MERGED: + - `gh pr view --json state --jq .state` +16. Delete temp branch: + - `git branch -D temp/landpr-`