fix: resolve reordering bugs - #292
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are a few objective correctness/maintainability issues in the changed lines (notably an orphaned/mismatched JSDoc block and a TypeScript any regression) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes updateOrder reordering edge cases involving dotted keys and inline-table scenarios discovered via fuzzing, improving deterministic key placement while preserving CST structure/comments.
Changes:
- Extend container resolution to support certain implicit dotted-key reorder targets and suppress warnings for newly created inline-item move targets.
- Add “requested order” anchoring to
diff()(orderSource) and use it during patching to insert inline-table members at the correct position. - Add regression tests and fuzzing harness/logging updates (plus documentation/bug-note inventory).
File summaries
| File | Description |
|---|---|
| src/update-order.ts | Adds implicit dotted-container resolution and new-target detection to reduce reordering failures/warnings. |
| src/patch.ts | Threads orderSource into diffing, adds inline-table insertion index logic, and coalesces certain inline-array replacements. |
| src/diff.ts | Introduces Add.before and DiffOptions.orderSource to preserve caller-requested key order around adds/renames. |
| src/tests/update-order.test.ts | Adds regression tests for implicit dotted-table reorder and inline-table rename/add ordering. |
| src/tests/patch.fuzz.test.ts | Adds regression test for nested multiline array replacement stability. |
| src/tests/diff.test.ts | Adds test for orderSource anchoring behavior. |
| scripts/fuzz-run.ts | Prefixes updateOrder warnings with seed to aid fuzz triage. |
| docs/Fuzz-Testing.md | Minor wording update in fuzz-test distillation guidance. |
| docs/bug-notes/fuzz-sweep-0-3000000-update-order-warnings.md | New inventory of updateOrder warning seeds/paths. |
| docs/bug-notes/fuzz-sweep-0-3000000-RERUN.md | New sweep rerun log data. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
DecimalTurn
marked this pull request as ready for review
August 23, 2026 02:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing some issues with reordering with dotted keys discovered while using the fuzzing test harness.