Repository navigation
fix(tui): give cargo the absolute path of protoc, so it stops rebuilding pi-tools-api - #30
Conversation
find_protoc() returned the bare name `protoc` when it found the tool on PATH. The build script of pi-tools-api printed it as `cargo:rerun-if-changed=protoc`. That path is no file in the package directory, and cargo treats a path that does not exist as changed in every run. So every cargo run ran the build script again and rebuilt pi-tools-api. CI has protoc on PATH (arduino/setup-protoc) and no PROTOC variable, so it showed this: pi-tools-api was compiled 7 times in the cargo test job. find_protoc() now looks for the file in the directories of PATH and returns its absolute path. An absolute PROTOC variable already worked.
The item leaves the list of open decisions. It is done in PR 30.
The CHANGELOG entry and the section 10.20 paragraph said that the 7 / 4 / 3 compiles of pi-tools-api / pi-shell / pi-pager in the `cargo test` job came from the rerun-if-changed loop. The CI run of this PR shows that they do not: the numbers are the same after the fix, because the job runs one `cargo` command for each suite and each command builds the dependencies with its own features. Only the `cargo check` job shows the loop (2 compiles of pi-tools-api before, 1 after). The job times did not change (22 min 08 s, against 22 min 04 s to 22 min 43 s before). Say this in both places, and write down the result of the CI run (8,490 passed / 0 failed / 21 ignored). Correct the sentence about the benefit in the plan, too.
|
I corrected the description (section "CI result, and a correction"), the CHANGELOG entry and the execution log ( The |
- Plan (status, section 10 index, revision log), execution log (new section 10.21), CHANGELOG, baselines and baseline history: the numbers of the first nextest run on the whole tree (TUI CI run 39359879537: 8,490 passed, 0 failed, 22 skipped), the test time (about 130 s with nextest, about 65 s with cargo test, same code), and the dry run of release.yml for PR #29. - Correct the r17 notes: the 7 / 4 / 3 compiles of pi-tools-api in the cargo test job were not caused by the protoc path (PR #30 shows it), and the runner never ran doctests, so nextest loses nothing there. - Remove a duplicated "verification" heading from the r17 text.
* ci(tui): run the TUI tests with cargo nextest
The vendored tests were written for cargo nextest (one process per test), and some say in a
comment that they are reliable only under it. TUI CI ran cargo test, where all tests of a
binary share one process.
- scripts/tui_baseline.toml: `[test] runner = "nextest"`; `--runner {cargo,nextest}` on the
command line takes the other one. The libtest path stays as it was.
- scripts/tui_baseline.py: `parse_nextest_output` reads the Summary line (nextest counts the
ignored tests and the tests removed by --skip together as "skipped") and the recap of the
failed tests (the live part has the captured output of a test, so it is not read);
`suite_command` builds the command line; the report names the runner; a missing
cargo-nextest stops the run at once, with a hint.
- stream(): after the timeout, SIGTERM to the process group, and SIGKILL 20 s later. nextest
puts each test in a process group of its own, so a SIGKILL to nextest left a hanging test
alive (measured on a demo crate); a nextest that gets a SIGTERM stops its tests.
- tui-ci.yml: install cargo-nextest 0.9.148 (taiki-e/install-action) in the test job; the job
is now called "cargo nextest (Linux x86_64)".
- 21 new unit tests. The fixtures are real output of nextest 0.9.148.
* docs(tui): say in AGENTS.md and the tui_envspy README that TUI CI runs nextest
* docs: record the nextest change and the r18 round
- Plan (status, section 10 index, revision log), execution log (new section
10.21), CHANGELOG, baselines and baseline history: the numbers of the first
nextest run on the whole tree (TUI CI run 39359879537: 8,490 passed, 0 failed,
22 skipped), the test time (about 130 s with nextest, about 65 s with
cargo test, same code), and the dry run of release.yml for PR #29.
- Correct the r17 notes: the 7 / 4 / 3 compiles of pi-tools-api in the cargo
test job were not caused by the protoc path (PR #30 shows it), and the runner
never ran doctests, so nextest loses nothing there.
- Remove a duplicated "verification" heading from the r17 text.
Summary
Plan item
protoc_abs, chosen by the owner on 2026-10-20:find_protoc()returns the absolute path ofprotocwhen it finds the tool onPATH. Before, it returned the bare name.cargo:rerun-if-changed=protocnames a path that does not exist in the package directory. Cargo treats such a path as changed in every run (its own words:stale: missing ".../pi-tools-api/protoc"). So eachcargorun started the build script again and rebuiltpi-tools-apiand the crates above it. CI hasprotoconPATH(arduino/setup-protoc) and noPROTOCvariable, so CI hit this. A developer with an absolutePROTOCdid not. How much CI gains is small (see "CI result, and a correction"): the loop shows only when the samecargocommand runs again. Only one build script usespi-proto-build(pi-tools-api/build.rs).Base:
ci/release-setup-protoc-token(#29), the same chain as #28. Not merged. #27, #28 and #29 are not merged either.One difference to know: for a
protocfound onPATH,find_protoc_include_dirnow gets an absolute path, sopi-proto-buildalso passes-I<prefix>/include(the directory next tobin/, if it exists). It already did this for an absolutePROTOC. On CI the directory should exist (setup-protocunpacksbin/andinclude/), and theTUI CIrun of this PR builds the protos without error. The log does not print theprotocarguments, so it does not show that the flag was passed. On the WSL machine used below the directory does not exist, so that flag was not tested there.Evidence
WSL2,
protoc28.3 onPATH,PROTOCunset, build output in tmpfs,cargo check --locked -p pi-tools-api, nothing changed between the runs:pi-tools-apiis stale, rebuilt (2 s)Compiling pi-tools-api ...(2.2 s)Finishedonly (0.33 s)stale: missing "<repo>/tui/crates/codegen/pi-tools-api/protoc".Finished, and the fingerprint log has no line forpi-tools-api.pi.grok.tools.v1.rs) has the same sha256 before and after.cargo test -p pi-proto-build --lib: 10 passed (the 8 new and the 2 old tests).cargo fmt --checkandcargo clippy --all-targetsfor the package: clean.find_protoc.rswith only the new regression test fails:CI result, and a correction
TUI CI(run 39356795564) andCI(run 39356795545) passed on7a4ce9d: 8,490 passed / 0 failed / 21 ignored, and every suite equals its reference number. The commits after7a4ce9dchange docs only.The gain in CI is small:
Gates + cargo checkjob: compiles ofpi-tools-apiGates + cargo checkjob: timecargo testjob: compiles ofpi-tools-api/pi-shell/pi-pagercargo testjob: time"Before": the compile counts come from the run 39193752451; the times come from the three runs for #28.
The
cargo checkjob runs twocargocommands with the same packages, so it showed the loop: one compile less now. Thecargo testjob runs onecargocommand for each suite, and each command builds the dependencies with the features of its own packages. Sopi-tools-apiis compiled once in each of the 7 suites that use it, with or without this PR, and the same suites compilepi-shellandpi-pagerbefore and after.An earlier version of this description, the CHANGELOG entry and the execution log said that the 7 / 4 / 3 compiles were the loop. That was wrong, and the CI run of this PR shows it. The CHANGELOG entry and the execution log are corrected in
e2de4c4. The effect of this PR is on a developer's machine, where the same command runs again and again.Merge Danger
Door: two-way. One function in a build helper; revert it at any time.
Blast Radius: the build of
pi-tools-api(the only user ofpi-proto-build), and with it every crate above it, on Linux and macOS. Ifprotocwere in a place that the old check found and the new search does not, the build would fail at that crate. I know of no such place: on Linux and macOS,Command::newlooks in thePATHdirectories only, as the new search does. The TUI does not build on Windows.