Skip to content

test(shared): add golden transcript fixtures#401

Merged
DeliciousBuding merged 4 commits into
dev/delicious233from
task/382-golden-transcript-fixtures
Jun 28, 2026
Merged

test(shared): add golden transcript fixtures#401
DeliciousBuding merged 4 commits into
dev/delicious233from
task/382-golden-transcript-fixtures

Conversation

@DeliciousBuding

@DeliciousBuding DeliciousBuding commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #382.

Adds a shared golden mixed-source transcript fixture for the Phase 2 chat-flow contract:

  • Hub user message + Hub runtime replay events in one reusable fixture
  • deterministic full/main transcript block ID expectations
  • inspector-only block IDs for run session, subagent detail, and route decision
  • shared Vitest golden coverage for ordering, main-transcript filtering, and ChatView adapter tool result pairing
  • Web chat-flow Playwright now consumes the shared fixture instead of keeping a separate inline replay dataset

Evidence Boundary

  • evidence_level: fixture-unit + playwright-ui
  • real_tested=false
  • Web Playwright uses stubbed Hub responses; this does not prove real Hub login, real model/API execution, packaged Desktop, installer, signing, or release behavior.

Verification

  • corepack pnpm --dir app/shared exec vitest run src/transcript/goldenTranscriptFixtures.test.ts
  • corepack pnpm --dir app/shared exec vitest run src/transcript/goldenTranscriptFixtures.test.ts src/chatview/pipeline-integration.test.ts src/transcript/normalizeHubRuntimeEvents.test.ts
  • corepack pnpm --dir app/shared test (92 files, 794 tests)
  • corepack pnpm --dir app/shared exec tsc --noEmit --pretty false --target ES2021 --module ESNext --moduleResolution bundler --jsx react-jsx --strict --noUncheckedIndexedAccess --exactOptionalPropertyTypes false --esModuleInterop --skipLibCheck --types vitest/globals src/transcript/goldenTranscriptFixtures.ts src/transcript/goldenTranscriptFixtures.test.ts
  • corepack pnpm --dir app/web typecheck
  • corepack pnpm --dir app/web test:e2e:chat-flow (2 passed)
  • git diff --check
  • pwsh ./scripts/verify/verify-doc-ssot.ps1
  • pwsh ./scripts/verify/verify-project-skills.ps1
  • pwsh ./scripts/verify/verify-real-e2e-contract.ps1

Known unrelated broad gate:

  • corepack pnpm --dir app/shared lint still fails on pre-existing Storybook/test type debt (@storybook/*, ImportMeta.env, older test typing issues). The new fixture files pass the targeted tsc command above.

Summary by CodeRabbit

  • New Features
    • Added shared “golden mixed-source” transcript fixtures for mixed-source chat sessions, supporting both full and main transcript views.
  • Bug Fixes
    • Improved deterministic, normalized transcript block ordering and consistent rendering across transcript/tool results/replay text.
    • Excluded inspector-only blocks from the main transcript view.
  • Tests
    • Updated end-to-end and contract tests to use the golden mixed-source dataset and validate transcript section ordering and visibility.
  • Documentation
    • Refreshed Phase 2 progress tracking notes for related work.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d192e8d1-181e-43dc-9b01-4d7140c8c273

📥 Commits

Reviewing files that changed from the base of the PR and between 1daa467 and ad3bf72.

📒 Files selected for processing (1)
  • docs/progress/MASTER.md
✅ Files skipped from review due to trivial changes (1)
  • docs/progress/MASTER.md

📝 Walkthrough

Walkthrough

Adds shared golden mixed-source transcript fixtures, Vitest coverage for transcript ordering and adapter output, an e2e chat-flow contract update to consume the fixtures, and a progress-tracker note for T2.1.

Changes

Golden Mixed-Source Transcript Fixtures

Layer / File(s) Summary
Fixture data and barrel export
app/shared/src/transcript/goldenTranscriptFixtures.ts, app/shared/src/transcript/index.ts
Exports golden session/task/run ID constants, goldenMixedSourceHubMessages, goldenMixedSourceHubRuntimeEvents, three block ID lists, and resolveGoldenMixedSourceTranscript / resolveGoldenMixedSourceMainTranscript; all are re-exported from the transcript barrel.
Vitest golden tests
app/shared/src/transcript/goldenTranscriptFixtures.test.ts
Verifies full transcript block ordering, inspector-only block exclusion from the main transcript, and ChatView item mapping with tool/result ordering and bubble content.
E2E spec updated to consume golden fixtures
app/web/src/__e2e__/chat-flow-contract.spec.ts
Replaces hardcoded session/task IDs, message arrays, and event arrays with golden mixed-source constants; updates kickoff and replay-summary assertions.
Progress tracker update
docs/progress/MASTER.md
Updates T2.1 status, next steps, and session log entries for PR #401.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • #385: Shares transcript filtering/rendering behavior by excluding inspector-style blocks from the main transcript and validating what reaches ChatView and E2E assertions.

Poem

🐇 Hop, hop—our golden transcript gleams,
Mixed-source pieces lined up in neat streams.
Inspector bits stay out of the main view,
And the chat flow replays with fixtures true.

🚥 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 is concise and accurately describes the main change: adding shared golden transcript fixtures.
Linked Issues check ✅ Passed The PR adds shared mixed-source fixtures, deterministic ordering tests, inspector-only filtering, and Web E2E reuse required by #382.
Out of Scope Changes check ✅ Passed The changes stay focused on the fixture, related tests, and task tracking, with no unrelated feature work evident.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/382-golden-transcript-fixtures

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

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
app/web/src/__e2e__/chat-flow-contract.spec.ts (1)

49-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the asserted transcript text from the shared fixture instead of duplicating literals.

The spec already imports the golden message/event fixtures, but it still hard-codes the kickoff and replay-summary text in three places. Pull those expected strings from the shared fixtures once so wording changes only land in one source of truth. As per coding guidelines, **/*.{ts,tsx,js,jsx}: Do not write tests that merely replicate implementation branches, assert constant strings, hard-code error text as behavior, or mock the function under test itself.

Also applies to: 70-73, 108-108

🤖 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 `@app/web/src/__e2e__/chat-flow-contract.spec.ts` around lines 49 - 50, The
transcript assertions in the chat-flow contract spec are hard-coding kickoff and
replay-summary text instead of deriving them from the shared fixtures. Update
the assertions in the relevant test blocks to read the expected strings from the
imported golden message/event fixtures once, and reuse those fixture-derived
values everywhere the text is checked. Use the existing fixture imports in
chat-flow-contract.spec.ts as the single source of truth so wording changes only
need to be made in one place.

Source: Coding guidelines

app/shared/src/transcript/index.ts (1)

7-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the golden fixtures out of the main transcript barrel.

These exports make test-only fixtures/resolvers part of the shared transcript public API. Importing goldenTranscriptFixtures directly from tests/E2E keeps the production barrel smaller and avoids accidental runtime coupling to golden data.

🤖 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 `@app/shared/src/transcript/index.ts` around lines 7 - 18, The shared
transcript barrel currently re-exports test-only golden fixtures and resolvers
from goldenTranscriptFixtures, which should not be part of the public API.
Remove those exports from the main transcript index and keep the golden data
accessible only via direct imports from goldenTranscriptFixtures in tests/E2E;
verify any callers that rely on resolveGoldenMixedSourceTranscript,
resolveGoldenMixedSourceMainTranscript, or the GOLDEN_MIXED_SOURCE_* constants
are updated accordingly.
🤖 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 `@app/shared/src/transcript/index.ts`:
- Around line 7-18: The shared transcript barrel currently re-exports test-only
golden fixtures and resolvers from goldenTranscriptFixtures, which should not be
part of the public API. Remove those exports from the main transcript index and
keep the golden data accessible only via direct imports from
goldenTranscriptFixtures in tests/E2E; verify any callers that rely on
resolveGoldenMixedSourceTranscript, resolveGoldenMixedSourceMainTranscript, or
the GOLDEN_MIXED_SOURCE_* constants are updated accordingly.

In `@app/web/src/__e2e__/chat-flow-contract.spec.ts`:
- Around line 49-50: The transcript assertions in the chat-flow contract spec
are hard-coding kickoff and replay-summary text instead of deriving them from
the shared fixtures. Update the assertions in the relevant test blocks to read
the expected strings from the imported golden message/event fixtures once, and
reuse those fixture-derived values everywhere the text is checked. Use the
existing fixture imports in chat-flow-contract.spec.ts as the single source of
truth so wording changes only need to be made in one place.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: abfb3004-a52c-444b-88e4-6bca3f857fde

📥 Commits

Reviewing files that changed from the base of the PR and between 4b2a1dd and c8dfb55.

📒 Files selected for processing (5)
  • app/shared/src/transcript/goldenTranscriptFixtures.test.ts
  • app/shared/src/transcript/goldenTranscriptFixtures.ts
  • app/shared/src/transcript/index.ts
  • app/web/src/__e2e__/chat-flow-contract.spec.ts
  • docs/progress/MASTER.md

@DeliciousBuding DeliciousBuding merged commit 79f3ac8 into dev/delicious233 Jun 28, 2026
17 checks passed
@DeliciousBuding DeliciousBuding deleted the task/382-golden-transcript-fixtures branch June 28, 2026 15:05
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.

1 participant