refactor(report): drop dead include_changed_files knob, fix config_rule stored_range docs - #78
refactor(report): drop dead include_changed_files knob, fix config_rule stored_range docs#78cargo-affected-bot wants to merge 2 commits into
Conversation
…le stored_range docs
cargo-affected-bot
left a comment
There was a problem hiding this comment.
Both doc corrections check out against the code: selection.rs builds ConfigRule reasons with stored_range: None / collect_sha: String::new() / matched_hunk: (0, 0), and docs/report-json.md already documented the config_rule case, so the Rust comments were the stale side. The include_changed_files removal is safe — SelectionInputs has exactly one construction site (plan.rs::write_selection_report), which is only reached from the selection path in run.rs/status.rs; the no-anchor case goes through build_full_suite, which hardcodes changed_files: None.
One nit inline. cargo clippy --all-targets is clean and the 113 unit tests pass here (the description says 114 — that's the count including the test result: summary line).
Two small accuracy fixes in the report layer, found by the nightly survey of
docs/report-json.md(today's rotation bucket) read againstsrc/report.rs.config_rulereasons also have a nullstored_range. The schema doc already says so —docs/report-json.mdlistsstored_rangeas "nullforstructural_backstopandconfig_rule" — but both Rust doc comments named onlystructural_backstop.selection.rsbuildsConfigRulereasons withstored_range: None(a config rule matches an input path, not a coverage row), so the markdown was right and the doc comments onHitReason::stored_rangeandReasonEntry::stored_rangewere incomplete. Corrected both to match.SelectionInputs::include_changed_fileshas never been anything buttrue. It was introduced in #16 with two call sites (runandstatus), both hardcodedtrue; #71 folded those into the singleplan.rscall site, stilltrue.git log -Sover the field's whole history shows nofalseanywhere. Its doc claimed "falsecollapses toselection.changed_files = None(no diff anchor was usable)" — but a run with no usable diff anchor ismiss-no-reachable-sha, which routes tobuild_full_suiteinstead and never constructsSelectionInputsat all. So the branch described a state the type can't reach. Removed the field and the dead arm, leaving a comment on why theSomeis unconditional. No behavior change.Test. Neither change is a bug fix, so there's no failing-before regression test to add. What was missing is a pin on the encoding the corrected docs describe:
selection.rsfillscollect_sha,matched_hunkandstored_rangefor aConfigRulereason by hand, and nothing asserted the resulting JSON.config_rule_reason_carries_no_coverage_anchorcovers that —kind: "config_rule",stored_range: null,collect_sha: "",matched_hunk: [0, 0]— so a future edit that starts populating a range has to update the v1 schema doc deliberately rather than silently.cargo clippy --all-targets,cargo fmt --checkand the 113 unit tests pass locally. The functional suite runs in CI.