Skip to content

HYBIM-804 Renaming galileo headers to splunk-ao#45

Merged
shuningc merged 5 commits into
mainfrom
HYBIM-804-renameHeader2SplunkAO
Jun 27, 2026
Merged

HYBIM-804 Renaming galileo headers to splunk-ao#45
shuningc merged 5 commits into
mainfrom
HYBIM-804-renameHeader2SplunkAO

Conversation

@shuningc

@shuningc shuningc commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Rename the HTTP header prefix constant from "X-Galileo" to "Splunk-AO" in constants/init.py, causing TRACE_ID_HEADER and
    PARENT_ID_HEADER to resolve automatically to Splunk-AO-Trace-ID and Splunk-AO-Parent-ID
  • Replace hardcoded "X-Galileo-SDK" header strings with "Splunk-AO-SDK" in traces.py and experiments.py
  • Update all docstrings, comments, and test assertions that referenced the old X-Galileo-* header names
  • Disable test-api-headers.py for the pipeline to pass, will re-enable it after it is fixed

@shuningc
shuningc marked this pull request as draft June 25, 2026 05:47
@shuningc
shuningc force-pushed the HYBIM-804-renameHeader2SplunkAO branch from 10e22d6 to af1867d Compare June 26, 2026 21:41
@shuningc
shuningc marked this pull request as ready for review June 26, 2026 21:43

@fercor-cisco fercor-cisco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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 emit X-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 accept Splunk-AO-SDK? If it only recognizes X-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-ID via SPLUNK_AO_HEADER_PREFIX) is a wire-compatibility break across SDK versions. During a rolling deploy, an upstream service on the new SDK emits Splunk-AO-Trace-ID while a downstream service still on the old SDK reads X-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 supports Splunk-AO-SDK, update this codegen template (and regenerate src/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.

Comment thread tests/test_api_headers.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"""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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description mentions that test_api_headers.py will be fixed separately.

@fercor-cisco

fercor-cisco commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Responses to Astra:

This rename is only partial.

That is fine, we're doing this incrementally.

wire-compatibility break across SDK versions

That is intentional.

@fercor-cisco fercor-cisco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but please fix test_api_headers.py. See the Astra suggestion above.

@shuningc

Copy link
Copy Markdown
Contributor Author

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

@shuningc
shuningc merged commit ff9c72a into main Jun 27, 2026
13 checks passed
@shuningc
shuningc deleted the HYBIM-804-renameHeader2SplunkAO branch June 27, 2026 01:39
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants