Repository navigation
refactor(vis): split run.rs - #244
Conversation
`clean`, `cache clean`, `cache hash`, `cache why` and `replay` each defined their own stdout, stderr and status struct and wrote it through a private writer. `output::Output` holds them once, with `say` for a pail block on the stream its level uses and `emit` built on `write_streams`. No behaviour change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cache_hash.rs doubled as the run-summary schema, the collation library
and a second loader, and `cache why` and `replay` copied its failure
outputs. The schema (`Details`, `Fingerprint`, `Task`, `Summary`, the
probes) moves to `run_summary`, the root collation to `collation`.
`cache hash` now reads through `summary::{context, load_summary,
find_task}` like the other two, with `Ordered<V>` replacing its own
`Bucket` and `Lists`. The "no summary" and "task not in run" blocks, the
failure JSON, `json_text` and the run id check each live once in
`summary`.
Differences between the former copies, each now the stricter one so Node
answers where the two disagreed: a summary file or task entry that is a
JSON array (serde reads a sequence into a struct, JavaScript does not),
and a workspace root containing a backslash, which `cache hash` did not
check. `Ordered` rejected an empty key where `cache hash` kept it; Node
prints both the same, so `Ordered` keeps it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`replay`, `cache why` and `cache hash` answer natively for a summary whose environment, stats or hash inputs hold a `""` key. The parity suites now prove those answers equal Node's. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`matches_all` matched the operator text twice, once to strip it and once to pick the comparison. An `Operator` enum now splits the clause and decides whether it holds. No behaviour change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`table` was 128 lines of header, trace-mode reasons and diff. It now orchestrates `render_header`, `render_trace_reasons` and `render_diff`. No behaviour change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`vis run` and `cache prune` each held the seven-day window and the rule that dot files and the `v2` store are not swept. They now read `DEFAULT_MAX_CACHE_AGE` and `is_sweep_candidate` from `cache::entries`. No behaviour change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
run.rs (1142 lines) becomes a `run/` directory: `preflight` (the process,
working-directory, lockfile and pin checks that run before a workspace file
is read, and the sweep check), `render` (the static renderer's lines and
the layout checks), `summary_json` (`.vis/last-summary.json`) and `mod`
(parse, the lookups, `attempt`, `run`).
`attempt` was 128 lines of seven phases; it is now `gates`, `projects` and
`probe_and_recheck` around the lookups. The Node version of the summary was
two options with an arm for "neither" that could not be reached; it is an
`enum NodeVersion { Launcher, Probe }`. `!all(!exists)` reads as
`any(exists)`. The summary is built with the shared ordered JSON writer
instead of a private one, and the target-name predicate is built on
`text::is_ascii_graphic`. No behaviour change: the summary bytes are the same.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoSplit native run and cache modules into focused components
AI Description
Merge Risk
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can copy the agent prompt from any finding and feed it to your IDE agent |
|
Thank you for following the naming conventions! 🙏 |
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
|
ⓘ Qodo did not review this PR because this workspace reached its daily trial limit of 100 reviews. Reviews start again at 00:00 UTC. Choose a plan to continue now. |
What
native/cli/src/run.rs(1142 lines) is split into arun/directory, and the remaining small items of the same review are done.run.rsenvironment, working-directory, lockfile, pin checks,nothing_to_sweeprun/preflight.rsrun.rsfirst half ofattemptrun/preflight.rs::gatesrun.rsworkspace read ofattemptrun/mod.rs::projectsrun.rsversion questions and re-check ofattemptrun/mod.rs::probe_and_recheckrun.rsLook,Grouping,Answer::stdout,describe,layout_fits,gitlab_section_key,seconds_textrun/render.rsrun.rsAnswer::summary,iso, and the privateJsonwriterrun/summary_json.rs, onsort_package_json::json::{Json, stringify}run.rsparse,Hit,Answer,look_up_all,sort_times,write_summary,runrun/mod.rsrun::plainrun::is_target_word, ontext::is_ascii_graphiclauncher_version: Optionandnode_command: Optionwith an unreachable(None, None)armenum NodeVersion { Launcher(String), Probe(PathBuf) }!all(!exists)any(exists)cache_why::table(128 lines)render_header,render_trace_reasons,render_diffrun::SWEEP_WINDOW,cache_prune::DEFAULT_MAX_CACHE_AGE,cache_prune::V2_ROOT, and the dot-file andv2check in bothcache::entries::{DEFAULT_MAX_CACHE_AGE, is_sweep_candidate}toolchain::matches_allmatching the operator text twicetoolchain::OperatorDifferences found between former copies
None that changes behaviour. The two sweep windows were both seven days (
cache pruneheld it as7.0 * 24.0 * 60.0 * 60.0 * 1000.0milliseconds, whichDEFAULT_MAX_CACHE_AGE.as_secs_f64() * 1000.0equals exactly). The private JSON writer andstringifyagree on indentation, empty containers and escapes;runwrites the same text, with no trailing newline.Tests: the
Jsonunit test is dropped with the writer (stringifyhas its own);the_summary_is_written_like_json_stringify_with_the_hits_in_project_orderchecks the written summary's shape, the project order oftaskGraphand thetasksentries; theruntests moved with the code they cover.Not done from the review, left for a later change: the hand-built JSON in
cache listandcache sizeandsummary::json_text(therunwriter is the only one unified here), and the printable-ASCII predicates of modules outside the cache commands (keys_refresh,self_update,deps). The sweep predicate is namedis_sweep_candidaterather thansweep_candidates, because it tests one name.What ran locally
cargo fmt,cargo clippy -p vis-core -p vis-cli --all-targets -- -D warnings: clean.cargo test --workspaceinpackages/tooling/vis/native: all pass (vis-cli: 492 unit tests).viscopied overvis-native-cliandFORCE_COLOR=3: vitestrun-all-hit,cache-prune,cache-clean,cache-inspect,cache-hash,summary-commands,routeandrouting-fixtureparity files: 2474 tests passed in one run;cache-inspect(one 10-minute test) timed out in that run while the machine was loaded and passed alone in 83 s.🤖 Generated with Claude Code