diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d156b..2cd4f30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Breaking Changes +- **Config file renamed**: The on-disk credentials file written to + `~/.galileo/` has been renamed from `galileo-python-config.json` to + `splunk-ao-config.json`. Users with an existing saved config must either rename + the file manually or delete it and re-authenticate. - **`monitor_progress()` `job_id` parameter removed** (HYBIM-931): The deprecated `job_id` keyword argument of `Experiment.monitor_progress()` has been fully removed. Callers passing `job_id=` must remove that argument. diff --git a/splunk-ao-migration-tool/README.md b/splunk-ao-migration-tool/README.md index c972e23..f900a54 100644 --- a/splunk-ao-migration-tool/README.md +++ b/splunk-ao-migration-tool/README.md @@ -340,6 +340,16 @@ The `GalileoScorers` enum has been removed entirely. Migrate to `SplunkAOEvaluat + scorer = SplunkAOEvaluators.completeness ``` +### 5.3 On-Disk Config File Renamed + +The SDK credentials file written to `~/.galileo/` has been renamed: + +| Old | New | +|-----|-----| +| `~/.galileo/galileo-python-config.json` | `~/.galileo/splunk-ao-config.json` | + +If you have saved credentials on disk, either rename the file manually or delete it and re-authenticate by running your code once. + --- ## 6. HTTP Tracing Headers @@ -422,13 +432,13 @@ The following are **unchanged** between galileo and splunk-ao and require no mig - Optional extra names (`[langchain]`, `[openai]`, `[otel]`, `[all]`, etc.) - `TracingMiddleware` class name - `OPENAI_API_KEY` environment variable -- On-disk config file name: `galileo-python-config.json` - Default console/API URLs (`https://app.galileo.ai/`, `https://api.galileo.ai/`) --- ## 9. Migration Checklist +- [ ] Rename on-disk config file: `~/.galileo/galileo-python-config.json` → `~/.galileo/splunk-ao-config.json` (or delete it and re-authenticate) - [ ] Update Python to **≥ 3.11** - [ ] Replace `galileo` with `splunk-ao` in `requirements.txt` / `pyproject.toml` - [ ] Add `grpcio>=1.80.0,<2.0.0` if using the `otel` extra (or use `splunk-ao[otel]`) diff --git a/src/splunk_ao/config.py b/src/splunk_ao/config.py index 58cf391..bf00281 100644 --- a/src/splunk_ao/config.py +++ b/src/splunk_ao/config.py @@ -71,7 +71,7 @@ class SplunkAOConfig(GalileoConfig): """Configure authentication and endpoints for standalone and O11y deployments.""" # Config file for this project. - config_filename: str = "galileo-python-config.json" + config_filename: str = "splunk-ao-config.json" console_url: Url = DEFAULT_CONSOLE_URL _instance: ClassVar[Optional["SplunkAOConfig"]] = None diff --git a/tests/test_config.py b/tests/test_config.py index 34834e1..c465fee 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,5 @@ import os +from pathlib import Path from unittest.mock import MagicMock, patch import pytest @@ -80,9 +81,7 @@ def test_bridge_env_vars_propagates_splunk_ao_to_galileo(splunk_key, galileo_key with patch.dict(os.environ, {splunk_key: value}, clear=False): os.environ.pop(galileo_key, None) SplunkAOConfig._bridge_env_vars() - assert os.environ.get(galileo_key) == value, ( - f"Expected {galileo_key}={value!r} after bridging {splunk_key}" - ) + assert os.environ.get(galileo_key) == value, f"Expected {galileo_key}={value!r} after bridging {splunk_key}" @pytest.mark.parametrize("splunk_key,galileo_key", _CANONICAL_BRIDGE_PAIRS) @@ -106,9 +105,7 @@ def test_bridge_env_vars_skips_absent_splunk_ao_keys() -> None: with patch.dict(os.environ, clean_env, clear=True): SplunkAOConfig._bridge_env_vars() for _, galileo_key in _ALL_BRIDGE_PAIRS: - assert galileo_key not in os.environ, ( - f"{galileo_key} must not be set when its SPLUNK_AO_* source is absent" - ) + assert galileo_key not in os.environ, f"{galileo_key} must not be set when its SPLUNK_AO_* source is absent" # --------------------------------------------------------------------------- @@ -276,8 +273,7 @@ def test_reset_clears_bridged_galileo_env_vars() -> None: for galileo_key in galileo_keys: assert galileo_key not in os.environ, ( - f"reset() must remove {galileo_key} from os.environ; " - f"found stale value '{os.environ.get(galileo_key)}'" + f"reset() must remove {galileo_key} from os.environ; found stale value '{os.environ.get(galileo_key)}'" ) @@ -311,8 +307,7 @@ def test_bridge_picks_up_new_credential_after_reset(monkeypatch) -> None: # Second bridge — must pick up the new key now that reset() cleared the old one. SplunkAOConfig._bridge_env_vars() assert os.environ.get("GALILEO_API_KEY") == "key-rotated", ( - "After reset() + credential rotation, bridge must copy the new key; " - "got stale value instead" + "After reset() + credential rotation, bridge must copy the new key; got stale value instead" ) # Cleanup: monkeypatch will restore SPLUNK_AO_API_KEY, but the bridge wrote # GALILEO_API_KEY directly to os.environ — remove it so it doesn't leak. @@ -341,3 +336,24 @@ def test_reset_removes_all_bridgeable_galileo_vars() -> None: f"reset() is expected to remove {galileo_key} " f"(bridge owns all GALILEO_* keys; no SDK consumer sets them directly)" ) + + +def test_config_filename_default() -> None: + assert SplunkAOConfig.model_fields["config_filename"].default == "splunk-ao-config.json" + + +def test_config_file_path_resolves_to_splunk_ao_config() -> None: + """An instantiated config resolves its on-disk path to splunk-ao-config.json. + + Complements test_config_filename_default (which only checks the declared + field default) by exercising the runtime `config_file` property that + galileo-core actually reads from and writes to on disk. model_construct + applies field defaults while skipping the network-calling validators that a + full SplunkAOConfig(...) instantiation would trigger. + """ + home_dir = Path("/tmp/splunk-ao-config-test") + config = SplunkAOConfig.model_construct(home_dir=home_dir) + + assert config.config_filename == "splunk-ao-config.json" + assert config.config_file == home_dir / "splunk-ao-config.json" + assert config.config_file.name == "splunk-ao-config.json"