-
Notifications
You must be signed in to change notification settings - Fork 9
test(harness): shared test fakes + conformance determinism fix #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
246 changes: 0 additions & 246 deletions
246
docs/superpowers/plans/2026-06-18-unified-harness-surface-pr4-pydantic-ai.md
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| """Shared test doubles for the unified harness test suites. | ||
|
|
||
| A single superset implementation of the in-memory tracing backend used across | ||
| the harness tests. Three recording shapes were previously duplicated: | ||
|
|
||
| - Shape-1 (richest): ``started`` = ``(name, parent_id, input)`` 3-tuples, | ||
| ``ended`` = ``(name, output)`` 2-tuples, plus an ``ended_spans`` list of the | ||
| closed ``FakeSpan`` objects (which carry ``.name``, ``.output``, ``.data``). | ||
| - Shape-2: ``started`` = ``(name, parent_id)`` 2-tuples, ``ended`` = | ||
| ``(name, output)``. | ||
| - Shape-3: ``started`` = bare names, ``ended`` = bare outputs. | ||
|
|
||
| ``FakeTracing`` records the richest (shape-1) form and exposes read-only | ||
| convenience properties (``started_names``, ``started_pairs``, | ||
| ``ended_outputs``) so shape-2 and shape-3 assertions stay clean. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
|
|
||
| class FakeSpan: | ||
| def __init__(self, name: str) -> None: | ||
| self.name = name | ||
| self.output: Any = None | ||
| self.data: Any = None | ||
|
|
||
|
|
||
| class FakeTracing: | ||
| def __init__(self) -> None: | ||
| self.started: list[tuple[str, Any, Any]] = [] | ||
| self.ended: list[tuple[str, Any]] = [] | ||
| self.ended_spans: list[FakeSpan] = [] | ||
|
|
||
| async def start_span( | ||
| self, | ||
| *, | ||
| trace_id: str, | ||
| name: str, | ||
| input: Any = None, | ||
| parent_id: Any = None, | ||
| data: Any = None, | ||
| task_id: Any = None, | ||
| ) -> FakeSpan: | ||
| self.started.append((name, parent_id, input)) | ||
| return FakeSpan(name) | ||
|
|
||
| async def end_span(self, *, trace_id: str, span: FakeSpan) -> None: | ||
| self.ended.append((span.name, span.output)) | ||
| self.ended_spans.append(span) | ||
|
|
||
| @property | ||
| def started_names(self) -> list[str]: | ||
| return [name for (name, _parent, _input) in self.started] | ||
|
|
||
| @property | ||
| def started_pairs(self) -> list[tuple[str, Any]]: | ||
| return [(name, parent) for (name, parent, _input) in self.started] | ||
|
|
||
| @property | ||
| def ended_outputs(self) -> list[Any]: | ||
| return [output for (_name, output) in self.ended] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| """Conformance-suite test setup. | ||
|
|
||
| Eagerly import every per-harness conformance module so each one's module-level | ||
| ``register(...)`` calls run before any test executes. This makes | ||
| ``all_fixtures()`` complete and independent of pytest's collection/import order | ||
| (the runner documents that cross-module registration order is not guaranteed), | ||
| so the cross-harness ``test_span_derivation_is_deterministic`` guard in | ||
| ``test_conformance.py`` covers the full fixture set even when this directory is | ||
| run in isolation. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| # Importing these for their registration side effects only. | ||
| from . import ( | ||
| test_codex_conformance, # noqa: F401 | ||
| test_openai_conformance, # noqa: F401 | ||
| test_langgraph_conformance, # noqa: F401 | ||
| test_claude_code_conformance, # noqa: F401 | ||
| test_pydantic_ai_conformance, # noqa: F401 | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.