Skip to content

SRE-1010: Move Brunch architecture checks out of core unit tests - #9625

Open
lunelson wants to merge 13 commits into
mainfrom
ln/sre-1010-move-brunch-checks
Open

SRE-1010: Move Brunch architecture checks out of core unit tests#9625
lunelson wants to merge 13 commits into
mainfrom
ln/sre-1010-move-brunch-checks

Conversation

@lunelson

@lunelson lunelson commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

  • ln/sre-1010-move-brunch-checks 👈
  • main

Stack generated by Git Town

🌟 What is the purpose of this PR?

Remove Brunch architecture source walkers from unit tests and put each surviving contract at its native enforcement point. Authored import boundaries remain in package-local Oxlint configuration, manifest boundaries remain in Yarn constraints, and behavioral tests prove emitted behavior.

This removes the reverse libs → apps task relationship introduced by the SRE-1007 hotfix without replacing it with another cross-workspace scanner. Core and app unit-test tasks now own only files and behavior inside their packages.

🔗 Related links

🚫 Blocked by

None.

🔍 What does this change?

  • Deletes family-wide Vitest checks that scanned source files and mirrored package metadata, import rules, schema allowlists, filenames, task scripts, and reviewer-maintained inventories.
  • Removes the temporary architecture-test workspace and the subsequent repo-chores checker/CI task; no parallel static-policy surface remains.
  • Deletes the app-local source walker. Agent registration remains covered by the emitted-bundle test, now using ChatAgent.agentName directly instead of rediscovering agents with a filesystem regex.
  • Keeps existing package-local Oxlint import restrictions and the Yarn transport-boundary constraint as the native static enforcement.
  • Moves the Linear graph utility into core, where its tests use static imports and never skip based on checkout shape.
  • Deletes the open-gaps stderr ledger and its shape tests, which tracked review state through Vitest rather than proving behavior.
  • Removes app, sibling-package, and context-root inputs from core unit tests and removes the corresponding prune exceptions.
🏗️ Agent notes

Inductive diagnosis

The review comments were a sample of one larger defect pattern: static policy had accumulated as filesystem-scanning unit tests. Those tests duplicated source code, package manifests, linter rules, file layout, and review decisions, then required custom ignore behavior and cross-workspace task inputs to remain runnable.

The rework applies one ownership rule:

authored import policy → package-local Oxlint
manifest policy → Yarn constraints
emitted/runtime behavior → behavioral tests
source or review mirrors with no independent oracle → delete

Mission contract

Imperative. Remove static-policy source walkers from Brunch unit tests and let existing enforcement mechanisms own the contracts they can actually prove.

Proof.

  1. Core has no app, sibling-package, or context-root unit-test inputs and a core prune adds no downstream Brunch workspaces.
  2. Package-local Oxlint and Yarn constraints pass; their existing policies remain unchanged.
  3. The app build and emitted-bundle test prove the chat agent is registered under its source-of-truth identity.
  4. The Linear graph tests use a normal static import from core and run unconditionally.
  5. Searches find no architecture checker workspace, repo-chores checker, custom source walker, open-gap test ledger, or skip-on-file-existence guard.

Constraints.

  • Do not duplicate Oxlint or Yarn policy in tests or repo-chores.
  • Keep behavioral tests that can fail while source and manifests remain unchanged.
  • Do not replace hard-coded mirrors with a new checker abstraction.

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

⚠️ Known issues

None known.

🐾 Next steps

The reviewer identified similar pre-existing tautological assertions in core naming and authored-skill tests. They are non-blocking for SRE-1010 and are intentionally left for a separate product-test cleanup.

🛡 What tests cover this?

  • @hashintel/brunch-agent: 10 files and 94 tests; build, lint, and typecheck pass.
  • @apps/brunch-agent: 23 files and 166 tests; build, lint, and typecheck pass.
  • Emitted-bundle suite: 10 behavioral assertions pass.
  • Linear graph suite: 10 tests pass through a static core import.
  • Prune repository fixtures: 8 tests pass.
  • Yarn constraints, immutable install, task-dependency generation, and repository formatting pass.

❓ How to test this?

  1. Run yarn install --immutable && yarn constraints.
  2. Run yarn workspace @hashintel/brunch-agent build, lint:tsc, lint:eslint, and test:unit.
  3. Run yarn workspace @apps/brunch-agent build, lint:tsc, lint:eslint, and test:unit.
  4. Run python3 .github/actions/prune-repository/prune_test.py.
  5. Inspect yarn exec turbo run test:unit --filter @hashintel/brunch-agent --dry=json and confirm no app, sibling-package, or context-root Brunch inputs.

📹 Demo

Not applicable — this changes static-policy ownership and CI task selection only.

lunelson and others added 2 commits September 9, 2026 13:31
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI balanced review requested due to automatic review settings September 9, 2026 11:39
@lunelson
lunelson requested a review from a team as a code owner September 9, 2026 11:39
@vercel

vercel Bot commented Sep 9, 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 9, 2026 3:39pm UTC
hashdotdesign-tokens Ready Ready Preview Sep 9, 2026 3:39pm UTC
petrinaut Ready Ready Preview Sep 9, 2026 3:39pm UTC
petrinaut-docs Ready Ready Preview Sep 9, 2026 3:39pm UTC

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/tests New or updated tests area/apps labels Sep 9, 2026
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Dropping large architecture test coverage shifts boundary enforcement to lint/constraints and may miss regressions until those tools fire; voice metadata rollback uses new concurrent-state logic in the AI assistant panel.

Overview
Removes Brunch’s filesystem-based architecture Vitest suites and tightens CI prune/Turbo so @hashintel/brunch-agent unit tests no longer depend on the app, sibling plugins, or the whole context root. Import/manifest policy stays on Oxlint and Yarn constraints; agent registration is checked only via the emitted bundle using ChatAgent.agentName. The Linear project graph script moves into core with unconditional static-import tests; the open-gaps ledger and several plugin build/task dependencies are dropped.

Separately, Petrinaut’s voice tool-output path gets getVoiceToolCallIds and per-message submission tracking so rejected overlapping voice answers roll back provenance without restoring failed siblings or wiping concurrent metadata updates.

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

@lunelson
lunelson deployed to pull-request September 9, 2026 11:40 — with GitHub Actions Active
@lunelson
lunelson deployed to pull-request September 9, 2026 11:40 — with GitHub Actions Active
@lunelson lunelson changed the title ln/sre 1010 move brunch checks SRE-1010: Move Brunch architecture checks out of core unit tests Sep 9, 2026

@TimDiekmann TimDiekmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a description and a title to the PR please?

TimDiekmann
TimDiekmann previously approved these changes Sep 9, 2026

@TimDiekmann TimDiekmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Infra ✅

Comment thread apps/brunch-agent/test/architecture/app-workspace.ts Fixed

Copilot AI 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.

🟡 Changes recommended

Critical test skipping and an incomplete CI dependency guard must be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Moves Brunch architecture checks into a dedicated test workspace while retaining app-specific checks locally.

Changes:

  • Adds @tests/brunch-agent-architecture.
  • Narrows app/core test inputs and prune exceptions.
  • Relocates architecture helpers and regression tests.
  • Contains unresolved critical and moderate CI coverage issues.
File summaries
File Description
yarn.lock Registers the new test workspace.
tests/brunch-agent-architecture/turbo.json Configures checker tasks; its dependency-completeness guard misses undeclared workspaces in affected CI.
tests/brunch-agent-architecture/tsconfig.json Configures TypeScript checking.
tests/brunch-agent-architecture/test/architecture.test.ts Hosts family-wide architecture assertions.
tests/brunch-agent-architecture/test/architecture-workspace.ts Provides workspace introspection helpers.
tests/brunch-agent-architecture/test/architecture-workspace.test.ts Tests file partitioning.
tests/brunch-agent-architecture/package.json Defines the architecture-test workspace.
tests/brunch-agent-architecture/docs/task-dependencies.json Records task dependencies.
tests/brunch-agent-architecture/.oxlintrc.json Configures Oxlint.
libs/@hashintel/brunch-agent/packages/core/turbo.json Narrows core test inputs.
libs/@hashintel/brunch-agent/MISSION.md Documents architecture-check ownership.
apps/brunch-agent/turbo.json Restricts app test inputs.
apps/brunch-agent/test/architecture/workspace.test.ts Removes former combined helper tests.
apps/brunch-agent/test/architecture/boundaries.test.ts Removes the former suite entry point.
apps/brunch-agent/test/architecture/app-workspace.ts Adds app-local scanning helpers.
apps/brunch-agent/test/architecture/app-workspace.test.ts Tests agent-module detection.
apps/brunch-agent/test/architecture/app-boundaries.test.ts Retains app-specific registration checks.
apps/brunch-agent/docs/task-dependencies.json Updates documented task dependencies.
.github/actions/prune-repository/prune.py Narrows prune exceptions, but causes the core Linear graph suite to be skipped.
.github/actions/prune-repository/prune_test.py Updates prune behavior tests.
Review details
  • Files reviewed: 19/20 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/actions/prune-repository/prune.py Outdated
Comment thread tests/brunch-agent-architecture/turbo.json Outdated
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.89%. Comparing base (407734a) to head (f7e7213).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9625   +/-   ##
=======================================
  Coverage   65.89%   65.89%           
