Skip to content

SRE-1049: Move the Brunch chat and runbook tests out of test:unit - #9643

Merged
TimDiekmann merged 4 commits into
t/sre-1048-record-in-task-dependenciesjson-which-packages-beyond-thefrom
claude/sre-1049-brunch-tests-integration-tier
Sep 10, 2026
Merged

SRE-1049: Move the Brunch chat and runbook tests out of test:unit#9643
TimDiekmann merged 4 commits into
t/sre-1048-record-in-task-dependenciesjson-which-packages-beyond-thefrom
claude/sre-1049-brunch-tests-integration-tier

Conversation

@claude

@claude claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Requested by Tim Diekmann · Slack thread

🌟 What is the purpose of this PR?

Before this change, @apps/brunch-agent ran two tests under test:unit that each spawn a child Node process, import the built application bundle from dist, and open a SQLite database: the Petrinaut chat test and the headless runbook test. Both take longer than vitest's default 5000 ms timeout, so both fail. The most recent failure is on #9636.

After it, four tests sit in test/integration: the two above plus prepared-workpiece.integration.test.ts, which spawns the same kind of child, and build-artifact.test.ts, which reads the emitted bundles off disk. Those were the only files under test:unit that needed the package's own build output, so build comes out of test:unit's dependsOn as well; codegen and ^build stay, because the workspace libraries this package imports export only built JavaScript. The integration config now sets a 60 s test timeout and a 120 s hook timeout, matching tests/hash-backend-integration, since the 5000 ms default is what these tests were failing on in the first place. vitest.config.ts keeps the default, so a unit test that grows a build dependency or a child process fails there rather than passing slowly.

🔗 Related links

🚫 Blocked by

  • Nothing.

🔍 What does this change?

  • Moves petrinaut-chat.test.ts and runbook-headless.test.ts into test/integration, with the *.integration.ts scripts they spawn and the result types the chat pair shares. vitest.integration.config.ts matches the two tests there, and vitest.config.ts already excludes that directory.
  • Adjusts the paths inside the moved files for the extra directory level: the run-node-script import, the imports of ../src, the monorepo root passed to the spawn helper, and the workpiece fixture the runbook script reads.
  • Declares test:integration in the package's turbo.json with the dependencies test:unit had been supplying, since both tests import dist/app.mjs and read two built workspace libraries.
  • Regenerates apps/brunch-agent/docs/task-dependencies.json, which now lists the same builds for test:integration as for test:unit.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • affected the execution graph, and the turbo.json's have been updated to reflect this
    • test:integration gains the app build and the workspace library builds; docs/task-dependencies.json is regenerated with turbo 2.10.12, the version pinned in .config/mise/config.toml

⚠️ Known issues

  • assets.test.ts stays a unit test. Its CI name mentions build outputs, but it drives the asset route over a directory it writes in tmpdir and never reads dist/.
  • Several documents under libs/@hashintel/brunch-agent/docs name the two tests at their old paths. They are mission records, so this PR leaves them alone.

🐾 Next steps

  • Nothing outstanding.

🛡 What tests cover this?

  • The two moved tests themselves. They now run under test:integration, which CI runs for every affected package, and @apps/brunch-agent has a test:integration script, so they keep running.

❓ How to test this?

  1. turbo run test:integration --filter @apps/brunch-agent and confirm all five test files in test/integration run and pass.
  2. turbo run test:unit --filter @apps/brunch-agent and confirm it runs 19 files, none of the four moved ones, and that it no longer builds the package first.

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Sep 10, 2026 1:44pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 10, 2026 1:44pm UTC
petrinaut Skipped Skipped Sep 10, 2026 1:44pm UTC
petrinaut-docs Skipped Skipped Sep 10, 2026 1:44pm UTC

Request Review

@github-actions github-actions Bot added area/tests New or updated tests area/apps labels Sep 10, 2026
Comment thread apps/brunch-agent/turbo.json Outdated
@claude
claude Bot force-pushed the claude/sre-1049-brunch-tests-integration-tier branch from 1c24f19 to 3a7f490 Compare September 10, 2026 11:14
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 10, 2026 11:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 10, 2026 11:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 10, 2026 11:17 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 10, 2026 11:17 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 10, 2026 11:23 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 10, 2026 11:23 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 10, 2026 11:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 10, 2026 11:26 Inactive
@claude
claude Bot marked this pull request as ready for review September 10, 2026 11:37
@claude
claude Bot requested a review from TimDiekmann September 10, 2026 11:37
@claude
claude Bot requested a review from a team as a code owner September 10, 2026 11:37
@cursor

cursor Bot commented Sep 10, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Test and Turbo task wiring only; no application runtime or API behavior changes.

Overview
Moves slow, build-dependent Brunch agent checks out of test:unit into test/integration, so unit runs stay fast and no longer hit Vitest’s default 5s timeout.

test:integration is wired in turbo.json with build, codegen, and ^build (same graph that used to gate unit tests that load dist). test:unit drops the app build dependency and only keeps codegen and ^build. docs/task-dependencies.json is regenerated to match.

Moved tests update paths for the extra directory level (../../src, monorepo root for spawned Node scripts, runbook fixture path). vitest.integration.config.ts sets 60s test and 120s hook timeouts, aligned with other integration suites.

Reviewed by Cursor Bugbot for commit 8603ff9. Bugbot is set up for automated code reviews on this repo. Configure here.

TimDiekmann
TimDiekmann previously approved these changes Sep 10, 2026
@TimDiekmann
TimDiekmann added this pull request to the merge queue Sep 10, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 10, 2026
@claude
claude Bot force-pushed the claude/sre-1049-brunch-tests-integration-tier branch from 1c8fdf8 to d8f9cef Compare September 10, 2026 12:41
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 10, 2026 12:41 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 10, 2026 12:41 Inactive
The Petrinaut chat test and the headless runbook test each spawn a child Node
process that imports the built application bundle and opens a SQLite database.
Both take longer than vitest's default 5000 ms timeout and fail under
`test:unit`.

Move them, the scripts they spawn, and the shared result types into
`test/integration`, where `vitest.integration.config.ts` picks them up and
`vitest.config.ts` already excludes them. Their assertions and their timeout are
unchanged.

`test:unit` was supplying the app build and the workspace library builds these
tests read, so give `test:integration` the same dependencies in the package's
`turbo.json` and regenerate `docs/task-dependencies.json`.
`@hashintel/brunch-agent` and `@hashintel/brunch-agent-plugin-sdcpn` are both
dependencies of `@apps/brunch-agent`, so `^build` already covers them. Naming
them again put each in the task graph twice.

`turbo run test:integration --dry=json` resolves to the same eight dependencies
and the same 83-task graph either way, and the regenerated
`docs/task-dependencies.json` is unchanged.
A unit test should not need a build step. Three of the package's tests did:
`prepared-workpiece.integration.test.ts` spawns a child process that imports
`dist/app.mjs`, and `build-artifact.test.ts` reads the emitted bundles off disk
and imports the built application.

Move those two, the child script the first one spawns, and the `run-node-script`
spawn helper, which now has no importer outside `test/integration`. Adjust the
depth-relative paths in each.

With nothing left in `test:unit` that reads `dist/`, drop `build` from its
`dependsOn`. `codegen` and `^build` stay: the workspace libraries this package
imports export only built JavaScript, so their builds are still required.

`assets.test.ts` stays a unit test. It drives the asset route over a directory
it writes in `tmpdir`, and never reads the build output.
`vitest.integration.config.ts` set no `testTimeout`, so the tests it runs had
vitest's 5000 ms default — the same limit they exceeded under `test:unit`. A
child-process boot that imports the built application measured 4525 ms on its
own, and the Petrinaut chat test boots one twice.

Use the values `tests/hash-backend-integration` uses: 60 s per test, 120 s per
hook. `vitest.config.ts` keeps the default, so unit tests stay fast by
construction.
@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) area/libs > antsi Affects the `antsi` crate (library) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright tests area/apps > hash-graph area/apps > hash.design Affects the `hash.design` design site (app) labels Sep 10, 2026
@claude
claude Bot force-pushed the claude/sre-1049-brunch-tests-integration-tier branch from d8f9cef to 8603ff9 Compare September 10, 2026 13:26
@vercel
vercel Bot temporarily deployed to Preview – petrinaut September 10, 2026 13:26 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs September 10, 2026 13:26 Inactive
@github-actions github-actions Bot removed area/apps > hash* Affects HASH (a `hash-*` app) area/infra Relates to version control, CI, CD or IaC (area) area/apps > hash-api Affects the HASH API (app) area/libs > error-stack Affects the `error-stack` crate (library) area/libs Relates to first-party libraries/crates/packages (area) area/libs > antsi Affects the `antsi` crate (library) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/tests > integration New or updated integration tests area/tests > playwright New or updated Playwright tests area/apps > hash-graph area/apps > hash.design Affects the `hash.design` design site (app) labels Sep 10, 2026
@TimDiekmann
TimDiekmann added this pull request to stack #9552 September 10, 2026 13:41
@TimDiekmann
TimDiekmann added this pull request to the merge queue Sep 10, 2026
Merged via the queue into main with commit f3751ae Sep 10, 2026
47 checks passed
@TimDiekmann
TimDiekmann deleted the claude/sre-1049-brunch-tests-integration-tier branch September 10, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/tests New or updated tests

Development

Successfully merging this pull request may close these issues.

2 participants