fix: stop ignoring --max-depth, --min-ratio, --no-sort on --json-input#424
Merged
Conversation
…is used These options were silently ignored on the --json-input code path, which rendered the deserialized tree verbatim. --max-depth regressed in 0.12.0 when depth limiting moved out of the visualizer, while --min-ratio and --no-sort were never honored there. Apply the same depth retention, insignificant-data culling, and sorting that the filesystem scan performs. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
Performance Regression Reportscommit: 572e3e5 There are no regressions. |
The existing assertion derives the expected output from the same pipeline the production code runs, so a correlated off-by-one in the depth predicate would pass undetected. Pin the depth boundary by asserting which node names are present and absent, independently of that pipeline. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
…cull_insignificant_data Move the early-out for non-positive ratios into the method so callers no longer need to wrap it in an `if min_ratio > 0.0` guard. The guard also covers NaN so the method is a no-op for every ratio that is not greater than zero, matching the behavior the call-site guards provided. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
--max-depth, --min-ratio, --no-sort on --json-input--max-depth, --min-ratio, --no-sort on --json-input
Why is the AI so stupid?
Why, again, is the AI so fucking stupid?
The min-ratio test previously verified `actual` only against a value produced by replaying the same culling pipeline as the code under test. Assert directly that an entry far above the threshold survives and one far below it is culled, so the test no longer depends solely on that pipeline. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
Drop the `apply_pipeline` and `visualize` helpers, which computed each expected rendering by re-running the same depth/cull/sort pipeline as the code under test. Verify each flag instead with implementation-independent oracles and real-run differentials: compare against a run with the flag neutralized, and assert directly which entries appear, disappear, or change order. This matches how the other tests in this file derive their oracles. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
KSXGitHub
commented
May 28, 2026
Replace the bare boolean `assert!` comparisons with `assert_op!` from the already-declared `assert-cmp` crate so a failure reports both operand values. Bind the positions to locals first, as the simple macro form and the `perfectionist::macro-argument-binding` lint both require. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
Add `assert_op_expr` to the rule's `allow_extra` list: the macro evaluates each operand exactly once, so it carries no drop-or-duplicate hazard, unlike the `debug_assert_op*` pair already in `deny_extra`. With the exemption in place, pass the position expressions to `assert_op_expr!` directly instead of binding them to locals first. https://claude.ai/code/session_01Nj3xEp1eoDKRp1MUCxNQRQ
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.
Fixes #420.
--max-depth,--min-ratio, and--no-sortwere ignored when--json-inputwas used, so the deserialized tree was rendered verbatim.
--max-depthregressed in 0.12.0 when depth limiting moved from the visualizer into the tree
builder;
--min-ratioand--no-sorthad never been applied on this path.The
--json-inputcode path now applies the same depth retention,insignificant-data culling, and sorting that the filesystem scan performs.
Tests
json_input_max_depth,json_input_min_ratio, andjson_input_no_sortassert each flag now takes effect.
json_inputround-trip test pins--min-ratio=0so it keepsverifying faithful reconstruction.