=======================================
  Files        1887     1887           
  Lines      198443   198443           
  Branches     8248     8248           
=======================================
  Hits       130773   130773           
  Misses      66140    66140           
  Partials     1530     1530           
Flag Coverage Δ
apps.hash-ai-worker-ts 1.99% <ø> (ø)
apps.hash-api 15.35% <ø> (ø)
apps.hash-graph 12.54% <ø> (ø)
blockprotocol.type-system 38.15% <ø> (ø)
local.claude-hooks 0.00% <ø> (ø)
local.harpc-client 51.49% <ø> (ø)
local.hash-backend-utils 3.27% <ø> (ø)
local.hash-graph-sdk 10.02% <ø> (ø)
local.hash-isomorphic-utils 12.22% <ø> (ø)
rust.antsi 2.36% <ø> (ø)
rust.error-stack 90.81% <ø> (ø)
rust.harpc-codec 84.70% <ø> (ø)
rust.harpc-net 96.21% <ø> (ø)
rust.harpc-tower 67.03% <ø> (ø)
rust.harpc-types 0.00% <ø> (ø)
rust.harpc-wire-protocol 92.23% <ø> (ø)
rust.hash-codec 72.76% <ø> (ø)
rust.hash-config 81.14% <ø> (ø)
rust.hash-graph-api 19.71% <ø> (ø)
rust.hash-graph-atlas 80.36% <ø> (ø)
rust.hash-graph-authentication 96.02% <ø> (ø)
rust.hash-graph-authorization 63.14% <ø> (ø)
rust.hash-graph-embeddings 91.88% <ø> (ø)
rust.hash-graph-postgres-store 32.15% <ø> (ø)
rust.hash-graph-store 48.41% <ø> (ø)
rust.hash-graph-temporal-versioning 50.18% <ø> (ø)
rust.hash-graph-types 0.00% <ø> (ø)
rust.hash-graph-validation 84.71% <ø> (ø)
rust.hash-middleware 90.92% <ø> (ø)
rust.hashql-ast 89.63% <ø> (ø)
rust.hashql-compiletest 28.39% <ø> (ø)
rust.hashql-core 78.92% <ø> (ø)
rust.hashql-diagnostics 72.51% <ø> (ø)
rust.hashql-eval 79.82% <ø> (ø)
rust.hashql-hir 89.09% <ø> (ø)
rust.hashql-mir 87.92% <ø> (ø)
rust.hashql-syntax-jexpr 94.04% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 32cb88c. Configure here.

Comment thread .github/actions/prune-repository/prune.py Outdated
@codspeed-hq

codspeed-hq Bot commented Sep 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 6 benchmarks measured no execution time

Nothing ran under measurement, usually because the compiler removed the code under test. These results are not comparable, so they count as unchanged.

Preventing compiler optimizations

✅ 98 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚠️ as_constant < 1 ns < 1 ns N/A
⚠️ constant_equal < 1 ns < 1 ns N/A
⚠️ constant_not_equal < 1 ns < 1 ns N/A
⚠️ access < 1 ns < 1 ns N/A
⚠️ runtime_equal < 1 ns < 1 ns N/A
⚠️ runtime_not_equal < 1 ns < 1 ns N/A

Comparing ln/sre-1010-move-brunch-checks (6437e57) with main (94dff8e)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (db4f62c) during the generation of this report, so 94dff8e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread .github/actions/prune-repository/prune_test.py Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread apps/brunch-agent/test/architecture/app-boundaries.test.ts Outdated
Comment thread apps/brunch-agent/test/architecture/app-workspace.ts Outdated
Comment thread apps/brunch-agent/test/architecture/app-boundaries.test.ts Outdated
Comment thread libs/@hashintel/brunch-agent/packages/core/test/architecture/context-root.ts Outdated
Comment thread libs/@local/repo-chores/node/scripts/check-brunch-architecture/workspace.ts Outdated
Comment thread libs/@local/repo-chores/node/scripts/check-brunch-architecture.ts Outdated
Comment thread libs/@local/repo-chores/node/scripts/check-brunch-architecture.ts Outdated
Comment thread libs/@local/repo-chores/node/scripts/check-brunch-architecture.ts Outdated
Comment thread libs/@local/repo-chores/node/scripts/check-brunch-architecture.ts Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
@lunelson
lunelson deployed to pull-request September 9, 2026 15:22 — with GitHub Actions Active
@lunelson
lunelson deployed to pull-request September 9, 2026 15:22 — with GitHub Actions Active
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@lunelson
lunelson deployed to pull-request September 9, 2026 16:50 — with GitHub Actions Active
@lunelson
lunelson deployed to pull-request September 9, 2026 16:50 — with GitHub Actions Active
@lunelson
lunelson enabled auto-merge September 9, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

6 participants