feat(cli): thread Config through the document cache - #204
Draft
ecalifornica wants to merge 1 commit into
Draft
Conversation
Every `cache.rs` function takes `&Config` and resolves the documents directory through `Config::config_dir`. The cache reads no environment variable. - `cache_dir`, `cache_path`, `write_cached`, `cache_ref`, `list_cached`, and `remove_cached` take `&Config` as their first parameter. `make_id` and `pathbase_cache_id` are pure and unchanged. - Every call site passes the `&Config` it already holds. `cmd_export`'s `load_path_doc` and its three session builders take `&Config`; `query::run`, `stream_files`, and `select_files` take one; `sync::engine::is_unchanged` takes one. - `p derive` still loads a transitional `Config` and hands it to `cmd_import`. The cleanup PR owns that load. - The free `config_dir()` in `config.rs` had no caller left, so it is deleted along with the test that drove it. - The `cache.rs` unit tests inject a `Config` rooted at a tempdir. They set no environment variable and take no `TEST_ENV_LOCK`.
|
🔍 Preview deployed: https://8e21b149.toolpath.pages.dev |
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.
Part of #184 (PR 11 of the plan there). Stacked on #203 (branch
robert/config-resume). The cleanup PR stacks on this one. path-cli only.What
cache.rsfunction takes&Configas its first parameter and resolvesthe documents directory through
Config::config_dir:cache_dir,cache_path,write_cached,cache_ref,list_cached,remove_cached.make_idandpathbase_cache_idare pure string functions. They areunchanged.
cache.rsreads no environment variable.&Configit already holds. Three helperfunctions gain a
&Configto carry it to the cache:cmd_export::load_path_doc, plusbuild_gemini_conversation,build_pi_session, andbuild_codex_session.query::run,query::stream_files, andquery::select_files.sync::engine::is_unchanged.cmd_cache::run_lstakes the&Configthatcmd_cache::runalreadyreceives.
config_dir()inconfig.rshad no caller left, so it is deletedalong with the unit test that drove it.
Config::config_diris the onlyconfig-directory resolution in the crate.
p derivestill loads a transitionalConfigand hands it tocmd_import.The cleanup PR owns that load.
cache.rscompiles on every target, and so does the&Configthreading in
cmd_cache; onlypathbase_cache_idkeeps its existing#[cfg(not(target_os = "emscripten"))]gate.Behavior change
$TOOLPATH_CONFIG_DIR/documents, fallingback to
~/.toolpath/documents. The value is read once, inrun().Tests
cache.rsunit tests inject aConfigrooted at a tempdir. Thehelper is
config_in_tempdir, which returns theConfigand itsTempDir.The tests set no environment variable and take no
TEST_ENV_LOCK, so they donot serialize against the rest of the suite. The 2
make_idtests need noConfig.query'sselect_files_input_only_skips_cachepassesConfig::default().That
Confighas no config directory, so it strengthens the assertion: aninput-only scope that read the cache would error.
sync::engine'swith_cfgkeeps its$TOOLPATH_CONFIG_DIRwrite. Thecleanup PR owns it.
cmd_resumeunit tests and thetests/resume.rsintegration tests keeptheir
$TOOLPATH_CONFIG_DIRscaffolding. The cleanup PR owns it.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.