HYBIM-804 Renaming galileo headers to splunk-ao#45
Conversation
This reverts commit 0a2289d6b3270c61137a1d1dee4a038927daf123.
10e22d6 to
af1867d
Compare
fercor-cisco
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-4-8). It may contain mistakes.
Verdict: request_changes — Lint violation (E402) introduced in test_api_headers.py will fail the ruff pre-commit hook; partial header rename also leaves source inconsistent and raises backend-compatibility questions.
General Comments
- 🟠 major (design): This rename is only partial. The hand-written request paths (traces.py, experiments.py) now send
Splunk-AO-SDK, but the generated client (src/galileo/resources/api/**, ~250 call sites) and the codegen template (codegen_templates/endpoint_module.py.jinja:75) still emitX-Galileo-SDK. As a result the SDK now sends two different header names depending on which endpoint is hit. Two questions worth resolving before merge: (1) Does the backend already acceptSplunk-AO-SDK? If it only recognizesX-Galileo-SDK, the renamed paths silently lose their SDK telemetry. (2) Is leaving the generated client on the old name intended for this PR, with the regeneration to follow separately? If so, please state that explicitly so reviewers know the inconsistency is temporary and tracked. - 🟡 minor (design): The distributed-tracing header rename (
X-Galileo-Trace-ID/X-Galileo-Parent-ID->Splunk-AO-Trace-ID/Splunk-AO-Parent-IDvia SPLUNK_AO_HEADER_PREFIX) is a wire-compatibility break across SDK versions. During a rolling deploy, an upstream service on the new SDK emitsSplunk-AO-Trace-IDwhile a downstream service still on the old SDK readsX-Galileo-Trace-ID(TracingMiddleware only looks up the new names), so trace context will be dropped at the boundary. If services are not upgraded atomically, please confirm this gap is acceptable or consider accepting both header names during a transition period.
Follow-ups
Suggested follow-up work that could be tracked as Shortcut stories:
codegen_templates/endpoint_module.py.jinja:75-75: Once the backend supportsSplunk-AO-SDK, update this codegen template (and regeneratesrc/galileo/resources/api/**) so the generated client emits the new header name and re-enable tests/test_api_headers.py. Tracking this completes the rename started in this PR.
There was a problem hiding this comment.
tests/test_api_headers.py:5-15 (line not in diff)
🟠 major (bug): Inserting import pytest + the pytestmark = ... assignment before the rest of the module imports makes lines 7–15 module-level imports that no longer sit at the top of the file. E4 is selected in [tool.ruff.lint] and tests/** per-file-ignores does not exempt E/E402, so ruff flags E402 on every import below the assignment. E402 is not auto-fixable, so the ruff pre-commit hook will fail for anyone committing with hooks installed. Move the pytestmark assignment below the imports (it does not need to precede them) so the imports stay at the top.
| """Tests for Splunk-AO-SDK header in API calls.""" | |
| from importlib.metadata import PackageNotFoundError | |
| from unittest.mock import patch | |
| import pytest | |
| from galileo.resources.api.datasets.get_dataset_datasets_dataset_id_get import _get_kwargs as dataset_get_kwargs | |
| from galileo.resources.api.health.healthcheck_healthcheck_get import _get_kwargs as healthcheck_get_kwargs | |
| from galileo.resources.api.projects import get_all_projects_projects_all_get | |
| from splunk_ao.project import Project | |
| from splunk_ao.projects import list_projects | |
| from splunk_ao.utils.headers_data import get_package_version | |
| pytestmark = pytest.mark.skip(reason="Header rename to Splunk-AO-SDK pending separate PR") |
🤖 Generated by Astra
There was a problem hiding this comment.
The description mentions that test_api_headers.py will be fixed separately.
|
Responses to Astra:
That is fine, we're doing this incrementally.
That is intentional. |
fercor-cisco
left a comment
There was a problem hiding this comment.
Approved but please fix test_api_headers.py. See the Astra suggestion above.
Thanks, here is the ticket for tracking this https://splunk.atlassian.net/browse/HYBIM-828 |
Summary
PARENT_ID_HEADER to resolve automatically to Splunk-AO-Trace-ID and Splunk-AO-Parent-ID