feat: add /rebase and /rebaseWithConflicts commands to cloudflare-docs-bot#32121
feat: add /rebase and /rebaseWithConflicts commands to cloudflare-docs-bot#32121mvvmm wants to merge 8 commits into
Conversation
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
Nimbus Preview URL: https://nimbus-b81c2557.preview.developers.cloudflare.com |
Review
Fix in your agentFix the following review findings in PR #32121 (https://github.com/cloudflare/cloudflare-docs/pull/32121).
Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order
After triaging, fix all legitimate findings. For any you decide to skip,
post a comment on this PR with the finding ID and your reasoning.
---
## Code Review
### Warnings (2)
#### CR-2c7d207f2e79 · Nondeterministic deduplication from concurrent updates
- **File:** `.flue/workflows/rebase.ts` line 1050
- **Issue:** The dedup logic at lines 1045-1053 uses last-write-wins based on the order of `treeUpdates`, but the array was populated by `Promise.all(...map(async ... treeUpdates.push(...)))`, so callback completion order (and thus array order) is nondeterministic. The comment itself acknowledges the order is nondeterministic, yet relies on it to pick the winning entry. Two updates for the same path (e.g. a conflict file whose resolution path overlaps another changed file) may therefore produce different trees across runs.
- **Fix:** Build updates deterministically, e.g. iterate `allPrFiles` serially with `for...of` and `await`, or collect updates into a `Map<string, TreeUpdate>` as each callback finishes so winners are chosen by explicit rule rather than push order.
#### CR-4d73854f1bc7 · Production rename detection misses dual-rename case
- **File:** `.flue/workflows/rebase.ts` line 699
- **Issue:** `isProductionRename` is `meta.productionReadPath !== path && !prFiles.find((f) => f.path === path)?.previousPath`. In case 4 (PR renamed A→B and production renamed A→C), the conflict candidate path is B, which has `previousPath` A, so the second clause is false and `isProductionRename` stays false. The resulting prompt at line 749 then labels production's content at C as "the original path before this PR renamed it" instead of production's new path, misleading the AI about which side did the rename.
- **Fix:** Derive `isProductionRename` from the metadata, e.g. `meta.productionReadPath !== meta.baseReadPath`. This is true whenever production renamed the base path (cases 3 and 4) and false otherwise (cases 1 and 2).
Code ReviewThis code review is in beta and may not always be helpful — use your judgment. Warnings (2)
ConventionsNo convention issues found. Style Guide ReviewNo style-guide issues found. CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
|
Preview URL: https://b81c2557.preview.developers.cloudflare.com |
c7fa096 to
1cffd2a
Compare
|
CR-e2cb3858a8bc — Acknowledged, intentional.
|
|
CR-c6138101439e — Disagree, disproportionate. The |
1cffd2a to
9dd8749
Compare
|
CR-b9524d294f46 — Documented, not fixed. Detecting whether the new head is a result of the async rebase (vs. a concurrent push) would require verifying that the new head is on top of the base ref via a compare call, adding a round-trip for a race that requires a push to land in the 60 s polling window. That's disproportionate. A concurrent push invalidates the rebase anyway — the author's push would need to be rebased as well — so treating it as "complete" has no meaningful downside: the subsequent /full-review runs against whatever head SHA is current, which is correct behavior. Added a JSDoc note to |
Summary
Adds
/rebaseand/rebaseWithConflictsslash commands to the cloudflare-docs-bot (.flue/). Both are codeowner-only and post status updates at the top of the bot's singleton comment throughout the operation./rebase— Rebases the PR branch againstproductionusing the GitHub update-branch API. Stops with an explanation if:productionOn a clean rebase, posts a success status and triggers a
/full-reviewautomatically (since the head SHA changed)./rebaseWithConflicts— Same as/rebase, but on conflict it attempts AI-assisted resolution:kimi-k2.7-code) with both file contents + PR intent to produce resolved versions and a confidence score/full-reviewOther changes:
postOrUpdateCommentextracted from the two workflow files that duplicated it intolib/code-review-render.tsas a shared export — covers the create-if-absent case in one placerenderRebaseStatusUpdate()added to the render lib — injects/replaces the rebase status block at the top of the bot comment, preserving existing review content belowFlueRebaseWorkflowDurable Object class added (wrangler.jsonc v9 migration)Documentation checklist