Skip to content

test: add representative coding-agent evidence fixture - #258

Open
harshitethic wants to merge 8 commits into
Siddhant-K-code:mainfrom
harshitethic:test/representative-evidence-fixture
Open

harshitethic wants to merge 8 commits into
Siddhant-K-code:mainfrom
harshitethic:test/representative-evidence-fixture

Conversation

@harshitethic

Copy link
Copy Markdown

Summary

Adds a versioned, synthetic representative session fixture as a reusable regression input for #250.

Scenario covered

The fixture contains:

  • explicit session start/end
  • a redacted user prompt
  • file read and write events
  • a shell test command that fails
  • an error linked to the failed call
  • a retry linked to the first attempt
  • a successful recovery result
  • an agent decision
  • a human correction annotation
  • one deliberately orphaned tool result representing a known capture gap
  • a final assistant response

Artifacts

  • tests/fixtures/representative_session/events.ndjson — canonical TraceEvent input
  • tests/fixtures/representative_session/annotations.jsonl — human review overlay
  • tests/fixtures/representative_session/expected.json — deterministic IDs/count/gap expectations
  • tests/test_representative_fixture.py — schema + scenario regression coverage
  • docs/representative-fixture.md — trust boundary and refresh procedure

Why the gap is intentional

The fixture includes an orphaned tool result on purpose. Review UI/evidence-health work must surface missing relationships instead of inventing a parent and presenting a falsely complete timeline.

Scope

This is a focused foundation for #250 rather than a claim to close every consumer listed there. Follow-up PRs can wire the same fixture into evidence health, share/export, OTLP mapping, and the local review UI without each subsystem inventing different sample data.

Validation

The test parses the fixture through the repository's own TraceEvent.from_json() and Annotation.from_json() models and asserts the required failure/retry/recovery, redaction, annotation, relationship, and intentional-gap invariants.

I could not execute the suite locally because the connected development machine is offline; upstream CI is the verification gate for this branch.

Refs #250.

{"event_type":"file_read","timestamp":1789300802.0,"event_id":"ev-read","session_id":"fixture-review-001","data":{"path":"src/example.py","source":"repository"}}
{"event_type":"tool_call","timestamp":1789300803.0,"event_id":"tool-test-1","session_id":"fixture-review-001","data":{"tool":"shell","command":"python -m pytest -q tests/test_example.py"}}
{"event_type":"tool_result","timestamp":1789300804.0,"event_id":"result-test-1","session_id":"fixture-review-001","parent_id":"tool-test-1","duration_ms":620.0,"data":{"exit_code":1,"output":"1 failed"}}
{"event_type":"error","timestamp":1789300804.1,"event_id":"ev-error","session_id":"fixture-review-001","parent_id":"tool-test-1","data":{"message":"example test failed","recoverable":true}}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

result-test-1 and this ERROR are both terminal children of tool-test-1. The evidence-health core in #256 classifies the fixture as partial with duplicate_tool_outcome, in addition to the intended orphan gap. Current hook capture also emits one terminal ERROR for a failed tool call, not both events. Model the failure with one terminal event, or declare and assert this second defect explicitly.


def test_fixture_uses_one_session_and_expected_count(self):
self.assertEqual(len(self.events), self.expected["expected_event_count"])
self.assertEqual({event.session_id for event in self.events}, {self.expected["session_id"]})

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

expected.json declares both provider and fixture_version, but the tests never assert either value against the session-start event. Removing or changing the source attribution/version therefore leaves CI green. Assert both fields here so the versioned fixture contract cannot drift silently.

@harshitethic

Copy link
Copy Markdown
Author

Addressed both fixture review points: removed the duplicate result-test-1 so the failed tool call has just one terminal ERROR, updated the expected event count, and added assertions tying expected provider and fixture_version to the session-start event, plus an explicit single-terminal-outcome regression. Focused validation: PYTHONPATH=src python3 -m unittest discover -s tests -p test_representative_fixture.py -v — 7 passed; git diff --check passed. AI-assisted edits (ChatGPT GPT-6).

This branch has not been deployed

No deployments
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