Fix only_add trailing commas strategy causing MAX_WIDTH overflow (#610)#611
Fix only_add trailing commas strategy causing MAX_WIDTH overflow (#610)#611lwasyl wants to merge 5 commits intofacebook:mainfrom
only_add trailing commas strategy causing MAX_WIDTH overflow (#610)#611Conversation
only_add trailing commas strategy causing MAX_WIDTH overflow (#610)
|
@hick209 has imported this pull request. If you are a Meta employee, you can view this in D100997972. |
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
Running the tests locally in our codebase here I found issues. Root CauseThe pipeline reorder PR introduced a regression for trailing comma insertion. Here's the mechanism: Old pipeline:
New pipeline:
The fix for the What's happeningThe pipeline reorder made ktfmt non-idempotent — it takes two runs to converge: Run 1 (input has single-line params from codegen):
Run 2 (input already has multi-line params from Run 1):
Run 3+: Idempotent, no changes. The regressionBefore the pipeline reorder, This is a non-idempotency bug — a single ktfmt invocation should produce the final formatted output. |
|
Thanks for the overview! My original idea was to run I recognize that just adding elements multiple times is maybe not the most efficient approach 😅 At the same time I think it's the simplest at this point |
See #610