feat(cli): thread Config into the resume path - #203
Draft
ecalifornica wants to merge 1 commit into
Draft
Conversation
`resume` receives `&Config` from run() and passes it to the input resolver and the projectors. The transitional `Config::load()` calls in `run_with_strategy` and `resolve_input` are gone. - `cmd_resume::run`, `run_with_strategy`, and `resolve_input` take `&Config`. The Pathbase fetch calls `derive::pathbase_fetch_to_doc(config, …)`. - `Config` is public and `config` is a public module. `run_with_strategy` is the public entry point for `tests/resume.rs`, so its parameter type must be nameable there. The public items are `#[doc(hidden)]` and the fields stay crate-private; `Config::load` is the only constructor outside the crate. - The `$PATH` read for the harness binary lookup stays. A binary lookup is execution environment, not configuration. - The `project_into_harness` unit test injects a `Config` rooted at a tempdir. The `run_with_strategy` unit test does the same and keeps the `$PATH` guard. - The `resolve_input` unit tests inject a `Config`. The Pathbase fetch test needs no environment guard. The cache-hit test and the unresolvable-input test still set `$TOOLPATH_CONFIG_DIR`, because `cache.rs` reads it. - `ScopedHomeForResume` is deleted. The unit tests set no `$HOME`. - `ScopedHome::config` gives the integration tests the `Config` the CLI extracts at its composition root.
|
🔍 Preview deployed: https://cd40d0c2.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 10 of the plan there). Stacked on #202. path-cli only.
What
run()passes&Configtocmd_resume::run.run_with_strategytakes it and hands it toresolve_inputandproject_into_harness. Both transitionalConfig::load()calls incmd_resumeare gone.cmd_export::project_claudeand siblings) already take&Config, so the resolvers for every harness now come from the oneConfigextracted inrun().derive::pathbase_fetch_to_doc(config, …), so the credentials path and the server URL come from the sameConfig.Configis public andconfigis a public module.run_with_strategyis the public entry point thattests/resume.rsdrives with aRecordingExec, so the parameter type must be nameable from the test crate. Both items are#[doc(hidden)]: the type is a test seam, not API. The fields stay crate-private, soConfig::loadis the only constructor outside the crate.resolve_input:cache.rsresolves the document cache through the freeconfig_dir(), so a cache-id or Pathbase input still reads$TOOLPATH_CONFIG_DIRon that path. The cache PR owns it.Notes
$PATHreads incmd_resumestay (binary_on_path, used by the harness lookup and the cursor launcher check). A binary lookup is execution environment, not configuration, so$PATHis not aConfigfield.cmd_resumeis module-gated (#![cfg(not(target_os = "emscripten"))], plus the same gate on the module declaration and theResumearm), so the emscripten build is unaffected.Behavior change
run().Tests
project_into_harnessunit test injects aConfigrooted at a tempdir. It sets no$HOMEand takes noTEST_ENV_LOCK.run_with_strategyunit test injects the sameConfig. It keeps the$PATHguard and the lock, because$PATHis process-global state.resolve_inputunit tests inject aConfig. The Pathbase-fetch test needs no environment guard at all. The cache-hit test and the unresolvable-input test still set$TOOLPATH_CONFIG_DIR, becausecache.rsreads it.ScopedHomeForResumeis deleted. No unit test incmd_resumewrites$HOME.tests/resume.rskeepScopedHome: the cache path still reads$TOOLPATH_CONFIG_DIR. They passScopedHome::config(), theConfigthe CLI extracts at its composition root, loaded under the guard.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.