-
Notifications
You must be signed in to change notification settings - Fork 9
Read the host's source registry file, not an invented path #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
YellowSnnowmann
merged 3 commits into
tinyhumansai:main
from
YellowSnnowmann:fix/5820-module-registry-path
Aug 27, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| //! Tests for the surrounding module: the config-path resolution the engine | ||
| //! provider is built from (openhuman#5820). | ||
|
|
||
| use super::host_config_path; | ||
| use crate::ModuleConfig; | ||
|
|
||
| fn config_with( | ||
| workspace_dir: &std::path::Path, | ||
| config_path: Option<std::path::PathBuf>, | ||
| ) -> ModuleConfig { | ||
| let mut config: ModuleConfig = | ||
| serde_json::from_value(serde_json::json!({ "workspace_dir": workspace_dir })) | ||
| .expect("a workspace alone deserializes"); | ||
| config.config_path = config_path; | ||
| config | ||
| } | ||
|
|
||
| /// What the host sends wins, whether or not the file exists yet — the host | ||
| /// is about to write it. | ||
| #[test] | ||
| fn an_explicit_host_path_is_taken_verbatim() { | ||
| let config = config_with( | ||
| std::path::Path::new("/w/workspace"), | ||
| Some("/elsewhere/config.toml".into()), | ||
| ); | ||
| assert_eq!( | ||
| host_config_path(&config), | ||
| std::path::PathBuf::from("/elsewhere/config.toml") | ||
| ); | ||
| } | ||
|
|
||
| /// An older host sends nothing; the registry file beside `workspace/` is the | ||
| /// documented layout, so it is used when it exists. | ||
| #[test] | ||
| fn an_old_host_falls_back_to_the_file_beside_the_workspace() { | ||
| let root = tempfile::tempdir().expect("tempdir"); | ||
| let workspace = root.path().join("workspace"); | ||
| std::fs::create_dir_all(&workspace).unwrap(); | ||
| std::fs::write(root.path().join("config.toml"), "[[memory_sources]]\n").unwrap(); | ||
|
|
||
| let config = config_with(&workspace, None); | ||
| assert_eq!(host_config_path(&config), root.path().join("config.toml")); | ||
| } | ||
|
|
||
| /// With neither, the historical path stands — behaviour unchanged for a host | ||
| /// that never had a registry file at all. | ||
| #[test] | ||
| fn with_no_candidate_the_historical_path_is_kept() { | ||
| let root = tempfile::tempdir().expect("tempdir"); | ||
| let workspace = root.path().join("workspace"); | ||
| let config = config_with(&workspace, None); | ||
| assert_eq!(host_config_path(&config), workspace.join("config.toml")); | ||
| } |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.