Repository navigation
shell: the test of a model written from the home uses a home of its own - #819
Open
kitokey-sam[bot] wants to merge 2 commits into
Open
kitokey-sam[bot] wants to merge 2 commits into
kitokey-sam[bot] wants to merge 2 commits into
Conversation
a_model_written_from_home_is_named_where_it_went made a folder in the person's home, so it failed wherever the home is read-only and wrote there everywhere else. It now points HOME and XDG_* at a tempdir, in a test binary of its own (tests/migrate_home.rs): the environment belongs to the process, and every test of migrate.rs reads the home. Agent-Session: 92ded11e-58ef-492d-ba56-c820b9011de8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 14, 2026
Agent-Session: 92ded11e-58ef-492d-ba56-c820b9011de8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
shell: the test of a model written from the home uses a home of its own
Module
modules/shell— exactly one.cross-modulelabel is required, justification belowDeliverable
Out of cycle: the coordinator's GO from the 2026-11-13/14 retrospective (P2).
tests/migrate.rs'sa_model_written_from_home_is_named_where_it_wentcreated its folder in the person's real home (tempfile::tempdir_in(dirs::home_dir())).ReadOnlyFilesystem), so every shell PR carried « 1 failed, not mine ».What it changes
tests/migrate_home.rs, its own test binary. There it pointsHOMEandXDG_CONFIG_HOME,XDG_DATA_HOME,XDG_CACHE_HOME,XDG_STATE_HOMEat a tempdir, and checks thatdirs::home_dir()now answers that folder.migrate.rsreads the home.settings::from_homecallsdirs::home_dir()for every path. Setting it beside them would race, so it follows the practice oftests/licence.rs: one test sets the environment, in a file where no other test does.~/…/summit/models/a.bin; once carried over, Kitokey's settings name it underkitokey/models/, andmodel_namedis said.Oracle
origin/main(346ec4d), in the author's sandbox where$HOMEis read-only (touch ~/.w: « Read-only file system »),a_model_written_from_home_is_named_where_it_wentfailed withReadOnlyFilesystem, as in every shell run reported in D94 — shell: the tests read every sentence of words.rs against the voice guide #812 and D94 — shell: a settings file refused says which setting and what to do, in the user's language #813.cargo test --locked --test migrate --test migrate_home: 23 passed, then 1 passed.It still tests what it says. A mutant of
settings::from_homethat leaves~unexpanded ((Ok(_), Some(_)) => written, applied:git diff --numstat1 1, then restored) makes it fail atassert!(carried.model_named), at c4d3f08.Kind of oracle: unit tests.
Review budget
main: 70 (+49 −21):tests/migrate_home.rs+49,tests/migrate.rs−21Contracts
Definition of Done
cargo fmt --check,cargo clippy --locked --all-targets -- -D warningsclean at c4d3f08cargo test --locked --no-fail-fastat c4d3f08, 47 test binaries, 0 failed (the first full run with none failed in the author's sandbox)Test sheet
Verifier: session 14f73956-90b9-46a3-9fcc-52dc45c43948
a_model_written_from_home_is_named_where_it_wentpasses, and no test writes in the person's hometouch ~/.w819: « Read-only file system »):cargo test --locked --no-fail-fast, the shell's 47 test binaries all ok,migrate23 passed,migrate_home1 passed.migrate.rs's binary run withHOMEset to an empty folder: 23 passed, the folder still empty after. Both binaries run 20 times each, one after the other: 0 failures. A first full run had 7 ofsessions.rs's 12 fail with the shared tmpfs 80 % full; alone and in the full re-run with 19 % used, 12 of 12 pass: the environment, not this change.~/…), when it is carried over, then Kitokey's settings name it where it went, as before: afrom_homethat leaves~unexpanded makes the test failtimeout 600, each applied (git diff --numstat), the source restored after each: 4 killed —from_homeleaving~unexpanded ((Ok(_), Some(_)) => written): fails atmigrate_home.rs:44,carried.model_named;~expanded to/: fails at :44; the test no longer settingHOME(theXDG_*still set): fails at :26,left: Some("/home/f"), the person's home; the same with that assert removed too: fails at :42, the model not found in the person's home, and nothing written there.Verifier's remarks: No race. Cargo runs the test binaries one after another, and
migrate_homeholds one test, so itsset_varmeets no other test. It followslicence.rs,start.rsandsummarising.rs, which set the environment the same way. A detail that changes nothing: the test pointsXDG_DATA_HOMEat<home>/XDG_DATA_HOME, while Summit's data sits at<home>/.local/share.Placesis given whole, so noXDG_*is read; they only keep a stray read away from the person's folders. The e2e is the coordinator's, after #817. Ground: as on #811, agit clone --shareddetached at c4d3f08, its build inmodules/shell/target/verify-819of this session's own repository, removed at the end.Summary
DONE
a_model_written_from_home_is_named_where_it_wentruns in its own binary, withHOMEandXDG_*pointed at a tempdir; it no longer touches the person's home.VERIFIED
migrate.rs23 passed, and the whole suite has 0 failed. fmt and clippy are clean.from_homemutant above is killed.ASSUMED
dirs::home_dir()reads$HOMEon Linux and macOS. The test asserts it, so a platform where it does not would fail on that assertion, not silently.NOT VERIFIED
dirs::home_dir()asks the system, notHOME, and the assertion would fail. The shell's CI runs Linux. If a Windows job runs this binary, the test needs#[cfg(unix)].RISKS
🤖 Generated with Claude Code