fix(runway): ISS-001 reconcile stale merge retries - #675
Conversation
|
|
sbalabanov
left a comment
There was a problem hiding this comment.
Reviewed with the same lens as #678. The fix itself looks right: applying first and checking freshness only when the apply would actually change the target is the correct way to make a redelivery converge, and the terminal-vs-retryable split still holds (checkStale returns ErrInvalidRequest, the controller turns it into FAILED and acks). The e2e fail-once trigger is a genuinely good regression test.
My main comment is the one you flagged: the loop got much harder to read. Measured on git_merger.go:
| cyclomatic | max nesting | |
|---|---|---|
applyTransforming before |
13 | 4 |
applyTransforming after |
18 | 5 |
It is now the most complex function in the file (next is resolveAndValidate at 14). I tried a smaller shape, and it works — details inline.
Four smaller notes below.
🤖 [posted by agent] — automated review by Claude Code, requested by @sbalabanov.
Summary: Intent: - Let at-least-once merge deliveries converge when a prior attempt already updated Git but failed to publish its result. - Preserve staleness protection for superseded requests that would still modify the target. Changes: - Apply transforming merge strategies locally before staleness validation and return success when the target already satisfies every step. - Check PROMOTE containment before freshness, once per request rather than once per contention attempt. - Recognise a head branch an earlier delivery moved by the committer identity recorded on the commit, and resume moving it on. - Extract one reset/apply/push cycle into attemptTransforming so applyTransforming holds only the retry decision. - Add real-Git fail-once end-to-end coverage, strategy-level regression tests, and adjacent reproduction documentation. A change's head branch moves before the target does, so a delivery can end between the two pushes. The redelivery then finds the branch off the commit its URI pins while the target is unchanged, which looks stale but is not: the branch sits on a commit the merger itself made. The committer identity recorded on that commit tells the two apart, and unlike the in-flight head-branch tracker it survives the process that wrote it. A branch the change's author advanced still carries their identity and is still rejected. The same signal lets the head branch be moved on rather than stranded on a commit that never landed. Extracting the attempt drops applyTransforming from 18 to 9 cyclomatic complexity and from 5 to 2 levels of nesting, and ends the reuse of one err variable for two different failures. --- <sub>Generated by the 🪄 pr-create skill in devexp-agent-marketplace</sub>
935e871 to
8dae6f1
Compare
Summary
Intent:
Changes:
Generated by the 🪄 pr-create skill in devexp-agent-marketplace
Test Plan
AI Verification
0 issues detected
Skipped validators: claude · EngWiki
Prior runs
Run at
c9ee7a8on Sep 4 22:04 UTC · 5 files · 2s · 0 issues detectedIssues