Conversation
The previous commit inadvertently removed fixed width handling for
return and throw statement prefixes, causing test failures in
argument_list_wrapping and argument_list_pjf_parity specs.
These fixed keyword prefixes ('return ' = 7 chars, 'throw ' = 6 chars)
are STABLE and don't change between formatting passes, so they can
be safely used without causing instability.
The instability only occurred when walking up through variable_declarator
ancestors and extracting type/modifier text, which DOES change between
passes.
All 74 library tests + 146 spec tests pass.
Jahia project still formats with 0 errors.
- Walk up ancestors to find return_statement/throw_statement instead of checking immediate parent - This correctly adds return/throw prefix width (7/6) to top-level argument lists - Stop at argument_list boundaries to avoid adding prefix to nested calls - Prevents regression in argument_list_wrapping and argument_list_pjf_parity tests
- These spec files were inadvertently modified to match the buggy behavior - Restore master expectations that correctly expect wrapping in test1/test7/test8
Review SummaryThanks for the PR! The core insight is correct — source-position-dependent width calculations ( Existing tests all pass and this fixes several real instability patterns. I've filed inline comments below — there's one bug (operator width), two formatting regressions from over-aggressively dropping prefix width info, and some nits. Key findings
The regressions (#2, #3) share a common fix pattern: the instability came from row-based position checks ( |
|
Thanks for the quick review! Copilot happily took your comments, fixed them, I asked for more regression testing (because it would still fail on the reproduction), and here is the result. If still not satisfying, you might want to take it up from here or I'll restart from scratch, I am not really confident in the amount of code it produced on top of the existing codebase Agent summary:
|
|
Thanks for flagging this issue with a great repro (the 10 Jahia files) and for the fix attempt — the analysis of root causes in this PR was spot on and helped guide the final fix. We've landed the fix in #3, which takes the same core approach (replacing source-position-dependent width calculations with structural AST-based alternatives) but extends it to a few additional callsites:
We also verified that the The fix includes 58 stability tests + 10 Jahia integration tests, all passing. Closing this in favor of #3. |
Hi!
I tasked Copilot to fix #1, I'll review the code then mark this PR as ready if the code is ok
The code looks ok, there are new tests and no regression on existing tests. Plus, more importantly, it fixes #1!
It's still full LLM slop, don't invest time to review it if it looks remotely weird.
I kept the tool Copilot created to debug stability issues (
examples/debug_stability.rs) because it was useful during the fix, but I might as well remove itThanks!