Skip to content

Guard _assert_error_span_extras against duplicate span names#231

Merged
chris-colinsky merged 1 commit into
mainfrom
chore/0082-review-fix-span-guard
Jul 23, 2026
Merged

Guard _assert_error_span_extras against duplicate span names#231
chris-colinsky merged 1 commit into
mainfrom
chore/0082-review-fix-span-guard

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

Follow-up to #230. The CoPilot review thread on #230 was resolved with this guard, but it landed after the squash-merge, so main didn't carry it yet.

_assert_error_span_extras (the fixture-124 span-tree extras checker) picked candidates[0] for a given span name. Fixture 124 is single-attempt, so each span name is unique and this is correct today; but a future fixture with multiple same-named spans (e.g. call-level retry producing several openarmature.llm.complete spans) could silently assert against the wrong one. This asserts exactly one candidate so that case fails loudly here, rather than duplicating _assert_span_tree_matches's full name+attribute disambiguation (the helper runs after that structural walker anyway).

Test-only, no behavior change. Fixture 124 stays green.

Address CoPilot review on #230 (the guard landed after the squash-merge).
_assert_error_span_extras picked candidates[0] for a span name; with a
single-attempt fixture (124) names are unique, but a future fixture with
multiple same-named spans (e.g. call-level retry) could silently assert
the wrong span. Assert exactly one candidate so that case fails loudly
here instead, rather than duplicating _assert_span_tree_matches's full
name+attribute disambiguation.

Test-only; no behavior change.
Copilot AI review requested due to automatic review settings July 23, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the conformance test helper _assert_error_span_extras (used by observability fixture 124) to fail loudly when a span name matches more than one finished span, avoiding accidental assertions against the wrong span if future fixtures produce repeated same-named spans (for example, due to retries).

Changes:

  • Add an explicit len(candidates) == 1 assertion before selecting candidates[0] in _assert_error_span_extras.

@chris-colinsky
chris-colinsky merged commit fceaa9f into main Jul 23, 2026
6 checks passed
@chris-colinsky
chris-colinsky deleted the chore/0082-review-fix-span-guard branch July 23, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants