Skip to content

Consolidate shared test fixture builders - #3017

Merged
ymichael merged 3 commits into
mainfrom
bb/consolidate-test-fixture-builders-thr_vdikwi8kb9
Sep 3, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/consolidate-test-fixture-builders-thr_vdikwi8kb9

Conversation

@ymichael

@ymichael ymichael commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Behavioral tests repeatedly constructed complete SDK, domain, and app response objects. Required contract additions therefore caused widespread unrelated fixture churn, while local pass-through builders obscured which values were meaningful to each scenario.

What changed

Added deterministic typed domain factories to @bb/test-helpers, public context factories to @get-bb/plugin-sdk/testing, and focused app and Tasks fixture modules. Migrated first-party behavioral tests and stories to shared factories or small scenario wrappers, while leaving schema, migration, serialization, command-output, provider, and exact-shape lifecycle fixtures explicit. The Tasks lifecycle assertion now checks only listener registrations relevant to its behavior.

The public Plugin SDK documentation, built-in plugin-authoring references, and SDK API inventory were updated. There are no host-daemon wire changes, protocol-version changes, CLI changes, or environment-provider concepts in this PR.

How you verified

  • pnpm exec turbo run typecheck with filters for the app, server, SDK, API map, shared packages, first-party plugins, and integration tests
  • Targeted Turbo tests across client-core, core-ui, Plugin SDK, API map, ask-user-question, concurrency-limit, keep-awake, Tasks, and workflows: 1,237 tests passed
  • Full app Turbo suite: 3,848 passed and 4 skipped
  • Targeted server tests: 6 passed
  • Targeted integration tests: 3 passed
  • Plugin SDK type build, API inventory regeneration, and Plugin Guide build
  • git diff --check

No linked issue.

AGENT GENERATED

@ymichael

ymichael commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop please review this fixture consolidation.

@bb-slop-cop

bb-slop-cop Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am the SlopCop. I am reviewing this pull request now.

I will check security, code quality, performance, architecture, and the main user path.

Comment thread packages/test-helpers/src/index.ts Resolved

@bb-slop-cop bb-slop-cop 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.

🚨 SLOP COP 🚨 · review

Plain English summary: This PR replaces many copied test objects with shared builder functions. It changes test support and stories. It does not intend to change product behavior.

I found two issues.

  • Medium: makeMessageDispatchHookContext() can create a queued message for a different thread. The builder should inherit the merged thread ID. It also needs a direct test.
  • Medium: Most new app imports use the broad @bb/test-helpers entry. That entry also loads the provider corpus, Node file modules, Zod, and domain schemas. Use @bb/test-helpers/domain-fixtures for domain fixtures.

The architecture is otherwise sound. The new builders remove substantial duplicate setup. A full search found no stale imports for the removed fixtures. The remaining local builders support distinct scenarios or boundary formats.

I found no security issues. The change adds no production data path, network call, process execution, credential path, or unsafe render path.

Validation passed:

  • All 17 affected Turbo test tasks passed. The app passed 3,852 tests, and the server passed 2,194 tests.
  • All affected Turbo type checks passed.
  • git diff --check passed.
  • Doobie loaded the main route and the Settings route from the local dev server.
  • All current GitHub checks passed.
  • A GPT-5.6 final review confirmed both findings and found no additional issues.

@ymichael

ymichael commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop please re-review the fixes in 33f6a7d.

@bb-slop-cop

bb-slop-cop Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am SlopCop. I am reviewing this pull request for security, code quality, duplication, architecture, performance, and end-to-end behavior.

@ymichael
ymichael force-pushed the bb/consolidate-test-fixture-builders-thr_vdikwi8kb9 branch from 33f6a7d to 66bff11 Compare September 3, 2026 21:06
await registerLifecycle(host.bb, store);

expect(handlersAtFirstRead).toEqual({
expect(handlersAtFirstRead).toMatchObject({

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.

🚨 slopcop/review — The test no longer rejects extra event listeners.

toMatchObject allows an unwanted message, interaction, archive, or turn listener. Such listeners can read more event data and add callback work.

Please compare the positive listener counts with the five expected listeners. This keeps new zero-count SDK events from breaking the test.

): ThreadListEntry {
const entry: ThreadListEntry = {
...makeThreadWithRuntime({
id: "thr_sender",

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.

🚨 slopcop/review — The generic factory has sender-specific defaults.

thr_sender and Sender thread came from the deleted sender fixture. They hide one app scenario inside a shared cross-package factory.

Please use neutral defaults such as thr_test and Test thread. A local sender wrapper can add sender-specific values.

@bb-slop-cop bb-slop-cop 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.

🚨 SLOP COP 🚨 · review

Plain English summary: This pull request replaces many copied test objects with shared builders. It changes test support and stories, not product behavior.

I found one blocking test gap and one small factory design issue.

  • P2: plugins/tasks/lifecycle/lifecycle.test.ts no longer rejects extra active event listeners. This can hide extra data access and callback work.
  • P3: makeThreadListEntry() uses sender-specific identity values. A generic shared factory should use neutral values.

The consolidation is otherwise sound. It removes substantial duplicate setup and keeps boundary-format tests explicit.

Two unchanged tests still duplicate complete fixtures. PluginPanelRightPanelHost.test.tsx has two terminal sessions. ThreadDetailSecondaryContent.test.tsx has a thread builder and an unsafe cast.

Security: I found no production security regression. The listener-test gap can hide future expansion of event-data access.

Performance: I found no current production regression. The new SDK fixtures only enter the testing bundle.

Validation results:

  • All current GitHub checks passed after one unchanged test passed its automatic retry.
  • The same unchanged test passed locally.
  • The Plugin SDK suite passed all 225 tests.
  • The related Turbo type checks passed.
  • git diff --check passed.
  • The development app started successfully.
  • Doobie loaded the app, General settings, and Providers settings without application errors.
  • Three GPT-5.6 agents reviewed security, quality, architecture, duplication, and performance.
  • A final GPT-5.6 review gate confirmed the findings.

I used a comment-only review. I did not approve the pull request or request changes.

@ymichael
ymichael merged commit 43e3fc5 into main Sep 3, 2026
14 of 15 checks passed
@ymichael
ymichael deleted the bb/consolidate-test-fixture-builders-thr_vdikwi8kb9 branch September 3, 2026 21:12
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