Repository navigation
chore(bun): run Orbit on Bun end to end - #24
Conversation
Replace pnpm and Turbo with bun workspaces and bun run --filter. Run every script, and the repo tooling in scripts/, on the bun runtime instead of node and tsx. Bundle the services with bun build instead of esbuild. bun install drops from 1047 to 796 packages by removing turbo, tsx, esbuild, vitest, jsdom, ioredis, ws, the AWS S3 SDK and ulid. pg stays as a build time only devDependency because drizzle-kit cannot use Bun's SQL client.
Replace the pg pool with Bun.SQL through drizzle-orm/bun-sql, ioredis with Bun.RedisClient including its pub/sub, the ws server with Bun.serve websockets, the AWS S3 SDK with Bun.S3Client, and ulid with Bun.randomUUIDv7. Sanitize rendered markdown with Bun's HTMLRewriter instead of isomorphic dompurify, which removes jsdom. jsdom was also the one dependency Turbopack could not resolve when building on the bun runtime, and the web build has to run there now that the source imports bun built-ins. The S3 driver builds its client from explicit configuration and refuses to start when an ambient AWS session token has leaked into the signature, which is how a presigned upload fails in a pod that also has IRSA credentials.
Move 62 suites from vitest to bun:test. Per package bunfig.toml with a tests-preload.ts carries what each vitest config used to provide: the test database url, redis url, happy-dom for the DOM suites in place of jsdom, and the matchMedia, ResizeObserver and scrollIntoView shims. scripts/test-env.ts keeps the guard that refuses to run against a database whose name does not contain test. Each preload caps DATABASE_POOL_MAX at 2 so eight suites running in parallel cannot exhaust postgres connections. Add regression tests for the two sanitizer bypasses an adversarial audit found: a scheme hidden behind html entities, and a repeated href attribute. 615 tests pass.
Base all four images on oven/bun and run bun as the container command. There is no turbo prune, so each Dockerfile copies the root manifest, bun.lock and every workspace manifest, installs with a frozen lockfile, then copies source. Each one asserts the lockfile exists first, because bun install --frozen-lockfile exits 0 when there is no lockfile at all. CI installs with oven-sh/setup-bun and asserts every image actually runs bun. Raise the web pod to 512Mi requested and 2Gi limit. Bun has no equivalent of --max-old-space-size, so the old 768Mi heap ceiling is gone and its resident memory sits well above node's.
Rule one is now that bun is the runtime, the package manager and the script runner, with a table of which built-in replaces which package so new work does not reintroduce an SDK. Record the three Bun behaviours that cost real time: process.loadEnvFile does not exist, a subdirectory cwd cannot see the root .env, and S3Client snapshots ambient AWS credentials at process start so an explicit endpoint fails with InvalidTokenId. Note that rolling web back to node means editing the Dockerfile, because in oven/bun images node is a symlink to bun and the manifest command would silently keep running bun.
What was verified, and howEvery replacement below was exercised against the real local stack (postgres 5434, redis 6380, minio 9010) rather than taken from documentation.
Next.js 16 compiles, typechecks and serves on the Bun runtime. The standalone server was booted with Net change: 143 files, about 6,300 fewer lines. Three things worth reviewing carefully1. The sanitizer is new code, and it is security critical.
That new code was then attacked by four independent adversarial passes, 358 vectors total. Three of them converged on the same two real bypasses:
Both are fixed. URL handling moved from a scheme blocklist to an allowlist of 2. 3. The web pod got more memory. Bun has no equivalent of Two operational notes recorded in CLAUDE.md
Rolling the web service back to Node means editing Possibly the cause of the S3 upload failuresBun's Separately, and not fixed here: there is no S3 bucket CORS configuration anywhere in |
📝 WalkthroughWalkthroughThe repository migrates tooling, applications, tests, database access, storage, Markdown handling, Docker images, CI, and deployment commands from Node, pnpm, and Vitest to Bun. Realtime networking and several typed utility scripts are also updated. ChangesBun platform migration
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…ain text An adversarial audit of the new sanitizer ran 584 vectors across four lenses and reproduced every finding in headless Chromium. No XSS bypass survived, but three real defects did. A protocol relative link was treated as internal, because the absolute url test required an explicit scheme, so an external link got no target or rel. The same line read the raw href while the safety check read the decoded one, so an entity encoded absolute url was misclassified too. Both now test the decoded value. renderPlainText returned HTML escaped text, so a document excerpt or a project description containing an ampersand or a quote reached the reader as a literal entity. Plain text is now decoded at that boundary. htmlToText stays escaped, because callers that interpolate it into HTML depend on that.
Adversarial audit of the new sanitizer: no bypass survivedBecause the sanitizer is new, security critical, and this repository is public, I had four independent attackers try to break it before asking anyone to review it. 584 vectors across four lenses: scheme smuggling (100), parser confusion (226), attribute escape (128), and the markdown layer (130). The consolidation pass did not take those reports on trust. It re-ran every claimed bypass in real headless Chromium, setting the output as Result: zero confirmed bypasses. Nothing executed. No event handler attribute and no non The two bypasses that were real, an entity encoded scheme and a duplicate What the audit did find, and what this commit fixesThree genuine defects, none of them XSS:
Also worth recording: three of the four attackers recommended reverting to 623 tests pass. |
There was a problem hiding this comment.
Actionable comments posted: 12
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/services/src/test-database.ts (1)
1-17: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winClose the shared DB pool at process exit
The test preload already points
DATABASE_URLat a test database; the remaining gap is a process-levelpool.close()for@orbit/dbso Bun test exits cleanly instead of keeping the SQL handle open.🤖 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 `@packages/services/src/test-database.ts` around lines 1 - 17, Update the test database setup around the imported db instance and exported testDb to register a process-exit handler that closes the shared `@orbit/db` pool via its pool.close() API, ensuring Bun tests release the SQL handle before exiting..github/workflows/ci.yml (1)
120-129: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winExercise the image’s default command and pin Bun exactly.
--entrypoint bunbypasses the container’sCMD(/usr/bin/doppler run -- bun apps/web/server.js), so this smoke test doesn’t cover the actual startup path.case "$VERSION" in 1.*)is too loose for a version pinned to$BUN_VERSION; require an exact match instead.🤖 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 @.github/workflows/ci.yml around lines 120 - 129, Update the web image smoke test to remove the `--entrypoint bun` override so `docker run` exercises the image’s default `CMD` startup path. In the Bun version validation, replace the loose `1.*` pattern with an exact comparison against `$BUN_VERSION`.Source: Coding guidelines
🧹 Nitpick comments (7)
apps/web/src/lib/api/dev-login.test.ts (1)
2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
@/aliases for local test imports.
apps/web/src/lib/api/dev-login.test.ts#L2-L2: replace./dev-login.tswith@/lib/api/dev-login.ts.apps/web/src/lib/query/fetcher.test.ts#L3-L3: replace./fetcher.tswith@/lib/query/fetcher.ts.As per coding guidelines, “Use
@/imports insideapps/web.”🤖 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 `@apps/web/src/lib/api/dev-login.test.ts` at line 2, Replace the relative import in apps/web/src/lib/api/dev-login.test.ts at lines 2-2 with the `@/lib/api/dev-login.ts` alias, and replace the relative fetcher import in apps/web/src/lib/query/fetcher.test.ts at lines 3-3 with `@/lib/query/fetcher.ts`, preserving the imported symbols.Source: Coding guidelines
packages/services/src/markdown/sanitize.ts (1)
134-190: 🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy liftHand-rolled sanitizer replacing DOMPurify.
This custom
HTMLRewriter-based sanitizer replaces the previously usedisomorphic-dompurify. The default-deny URL scheme check and tag/attribute allowlists look sound against the attack vectors exercised inmarkdown.test.ts, but a hand-rolled sanitizer inherently lacks the ongoing security research and bypass-technique tracking that a widely used library like DOMPurify benefits from. Since this renders untrusted user content, consider whether this warrants periodic re-audits or fuzz testing as new bypass techniques emerge, given it is no longer backed by an actively-patched upstream library.🤖 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 `@packages/services/src/markdown/sanitize.ts` around lines 134 - 190, Harden the custom sanitizer around the sanitizer implementation anchored by isSafeUrl and sanitizeHtml by adding ongoing security coverage for untrusted HTML, such as fuzz tests and/or a documented periodic re-audit process. Preserve the existing allowlists and default-deny URL behavior while ensuring newly discovered parser or bypass techniques can be detected and addressed.CLAUDE.md (2)
46-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd language identifiers to the Markdown fences.
Markdownlint reports MD040 for these blocks. Use
shfor command blocks andtextfor the layout tree.Suggested fix
-``` +```sh ... -``` +```text ... -``` +```shAlso applies to: 54-62, 129-131
🤖 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 `@CLAUDE.md` around lines 46 - 48, Update the Markdown fences in CLAUDE.md around the environment command and the additional referenced blocks to include language identifiers: use sh for shell command blocks and text for the layout tree. Preserve the existing block contents.Source: Linters/SAST tools
7-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNarrow the “every command starts with
bun” rule.The same document contains
env, Docker, and deployment commands that intentionally do not start withbun. Limit this rule to repository runtime and script commands.🤖 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 `@CLAUDE.md` around lines 7 - 8, Revise the first guideline in CLAUDE.md to require a bun prefix only for repository runtime, package-management, and script-runner commands. Do not apply this requirement to env, Docker, deployment, or other infrastructure commands that intentionally use their own executables.scripts/fetch-plane.ts (2)
304-318: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCycle/module issue fetches run sequentially; consider
mapConcurrentfor consistency.Comments, links, and page details all use the in-file
mapConcurrenthelper for concurrency, butcycleIssues/moduleIssuesare fetched one at a time in a plainfor...ofloop, serializing N+M round trips per project.🤖 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 `@scripts/fetch-plane.ts` around lines 304 - 318, Update the cycleIssues and moduleIssues fetch loops to use the existing mapConcurrent helper, while preserving each endpoint, fallback behavior, and assignment keyed by item.id. Keep the resulting issue maps unchanged and avoid serializing requests across cycles and modules.
283-293: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winFragile 403 detection via string matching.
String(error).includes('403')relies on the error message text (\${status} on ${path}``) coincidentally containing "403" as a substring; a path containing "403" (e.g. a project identifier) could cause an unrelated error to be misclassified as a permissions issue, silently skipping a project that actually failed for another reason.♻️ Suggested typed error
+class HttpStatusError extends Error { + constructor(readonly status: number, path: string) { + super(`${status} on ${path}`); + } +}Then throw
new HttpStatusError(response.status, path)inget<T>and checkerror instanceof HttpStatusError && error.status === 403here instead of string matching.🤖 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 `@scripts/fetch-plane.ts` around lines 283 - 293, Replace the fragile String(error) check in the collect call with typed status handling: update get<T> to throw HttpStatusError with the response status and path, then in this catch classify the error as inaccessible only when it is an HttpStatusError whose status equals 403; rethrow all other errors unchanged.scripts/strip-comments.ts (1)
612-623: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueManual character-by-character escaping flagged by static analysis.
codeCellchain-replaces\,|,&,<,>for embedding into a Markdown table cell wrapped in<code>. This is scoped correctly for its actual usage, but static analysis flags hand-rolled escaping as a general CWE-79 risk pattern; worth a second look given this text ends up inGITHUB_STEP_SUMMARY, which is rendered as HTML/Markdown.🤖 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 `@scripts/strip-comments.ts` around lines 612 - 623, Review the codeCell function in buildSummary and replace its manual character-by-character escaping with the repository’s established Markdown/HTML escaping utility, if available. Preserve escaping for all characters required to safely render findings in a GITHUB_STEP_SUMMARY Markdown table code cell, including backslashes, pipes, ampersands, and angle brackets.Source: Linters/SAST tools
🤖 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.
Inline comments:
In `@apps/mcp/Dockerfile`:
- Line 39: Update the final CMD in the Dockerfile to invoke Bun directly as the
container entrypoint, removing /usr/bin/doppler from the command. Preserve the
existing dist/index.js startup target and leave Doppler environment injection to
deployment or an external wrapper.
In `@apps/mcp/README.md`:
- Around line 28-30: Declare the fenced command’s language in the README by
changing the code fence around the create-key example to use the sh identifier,
while leaving the command itself unchanged.
In `@apps/mcp/src/server.ts`:
- Around line 142-149: Update the shutdown flow around http.closeAllConnections
and http.close so http.close() initiates graceful draining first; only invoke
closeAllConnections after a shutdown timeout if active requests remain. Preserve
the existing error handling for http.close, and add an in-flight MCP RPC test
verifying requests drain normally before any forced connection closure.
In `@apps/realtime/src/server.test.ts`:
- Around line 76-81: Update the upgrade response handling in the test’s data
callback to accumulate chunks across fragmented reads until the HTTP header
terminator \r\n\r\n is received. Then inspect the complete response: call
markUpgraded for a 101 status, reject via failUpgrade for non-upgrade responses,
and also reject when the socket closes before a complete valid upgrade response
arrives.
- Around line 66-70: Update the upgraded promise setup in server.test.ts to
store the setTimeout handle, then clear that timeout in the upgrade flow’s
finally block after the socket upgrades or fails. Preserve the existing timeout
rejection and resolve/reject behavior while ensuring the timer is always cleaned
up.
In `@apps/realtime/tests-preload.ts`:
- Line 4: Update the REDIS_URL initialization in tests-preload so empty or
whitespace-only environment values are treated as unset and replaced with the
localhost Redis fallback. Validate the external environment input with the
project’s Zod schema or established validation helper, rather than relying only
on nullish coalescing.
In `@apps/web/e2e/account-and-workspaces.spec.ts`:
- Line 16: Update the error message in the seed-user validation around the owner
check to remove the trailing period from the suggested command, so copying “bun
run db:seed” executes the correct script.
In `@packages/core/package.json`:
- Line 11: Update the test scripts in packages/core/package.json at lines 11-11
and packages/db/package.json at lines 19-19 to invoke Bun with
--env-file=../../.env before test, ensuring both package test commands load the
repository environment file.
In `@packages/core/src/test-support.ts`:
- Around line 9-12: Update the database-name validation in resetDatabase to
require the supplied test-database prefix or an equivalent strict test-only
pattern, such as orbit_test_. Do not use substring matching via includes; reject
names like contest before any destructive truncation SQL executes.
In `@packages/db/src/client.ts`:
- Around line 5-16: Validate DATABASE_POOL_MAX with a positive-integer Zod
schema before constructing SQL, rejecting missing, malformed, non-integer, zero,
and negative values with a clear configuration error. Replace the
Number.parseInt usage in the pool initialization while preserving the existing
default of 10 when the environment variable is absent.
In `@scripts/strip-comments.ts`:
- Around line 30-32: Update the scan flow around trackedFiles() to honor
positional file arguments when provided: restrict the files passed to comment
stripping to those paths while preserving the existing hardcoded-glob scan when
no paths are supplied. Ensure --check and related dry-run modes report only the
requested staged files.
In `@scripts/test-env.ts`:
- Around line 15-27: Update resolveTestDatabaseUrl to validate fallbackDatabase
and enforce the strict test-database naming policy on every return path. Replace
the substring check on databaseNameOf(ambient) with an exact
allowlist/predicate, and validate both explicit and constructed URLs before
returning them so resetDatabase cannot target non-test databases.
---
Outside diff comments:
In @.github/workflows/ci.yml:
- Around line 120-129: Update the web image smoke test to remove the
`--entrypoint bun` override so `docker run` exercises the image’s default `CMD`
startup path. In the Bun version validation, replace the loose `1.*` pattern
with an exact comparison against `$BUN_VERSION`.
In `@packages/services/src/test-database.ts`:
- Around line 1-17: Update the test database setup around the imported db
instance and exported testDb to register a process-exit handler that closes the
shared `@orbit/db` pool via its pool.close() API, ensuring Bun tests release the
SQL handle before exiting.
---
Nitpick comments:
In `@apps/web/src/lib/api/dev-login.test.ts`:
- Line 2: Replace the relative import in apps/web/src/lib/api/dev-login.test.ts
at lines 2-2 with the `@/lib/api/dev-login.ts` alias, and replace the relative
fetcher import in apps/web/src/lib/query/fetcher.test.ts at lines 3-3 with
`@/lib/query/fetcher.ts`, preserving the imported symbols.
In `@CLAUDE.md`:
- Around line 46-48: Update the Markdown fences in CLAUDE.md around the
environment command and the additional referenced blocks to include language
identifiers: use sh for shell command blocks and text for the layout tree.
Preserve the existing block contents.
- Around line 7-8: Revise the first guideline in CLAUDE.md to require a bun
prefix only for repository runtime, package-management, and script-runner
commands. Do not apply this requirement to env, Docker, deployment, or other
infrastructure commands that intentionally use their own executables.
In `@packages/services/src/markdown/sanitize.ts`:
- Around line 134-190: Harden the custom sanitizer around the sanitizer
implementation anchored by isSafeUrl and sanitizeHtml by adding ongoing security
coverage for untrusted HTML, such as fuzz tests and/or a documented periodic
re-audit process. Preserve the existing allowlists and default-deny URL behavior
while ensuring newly discovered parser or bypass techniques can be detected and
addressed.
In `@scripts/fetch-plane.ts`:
- Around line 304-318: Update the cycleIssues and moduleIssues fetch loops to
use the existing mapConcurrent helper, while preserving each endpoint, fallback
behavior, and assignment keyed by item.id. Keep the resulting issue maps
unchanged and avoid serializing requests across cycles and modules.
- Around line 283-293: Replace the fragile String(error) check in the collect
call with typed status handling: update get<T> to throw HttpStatusError with the
response status and path, then in this catch classify the error as inaccessible
only when it is an HttpStatusError whose status equals 403; rethrow all other
errors unchanged.
In `@scripts/strip-comments.ts`:
- Around line 612-623: Review the codeCell function in buildSummary and replace
its manual character-by-character escaping with the repository’s established
Markdown/HTML escaping utility, if available. Preserve escaping for all
characters required to safely render findings in a GITHUB_STEP_SUMMARY Markdown
table code cell, including backslashes, pipes, ampersands, and angle brackets.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2b85c337-cd5e-43fe-8eb8-c2ce4c977e43
⛔ Files ignored due to path filters (2)
bun.lockis excluded by!**/*.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (141)
.github/workflows/ci.yml.gitignoreCLAUDE.mdREADME.mdapps/mcp/Dockerfileapps/mcp/README.mdapps/mcp/bunfig.tomlapps/mcp/package.jsonapps/mcp/src/auth.test.tsapps/mcp/src/server.tsapps/mcp/src/test-helpers.tsapps/mcp/src/tools.test.tsapps/mcp/tests-preload.tsapps/mcp/tsconfig.jsonapps/mcp/vitest.config.tsapps/realtime/Dockerfileapps/realtime/bunfig.tomlapps/realtime/package.jsonapps/realtime/src/active-organization.test.tsapps/realtime/src/client-reconnect.test.tsapps/realtime/src/connection.test.tsapps/realtime/src/connection.tsapps/realtime/src/server.test.tsapps/realtime/src/server.tsapps/realtime/src/test-helpers.tsapps/realtime/tests-preload.tsapps/realtime/tsconfig.jsonapps/realtime/vitest.config.tsapps/web/Dockerfileapps/web/bunfig.tomlapps/web/e2e/account-and-workspaces.spec.tsapps/web/e2e/global-setup.tsapps/web/e2e/second-workspace-realtime.spec.tsapps/web/next.config.tsapps/web/package.jsonapps/web/playwright.config.tsapps/web/src/components/layout/workspace-switcher.test.tsxapps/web/src/components/theme-provider.test.tsxapps/web/src/components/ui/ui.test.tsxapps/web/src/features/account/connected-accounts.test.tsxapps/web/src/features/account/credentials.test.tsapps/web/src/features/account/profile-form.test.tsxapps/web/src/features/charts/geometry.test.tsapps/web/src/features/comments/comment-composer.test.tsxapps/web/src/features/cycles/burn-up.test.tsapps/web/src/features/docs/docs.test.tsapps/web/src/features/filters/filter-bar.test.tsxapps/web/src/features/filters/grouping.test.tsapps/web/src/features/filters/view-config.test.tsapps/web/src/features/issues/issue-card.test.tsxapps/web/src/features/issues/issue-row.test.tsxapps/web/src/features/issues/my-issues-view.test.tsxapps/web/src/features/projects/series.test.tsapps/web/src/features/settings/invite-panel.test.tsxapps/web/src/features/settings/members-table.test.tsxapps/web/src/features/settings/notification-matrix.test.tsxapps/web/src/features/workspaces/create-workspace-form.test.tsxapps/web/src/lib/api/content-disposition.test.tsapps/web/src/lib/api/dev-login.test.tsapps/web/src/lib/cn.test.tsapps/web/src/lib/keyboard/binding.test.tsapps/web/src/lib/query/fetcher.test.tsapps/web/src/lib/query/sync.test.tsapps/web/src/lib/realtime/delta-bridge.test.tsxapps/web/src/tests/setup.tsapps/web/tests-preload.tsapps/web/tsconfig.jsonapps/web/vitest.config.tsbiome.jsonbuildspec.ymlk8s/02-web.yamlk8s/03-realtime.yamlk8s/04-mcp.yamllefthook.ymlpackage.jsonpackages/core/bunfig.tomlpackages/core/package.jsonpackages/core/src/activity/activity-service.test.tspackages/core/src/content/doc-service.test.tspackages/core/src/org/active-organization.test.tspackages/core/src/org/invite-service.test.tspackages/core/src/org/member-service.test.tspackages/core/src/org/organization-service.test.tspackages/core/src/org/profile-service.test.tspackages/core/src/realtime/publisher.test.tspackages/core/src/realtime/publisher.tspackages/core/src/sync/sync-id.tspackages/core/src/test-support.tspackages/core/src/work/cycle-service.test.tspackages/core/src/work/issue-predicates.test.tspackages/core/src/work/issue-service.test.tspackages/core/src/work/project-service.test.tspackages/core/src/work/workflow-state-service.test.tspackages/core/tests-preload.tspackages/core/tsconfig.jsonpackages/db/Dockerfilepackages/db/package.jsonpackages/db/src/client.tspackages/db/src/import/plane-mapping.test.tspackages/db/src/import/plane-source.test.tspackages/db/src/schema/index.test.tspackages/db/src/seed/data.tspackages/db/tsconfig.jsonpackages/realtime-client/bunfig.tomlpackages/realtime-client/package.jsonpackages/realtime-client/src/react.test.tsxpackages/realtime-client/tests-preload.tspackages/realtime-client/tsconfig.jsonpackages/realtime-client/vitest.config.tspackages/services/bunfig.tomlpackages/services/package.jsonpackages/services/src/email/email.test.tspackages/services/src/email/index.tspackages/services/src/markdown/index.tspackages/services/src/markdown/markdown.test.tspackages/services/src/markdown/sanitize.tspackages/services/src/notifications/index.tspackages/services/src/notifications/notifications.test.tspackages/services/src/slack/slack.test.tspackages/services/src/storage/index.tspackages/services/src/storage/s3.tspackages/services/src/storage/storage.test.tspackages/services/src/storage/validate.tspackages/services/src/test-database.tspackages/services/tests-preload.tspackages/services/tsconfig.jsonpackages/services/vitest.config.tspackages/shared/package.jsonpackages/shared/src/events/events.test.tspackages/shared/src/events/index.test.tspackages/shared/src/filters/filters.test.tspackages/shared/src/policy/policy.test.tspackages/shared/src/utils/utils.test.tspackages/shared/src/validators/validators.test.tspackages/shared/tsconfig.jsonpnpm-workspace.yamlscripts/fetch-plane.tsscripts/strip-comments.tsscripts/test-env.tsscripts/tsconfig.jsonturbo.json
💤 Files with no reviewable changes (11)
- apps/realtime/vitest.config.ts
- apps/web/vitest.config.ts
- buildspec.yml
- packages/realtime-client/vitest.config.ts
- packages/services/vitest.config.ts
- turbo.json
- apps/web/playwright.config.ts
- apps/mcp/vitest.config.ts
- pnpm-workspace.yaml
- apps/web/next.config.ts
- .gitignore
Harden the destructive test guard: resetDatabase and resolveTestDatabaseUrl now require the database name to match orbit_test(_suffix), so a name like contest can no longer reach a truncate of every public table. Validate DATABASE_POOL_MAX with Zod instead of Number.parseInt, which accepted 12abc and could hand NaN to the pool. Drain the MCP server on shutdown rather than resetting in-flight requests. close now closes idle connections, waits a grace period, and only then forces the rest. Bun's http.close callback does not reliably fire once connections have been open, so the grace timer also settles the promise, which bounds shutdown instead of hanging. The grace is configurable and the tests use a short one. Treat an empty REDIS_URL as unset in the realtime test preload, buffer the raw socket handshake before matching the status line, clear its timeout, pass the repository env file to every test script, honour positional paths in strip-comments so the pre-commit hook only scans staged files, and fix a stray period and a missing fence language in the docs.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@apps/mcp/src/server.ts`:
- Line 112: Validate and clamp the shutdownGraceMs value used by the server
shutdown timer to a positive finite duration before passing it to setTimeout.
Update the shutdown configuration handling around shutdownGraceMs so negative,
NaN, and Infinity values cannot produce an unintended near-immediate timer,
while preserving valid configured durations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8256dc98-b7aa-4f82-9a05-e08afac14281
📒 Files selected for processing (19)
apps/mcp/README.mdapps/mcp/package.jsonapps/mcp/src/server.tsapps/mcp/src/test-helpers.tsapps/realtime/package.jsonapps/realtime/src/server.test.tsapps/realtime/tests-preload.tsapps/web/e2e/account-and-workspaces.spec.tsapps/web/e2e/second-workspace-realtime.spec.tsapps/web/package.jsonpackages/core/package.jsonpackages/core/src/test-support.tspackages/db/package.jsonpackages/db/src/client.tspackages/realtime-client/package.jsonpackages/services/package.jsonpackages/shared/package.jsonscripts/strip-comments.tsscripts/test-env.ts
🚧 Files skipped from review as they are similar to previous changes (15)
- apps/realtime/tests-preload.ts
- apps/web/e2e/second-workspace-realtime.spec.ts
- packages/core/package.json
- packages/realtime-client/package.json
- scripts/test-env.ts
- apps/web/e2e/account-and-workspaces.spec.ts
- packages/shared/package.json
- apps/realtime/package.json
- packages/db/package.json
- apps/mcp/package.json
- packages/services/package.json
- apps/mcp/README.md
- packages/db/src/client.ts
- apps/realtime/src/server.test.ts
- scripts/strip-comments.ts
The Playwright runner executes on Node, which cannot resolve the bun module that packages/db now imports, so every spec died at import. test:e2e now runs under bun --bun, and the global setup uses node:child_process because that file is loaded by the Node runner rather than by bun. Clamp shutdownGraceMs to a positive finite value, since a negative, NaN or Infinity input would otherwise become a 1ms timer and make shutdown immediate. Measured against main on the same machine, same database and a fresh seed, the end to end suite goes from 3 passed and 4 failed to 4 passed and 3 failed. The three that still fail are the same three that fail on main.
End to end verification, measured against mainThe unit suite, typecheck, lint and the container builds were all green while I had not actually watched the UI load a single issue. So I ran the real application on both branches and compared. The migration did break the end to end suite, at the import level. Playwright's runner executes on Node, and Node cannot resolve the With that fixed, same machine, same Postgres, fresh seed, nothing else competing:
The three that still fail here ( I also confirmed the client behaves identically on both branches: loading One methodology note, since it nearly caused a wrong call. My first comparison showed zero API calls on this branch against two on |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/e2e/global-setup.ts (1)
1-8: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winUse Bun’s native process API here instead of
node:child_process.
global-setup.tsis already part of the Bun e2e flow, so this can useBun.spawnSyncand keep the same inherited output and exit-code behavior.🤖 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 `@apps/web/e2e/global-setup.ts` around lines 1 - 8, Replace the execFileSync usage in globalSetup with Bun.spawnSync, removing the node:child_process import while preserving the repoRoot working directory, inherited stdio, command arguments, and existing exit-code behavior.Source: Coding guidelines
🤖 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.
Outside diff comments:
In `@apps/web/e2e/global-setup.ts`:
- Around line 1-8: Replace the execFileSync usage in globalSetup with
Bun.spawnSync, removing the node:child_process import while preserving the
repoRoot working directory, inherited stdio, command arguments, and existing
exit-code behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3ecd37c8-af94-4cd2-905e-f0af095ad686
📒 Files selected for processing (3)
apps/mcp/src/server.tsapps/web/e2e/global-setup.tsapps/web/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/web/package.json
- apps/mcp/src/server.ts
Replace pnpm, Turbo, tsx, esbuild, vitest, jsdom, ioredis, ws, the AWS S3 SDK and ulid with Bun built-ins across the workspace, the tests, the images and the deploy.