Repository navigation
Fix string-concat truncation that broke the Flow repo-stats JSON - #207
Merged
Merged
Conversation
`_is_string_expr` ignored function calls, so a `string`-returning helper used in `a + f()` was forced through `_gen_stringify_expr` and copied into a 64-byte snprintf buffer. The repo-stats JSON emitter lost digits and braces that way (`"lines": 35913` became `"lines": 3591`), which is exactly what the first stats run on main reported. Recognize inferred string types so the call goes straight into flow_strcat. Also let the stats workflow commit Python output when Flow still disagrees, and surface Flow parity as its own non-blocking-then- failing check so a generator bug can never again leave the README stuck. Co-authored-by: Cursor <[email protected]>
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.
Summary
The first Repository Stats run on main compiled and executed the Flow counter, then reported that its JSON disagreed with the Python reference. Only the JSON was stale — the README matched.
Root cause:
_is_string_exprdid not treat function calls as strings. A helper likearea_pair_json(...)used inout + area_pair_json(...)was therefore forced through_gen_stringify_expr, which copies into a 64-bytesnprintfbuffer. Anything longer was silently truncated:Closing braces were chopped the same way, which is why the JSON structure itself was corrupted.
Fixes
_is_string_exprto use type inference so string-returning calls go straight intoflow_strcatTest plan
diffempty)out + long_piece()containsflow_strcat(..., long_piece())with nosnprintf("%s", long_piece())tests/unit/test_string_concat_calls.py(2) + existing stats/cast tests (26) passMade with Cursor