HYBIM-952 Rename .galileo dir - #221
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-5). It may contain mistakes.
Verdict: request_changes — The rename works, but the directory name deviates from the one specified in HYBIM-952 (.splunk-ao) without explanation, the new annotation fails the repo's ruff config, the added validator duplicates the inherited one, and nothing locks the new default in with a test.
@fercor-cisco 's note: ignore this comment about the directory name, .splunk is correct.
General Comments
- 🟡 minor (testing): No test locks in the new default. The sibling rename (HYBIM-918) added
test_config_filename_defaultplustest_config_file_path_resolves_to_splunk_ao_configintests/test_config.py; this PR adds nothing equivalent, so a future edit to the default (or an accidental loss of the field override when rebasing onto a newgalileo-core) silently reverts users to~/.galileowith no CI signal.
Suggested additions to tests/test_config.py:
def test_home_dir_default_is_dot_splunk() -> None:
# Assert against Path.home() rather than a monkeypatched HOME: the default is
# evaluated at import time, so patching HOME in the test has no effect.
assert SplunkAOConfig.model_fields["home_dir"].default == Path.home() / ".splunk"
def test_set_home_dir_creates_missing_directory(tmp_path) -> None:
target = tmp_path / "nested" / ".splunk"
assert SplunkAOConfig.set_home_dir(target) == target
assert target.is_dir()
def test_set_home_dir_rejects_non_directory(tmp_path) -> None:
a_file = tmp_path / "not-a-dir"
a_file.touch()
with pytest.raises(ValueError):
SplunkAOConfig.set_home_dir(a_file)- 🔵 nit (documentation): The PR description states "
.galileocreation will also exist from the parent GalileoConfig". I could not reproduce that: overridinghome_dirinSplunkAOConfigreplaces the parent field entirely, andgalileo_coreis the only installed package referencinghome_dir— no otherGalileoConfigsubclass is instantiated by this SDK. Running config construction withHOMEpointed at an empty temp dir produces only.splunk, never.galileo.
That's the better outcome (no orphan directory), and the README text is correct as written — but the description should be corrected so reviewers/future readers don't believe both directories are created. If the intent was to cover the case where the legacy galileo SDK is co-installed, say that explicitly.
Follow-ups
Suggested follow-up work that could be tracked as Jira tickets:
src/splunk_ao/config.py:75-80:home_dir's default is evaluated at import time (Path.home() / ".splunk"), inherited from galileo-core's pattern. This makes the default insensitive toHOMEchanges after import, which is awkward for tests and for embedders that setHOMElate. Adefault_factory=lambda: Path.home() / ".splunk"would resolve it lazily at instantiation.splunk-ao-migration-tool/README.md:283-285: TheGALILEO_HOME_DIR→SPLUNK_AO_HOME_DIRrow has the same property that earnedGALILEO_API_URLfootnote 1: it was never a documented user-facing variable in galileo-python, just an implicit Pydantic settings field on galileo-core'sGalileoConfigthat becomes an effective rename via_bridge_env_vars(). Consider tagging the new row with footnote 1 as well, so the two implicit-field rows are documented consistently.
|
@fercor-cisco also resolved general comments/follow-up |
|
🟡 minor (testing): Would you rather fold one more test into this PR, or track it as a follow-up? It's a single test function, no The gap: dropping the I measured what that costs by deleting two pairs from
The four parametrized cases (two keys × That's the inverse of the risk the old mirror had (mirror drift is loud on additions, silent on removals; deriving from _EXPECTED_BRIDGE_PAIRS = {
("SPLUNK_AO_API_KEY", "GALILEO_API_KEY"),
("SPLUNK_AO_API_URL", "GALILEO_API_URL"),
("SPLUNK_AO_CONSOLE_URL", "GALILEO_CONSOLE_URL"),
("SPLUNK_AO_PROJECT", "GALILEO_PROJECT"),
("SPLUNK_AO_PROJECT_ID", "GALILEO_PROJECT_ID"),
("SPLUNK_AO_AGENT_STREAM", "GALILEO_LOG_STREAM"),
("SPLUNK_AO_LOG_STREAM", "GALILEO_LOG_STREAM"), # deprecated alias
("SPLUNK_AO_AGENT_STREAM_ID", "GALILEO_LOG_STREAM_ID"),
("SPLUNK_AO_LOG_STREAM_ID", "GALILEO_LOG_STREAM_ID"), # deprecated alias
("SPLUNK_AO_JWT_TOKEN", "GALILEO_JWT_TOKEN"),
("SPLUNK_AO_SSO_ID_TOKEN", "GALILEO_SSO_ID_TOKEN"),
("SPLUNK_AO_SSO_PROVIDER", "GALILEO_SSO_PROVIDER"),
("SPLUNK_AO_USERNAME", "GALILEO_USERNAME"),
("SPLUNK_AO_PASSWORD", "GALILEO_PASSWORD"),
("SPLUNK_AO_MODE", "GALILEO_MODE"),
("SPLUNK_AO_HOME_DIR", "GALILEO_HOME_DIR"),
}
def test_bridge_pairs_match_expected_set() -> None:
"""Independent statement of the bridge contract: a pair added or removed in
config.py must be reflected here deliberately, not absorbed silently."""
assert set(_BRIDGE) == _EXPECTED_BRIDGE_PAIRSA weaker version ( |
Overridden directory to
.splunkinSplunkAOConfig..galileo directory will not be created anymore, only .splunk dir will be created.
Tested with: