Skip to content

chore(intake): Deprecate intake ingest experiment_context#618

Merged
shanaiabuggy merged 2 commits into
mainfrom
sbuggy/ase-514
Jul 9, 2026
Merged

chore(intake): Deprecate intake ingest experiment_context#618
shanaiabuggy merged 2 commits into
mainfrom
sbuggy/ase-514

Conversation

@shanaiabuggy

@shanaiabuggy shanaiabuggy commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • Ingest model trimmed — EvaluationContext is now {evaluation_id, test_case_id} with extra="ignore", evaluation_context is canonical, experiment_context deprecated.
  • Old sha/run_id/metadata span-attribute path fully removed — catalog, semantic attributes, bags, read model, and filter params.
  • Note: SDK was regenerated because old filters were removed

Summary by CodeRabbit

  • New Features

    • Standardized ingest and span evaluation identity around a single evaluation_context shape.
    • Added/clarified evaluation_id and test_case_id support across evaluation-related ingest requests and span records.
  • Bug Fixes

    • experiment_context is deprecated and treated as a fallback; evaluation_context takes priority when both are provided.
    • Legacy evaluation fields (evaluation_sha, evaluation_run_id, and metadata-style extras) are no longer returned or used for span filtering, reducing inconsistent results.
  • Documentation

    • Updated CLI option/help text to reflect the canonical evaluation_context behavior and retired-field handling.

@shanaiabuggy
shanaiabuggy requested review from a team as code owners July 8, 2026 23:57
@github-actions github-actions Bot added the chore label Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Standardizes evaluation identity on evaluation_context/evaluation_id, deprecates experiment_context, and removes legacy evaluation_sha, evaluation_run_id, and metadata fields across OpenAPI, intake ingest code, span schemas, CLI filters, and tests.

Changes

Evaluation identity canonicalization

Layer / File(s) Summary
OpenAPI contract updates
openapi/ga/individual/platform.openapi.yaml, openapi/ga/openapi.yaml, openapi/openapi.yaml
AtifIngestRequest and ChatCompletionsIngestRequest now prefer evaluation_context; EvaluationContext is reshaped to evaluation_id and test_case_id; ExperimentContext is marked deprecated; SpanEvaluationContext and SpanFilter drop legacy fields.
EvaluationContext model and validation rewrite
services/intake/src/nmp/intake/spans/ingest/evaluation_context.py, services/intake/src/nmp/intake/spans/ingest/evaluation_context_validation.py
Canonical and deprecated context models are redefined, ingest wrapper precedence flips to evaluation_context, and validation now accepts only EvaluationContext.
Ingest request wiring
services/intake/src/nmp/intake/spans/ingest/atif.py, services/intake/src/nmp/intake/spans/ingest/atif_mapping.py, services/intake/src/nmp/intake/spans/ingest/chat_completions.py
ATIF and chat-completions ingest switch to the new ingest model and validation function, and span attribute mapping stops writing retired evaluation fields and metadata.
Span schema and attribute cleanup
services/intake/src/nmp/intake/spans/api/spans.py, services/intake/src/nmp/intake/spans/api/spans_schemas.py, services/intake/src/nmp/intake/spans/span_attribute_bags.py, services/intake/src/nmp/intake/spans/span_attribute_catalog.py, services/intake/src/nmp/intake/spans/span_semantic_attributes.py
Span filters and evaluation-context schemas drop legacy fields, span semantic attributes and attribute catalog remove SHA/run-id entries, and raw-attribute handling no longer exposes retired metadata.
CLI option updates
packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/ingest/atif.py, packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/ingest/chat_completions.py, packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/spans/__init__.py, packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/spans/groups.py
Ingest CLI help text is updated for evaluation_context and experiment_context, and span/group listing commands remove legacy evaluation-run-id and evaluation-sha filters.
Test updates
services/intake/tests/integration/spans/*, services/intake/tests/test_atif_v17.py, services/intake/tests/test_spans_schemas.py
ATIF, chat-completions, span read, and span schema tests now expect trimmed evaluation_context shapes, removed legacy attributes, and ignored retired fields.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: deprecating intake ingest experiment_context in favor of evaluation_context.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sbuggy/ase-514

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
services/intake/src/nmp/intake/spans/span_attribute_bags.py (1)

102-122: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep nemo.experiment.metadata excluded from raw_attributes_json. KNOWN_BAG_KEYS doesn’t cover it, so legacy rows that still carry this string key will surface it in raw_attributes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/intake/src/nmp/intake/spans/span_attribute_bags.py` around lines 102
- 122, Keep nemo.experiment.metadata excluded from raw_attributes_json by
updating SpanAttributeBags.raw_attributes_json to skip that legacy string key
alongside atif.raw and KNOWN_BAG_KEYS. Make sure the string-attribute loop
explicitly filters out nemo.experiment.metadata so it never gets added to the
raw dict, while preserving the existing behavior for other string, number, and
boolean attributes.
♻️ Duplicate comments (1)
openapi/openapi.yaml (1)

17830-17857: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

TraceFilter still uses experiment_id/test_case_id, not evaluation_id.

Same gap as Trace above — filter parameters weren't updated to the canonical evaluation identity naming.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi/openapi.yaml` around lines 17830 - 17857, Update the TraceFilter
schema to use the canonical evaluation identity naming instead of the legacy
experiment fields. In the TraceFilter object, replace the experiment_id and
test_case_id filter properties with evaluation_id and the matching evaluation
test case identifier used elsewhere in the API, and keep the descriptions/title
metadata aligned with the new names. Verify the change against the Trace schema
and any related filter/schema definitions so the naming is consistent across the
OpenAPI spec.
🧹 Nitpick comments (1)
services/intake/src/nmp/intake/spans/ingest/evaluation_context_validation.py (1)

37-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

ExperimentContext branch looks dead now.

Both call sites (atif.py, chat_completions.py) pass body.resolved_evaluation_context(), which always returns EvaluationContext | None. The isinstance(context, ExperimentContext) branch and the wider EvaluationContext | ExperimentContext union on validate_evaluation_context appear unreachable in practice.

♻️ Optional simplification
-async def validate_evaluation_context(
-    *,
-    workspace: str,
-    context: EvaluationContext | ExperimentContext | None,
-    entity_client: EntityClient,
-) -> None:
+async def validate_evaluation_context(
+    *,
+    workspace: str,
+    context: EvaluationContext | None,
+    entity_client: EntityClient,
+) -> None:
     if context is None:
         return
-    experiment_id = _evaluation_id(context)
+    experiment_id = context.evaluation_id
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/intake/src/nmp/intake/spans/ingest/evaluation_context_validation.py`
around lines 37 - 40, The `ExperimentContext` path in `_evaluation_id` is
effectively unreachable because `validate_evaluation_context` is only called
with `body.resolved_evaluation_context()` from `atif.py` and
`chat_completions.py`, which yields `EvaluationContext | None`. Simplify
`evaluation_context_validation.py` by removing the `ExperimentContext` branch
from `_evaluation_id` and narrowing the
`validate_evaluation_context`/`_evaluation_id` type annotations to
`EvaluationContext | None`, keeping the logic aligned with the actual call
sites.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@services/intake/src/nmp/intake/spans/span_attribute_bags.py`:
- Around line 102-122: Keep nemo.experiment.metadata excluded from
raw_attributes_json by updating SpanAttributeBags.raw_attributes_json to skip
that legacy string key alongside atif.raw and KNOWN_BAG_KEYS. Make sure the
string-attribute loop explicitly filters out nemo.experiment.metadata so it
never gets added to the raw dict, while preserving the existing behavior for
other string, number, and boolean attributes.

---

Duplicate comments:
In `@openapi/openapi.yaml`:
- Around line 17830-17857: Update the TraceFilter schema to use the canonical
evaluation identity naming instead of the legacy experiment fields. In the
TraceFilter object, replace the experiment_id and test_case_id filter properties
with evaluation_id and the matching evaluation test case identifier used
elsewhere in the API, and keep the descriptions/title metadata aligned with the
new names. Verify the change against the Trace schema and any related
filter/schema definitions so the naming is consistent across the OpenAPI spec.

---

Nitpick comments:
In
`@services/intake/src/nmp/intake/spans/ingest/evaluation_context_validation.py`:
- Around line 37-40: The `ExperimentContext` path in `_evaluation_id` is
effectively unreachable because `validate_evaluation_context` is only called
with `body.resolved_evaluation_context()` from `atif.py` and
`chat_completions.py`, which yields `EvaluationContext | None`. Simplify
`evaluation_context_validation.py` by removing the `ExperimentContext` branch
from `_evaluation_id` and narrowing the
`validate_evaluation_context`/`_evaluation_id` type annotations to
`EvaluationContext | None`, keeping the logic aligned with the actual call
sites.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6dab1e02-3970-4840-b560-7a2485e73424

📥 Commits

Reviewing files that changed from the base of the PR and between acb05ae and 8ec658e.

⛔ Files ignored due to path filters (21)
  • sdk/python/nemo-platform/.nmpcontext/openapi.yaml is excluded by !sdk/**
  • sdk/python/nemo-platform/pyproject.toml is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/cli/commands/api/intake/ingest/atif.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/cli/commands/api/intake/ingest/chat_completions.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/cli/commands/api/intake/spans/__init__.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/cli/commands/api/intake/spans/groups.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/resources/intake/ingest/atif.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/resources/intake/ingest/chat_completions.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/evaluation_context_param.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/experiment_context.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/experiment_context_param.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/ingest/atif_create_params.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/ingest/chat_completion_create_params.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/span_evaluation_context.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/span_filter_param.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/types/intake/trace.py is excluded by !sdk/**
  • sdk/python/nemo-platform/tests/api_resources/intake/ingest/test_atif.py is excluded by !sdk/**
  • sdk/python/nemo-platform/tests/api_resources/intake/ingest/test_chat_completions.py is excluded by !sdk/**
  • sdk/python/nemo-platform/tests/api_resources/intake/spans/test_groups.py is excluded by !sdk/**
  • sdk/python/nemo-platform/tests/api_resources/intake/test_spans.py is excluded by !sdk/**
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • openapi/ga/individual/platform.openapi.yaml
  • openapi/ga/openapi.yaml
  • openapi/openapi.yaml
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/ingest/atif.py
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/ingest/chat_completions.py
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/spans/__init__.py
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/spans/groups.py
  • services/intake/src/nmp/intake/spans/api/spans.py
  • services/intake/src/nmp/intake/spans/api/spans_schemas.py
  • services/intake/src/nmp/intake/spans/ingest/atif.py
  • services/intake/src/nmp/intake/spans/ingest/atif_mapping.py
  • services/intake/src/nmp/intake/spans/ingest/chat_completions.py
  • services/intake/src/nmp/intake/spans/ingest/evaluation_context.py
  • services/intake/src/nmp/intake/spans/ingest/evaluation_context_validation.py
  • services/intake/src/nmp/intake/spans/span_attribute_bags.py
  • services/intake/src/nmp/intake/spans/span_attribute_catalog.py
  • services/intake/src/nmp/intake/spans/span_semantic_attributes.py
  • services/intake/tests/integration/spans/test_atif_ingest.py
  • services/intake/tests/integration/spans/test_chat_completions_ingest.py
  • services/intake/tests/integration/spans/test_traces_read.py
  • services/intake/tests/test_atif_v17.py
  • services/intake/tests/test_spans_schemas.py
💤 Files with no reviewable changes (7)
  • services/intake/src/nmp/intake/spans/span_semantic_attributes.py
  • services/intake/src/nmp/intake/spans/api/spans.py
  • services/intake/tests/integration/spans/test_traces_read.py
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/spans/groups.py
  • services/intake/src/nmp/intake/spans/ingest/atif_mapping.py
  • packages/nemo_platform_ext/src/nemo_platform_ext/cli/commands/api/intake/spans/init.py
  • services/intake/src/nmp/intake/spans/span_attribute_catalog.py

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 23427/30608 76.5% 61.3%
Integration Tests 13692/29288 46.8% 19.8%

…adata key excluded

- test_chat_completions_ingest: evaluation_context now takes precedence over
  the deprecated experiment_context, so the created entity lives in
  evaluation_context and experiment_context points at a non-existent ref to
  prove it is ignored (fixes the failing integration test).
- span_attribute_bags: keep excluding the retired nemo.experiment.metadata key
  from raw_attributes so legacy rows that still carry it don't leak it, and
  restore the regression coverage in test_spans_schemas (CodeRabbit).
- evaluation_context_validation: drop the now-dead ExperimentContext branch;
  resolved_evaluation_context() always yields EvaluationContext | None
  (CodeRabbit).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: shanaiabuggy <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
services/intake/src/nmp/intake/spans/span_attribute_bags.py (1)

109-115: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract retired key to a named constant.

"nemo.experiment.metadata" is hardcoded twice (pop + string exclusion set). A single module-level constant would avoid drift if the retired key needs updating again.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@services/intake/src/nmp/intake/spans/span_attribute_bags.py` around lines 109
- 115, Extract the retired span bag key into a single module-level constant and
use it in both places in SpanAttributeBags so the value doesn’t drift. Update
the parsed_atif_raw.pop call and the string exclusion check in the same class to
reference that shared constant instead of hardcoding "nemo.experiment.metadata"
twice. Keep the constant near the other bag key definitions so future
retirements are easy to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@services/intake/src/nmp/intake/spans/span_attribute_bags.py`:
- Around line 109-115: Extract the retired span bag key into a single
module-level constant and use it in both places in SpanAttributeBags so the
value doesn’t drift. Update the parsed_atif_raw.pop call and the string
exclusion check in the same class to reference that shared constant instead of
hardcoding "nemo.experiment.metadata" twice. Keep the constant near the other
bag key definitions so future retirements are easy to update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e9d50190-04b6-49c2-9d4a-2b9da450aabd

📥 Commits

Reviewing files that changed from the base of the PR and between 8ec658e and 91a1acd.

📒 Files selected for processing (4)
  • services/intake/src/nmp/intake/spans/ingest/evaluation_context_validation.py
  • services/intake/src/nmp/intake/spans/span_attribute_bags.py
  • services/intake/tests/integration/spans/test_chat_completions_ingest.py
  • services/intake/tests/test_spans_schemas.py

@shanaiabuggy
shanaiabuggy added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit 0c00d34 Jul 9, 2026
55 checks passed
@shanaiabuggy
shanaiabuggy deleted the sbuggy/ase-514 branch July 9, 2026 21:20
walston added a commit that referenced this pull request Jul 10, 2026
The intake ingest experiment_context deprecation (#618) removed
evaluation_run_id, evaluation_sha, and metadata from the generated
SpanEvaluationContext type. Update the evaluation context helpers and
test fixture to the new shape.

Signed-off-by: Nathan Walston <[email protected]>
walston added a commit that referenced this pull request Jul 10, 2026
The intake ingest experiment_context deprecation (#618) removed
evaluation_run_id, evaluation_sha, and metadata from the generated
SpanEvaluationContext type. Update the evaluation context helpers and
test fixture to the new shape.

Signed-off-by: Nathan Walston <[email protected]>
walston added a commit that referenced this pull request Jul 10, 2026
The intake ingest experiment_context deprecation (#618) removed
evaluation_run_id, evaluation_sha, and metadata from the generated
SpanEvaluationContext type. Update the evaluation context helpers and
test fixture to the new shape.

Signed-off-by: Nathan Walston <[email protected]>
walston added a commit that referenced this pull request Jul 13, 2026
The intake ingest experiment_context deprecation (#618) removed
evaluation_run_id, evaluation_sha, and metadata from the generated
SpanEvaluationContext type. Update the evaluation context helpers and
test fixture to the new shape.

Signed-off-by: Nathan Walston <[email protected]>
walston added a commit that referenced this pull request Jul 15, 2026
The intake ingest experiment_context deprecation (#618) removed
evaluation_run_id, evaluation_sha, and metadata from the generated
SpanEvaluationContext type. Update the evaluation context helpers and
test fixture to the new shape.

Signed-off-by: Nathan Walston <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants