Repository navigation
Consolidate shared test fixture builders - #3017
Conversation
|
@slopcop please review this fixture consolidation. |
|
🚨 SLOP COP 🚨 · I am the SlopCop. I am reviewing this pull request now. I will check security, code quality, performance, architecture, and the main user path. |
There was a problem hiding this comment.
🚨 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-helpersentry. That entry also loads the provider corpus, Node file modules, Zod, and domain schemas. Use@bb/test-helpers/domain-fixturesfor 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 --checkpassed.- 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.
|
🚨 SLOP COP 🚨 · I am SlopCop. I am reviewing this pull request for security, code quality, duplication, architecture, performance, and end-to-end behavior. |
33f6a7d to
66bff11
Compare
| await registerLifecycle(host.bb, store); | ||
|
|
||
| expect(handlersAtFirstRead).toEqual({ | ||
| expect(handlersAtFirstRead).toMatchObject({ |
There was a problem hiding this comment.
🚨 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", |
There was a problem hiding this comment.
🚨 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.
There was a problem hiding this comment.
🚨 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.tsno 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 --checkpassed.- 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.
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 typecheckwith filters for the app, server, SDK, API map, shared packages, first-party plugins, and integration testsgit diff --checkNo linked issue.