fix(archive): preserve requirement order when renaming - #1712
Conversation
Fork pull request not scannedFork pull requests are not scanned. Open the branch in this repository, then create a new pull request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughRequirement recomposition now preserves original block positions across direct and chained renames. Foreign-tail warnings use the original block’s replacement. Tests cover ordering, collisions, trailing content, and rename-plus-modify behavior. ChangesRequirement rename recomposition
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change preserves requirement order during successful renames without altering validation or transaction behavior; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
clay-good
left a comment
There was a problem hiding this comment.
Status: LGTM.
What was wrong: successful RENAMED operations changed Map insertion order, so recomposition moved renamed requirements to the end and created unrelated archive diff churn.
How it was fixed: the merge now keeps lookup keys separate from positional keys, updates the source slot through direct and chained renames, and preserves the original block for foreign-tail loss attribution. Adds still append; collision and transaction behavior are unchanged.
Replication / proof: the focused archive and salvage suites pass (229/229), including first/middle/last, multiple and chained renames, rename-plus-modify, re-add, foreign-tail attribution, and collision rollback. Build and lint pass locally. The exact head commit is based on current main, is mergeable, and all required GitHub checks pass across Linux, macOS, and Windows.
Notes / nits: no blocking findings. No branch update or extra patch was needed; current main is already the PR base.
Risk: low-medium. Archive output order changes only when a requirement is successfully renamed. Validation, collisions, transaction boundaries, and other operation ordering are unchanged.
What was wrong
Renaming deleted the requirement's old map key and inserted the new key. Recomposition then treated the renamed block like a new addition and moved it to the end.
For example, renaming
BetainAlpha, Beta, GammaproducedAlpha, Gamma, Beta Prime, creating unrelated archive diff churn.What changes
A successful rename now updates a parallel positional key for the parsed requirement's source slot. The original parsed block remains available for loss attribution, the same slot follows multiple and chained renames, and genuinely added requirements still append as before.
Why it's safe
Proof
git diff --checkpass on Windows.Compatibility note: requirement order is not normative, but consumers that relied on renamed requirements moving to the tail will now see stable source order. This PR does not define semantic ordering or change general serialization policy.
A patch changeset records the user-visible archive ordering fix.
🤖 Generated with Codex (GPT-5).
Summary by CodeRabbit
Bug Fixes
Tests