Skip to content

fix(tests): make green mean green — repair test:security and env-only baseline failures - #2338

Merged
2witstudios merged 1 commit into
pu/broken-sessionsfrom
fix/test-baseline-green
Aug 6, 2026
Merged

fix(tests): make green mean green — repair test:security and env-only baseline failures#2338
2witstudios merged 1 commit into
pu/broken-sessionsfrom
fix/test-baseline-green

Conversation

@2witstudios

Copy link
Copy Markdown
Owner

Summary

"Green means green": eliminates every known-failing suite and env-only local failure that agents previously had to memorize as a baseline, so a red check always means a real regression.

test:security — was 44/50 with 6 permanently red, now 51/51

  • Login Route / Signup Route / Mobile Login referenced test files deleted with password auth in fix(security): remove all password-based authentication #861. Repointed to the auth surfaces that replaced them — magic-link (send/verify/round-trip/desktop), passkey (register/authenticate/manage/handoff), passkey signup, and mobile OAuth exchange/refresh — using directory-prefix filters so future tests in those routes are picked up automatically.
  • Session Service / Device Auth Utilities / Permissions are deliberately excluded from @pagespace/lib's default vitest config (DB-backed), so the script's plain test invocation found no files and exited 1. They now run through the test:db config against the dockerized test DB.
  • The script now self-provisions: starts (or reuses) the shared pagespace-postgres-test container, waits for readiness, runs migrations, and exports DATABASE_URL/NODE_ENV=test — a fresh clone with Docker running goes 51/51 with no ambient setup.
  • Suite count is 51 (not 50): retiring 3 dead suites and adding 4 real replacements nets +1.

Env-only failures (the memorized local-failure list)

  • processor magika suites: root cause was never "model assets missing" — Node >= 23 removed util.isNullOrUndefined, which @tensorflow/tfjs-node 4.x still calls. A vitest setup shim (apps/processor/src/test/setup.ts) restores the predicate; the real magika model now loads and all 22 previously-failing tests pass on modern Node.
  • admin-role-version / activity-tools: added a shared ensureTestDb() probe (apps/web/src/test/ensure-test-db.ts) that fails fast with "test DB is not provisioned — run scripts/test-with-db.sh or docker compose -f docker-compose.test.yml up -d" instead of a wall of drizzle Failed query errors when run outside the DB harness.
  • grouping.test.ts (shouldShowDateDivider midnight case): fixtures are UTC but the code compares local calendar days, so the suite flipped in any timezone west of UTC. Pinned TZ=UTC in the suite (restored afterwards) and documented why.
  • MachineFileTree.test.tsx: no longer exists — deleted with the machines-world teardown (623e632). Nothing to fix.
  • scripts/test-with-db.sh: the fixed-name test container conflicts with docker compose up when another checkout/worktree created it (compose scopes ownership by project dir). Now reuses the existing container by name and leaves it running on exit in that case, so bun run test is green from any clean worktree.

Drive-by

Gate results (run sequentially in this worktree)

Gate Result
bun run lint Tasks: 14 successful, 14 total
bun run typecheck Tasks: 16 successful, 16 total
bun run knip:check [ok] knip: 4 issue(s), all within baseline (4)
bun run test Tasks: 15 successful, 15 total — web 16,134 passed / 6 skipped; lib 8,721 passed / 9 skipped; processor 1,121 passed / 22 skipped (magika suites now real-passing); cli 1,115; realtime 943; sdk 767; db 526; control-plane 331; desktop 209; admin 177; e2e 14
bun run test:security All 51 test suites passed (incl. Session Service, Device Auth Utilities, Permissions, Magic Link, Passkey x2, Mobile Auth)

Note: local machine hit a disk-full incident mid-verification (Docker crash + ENOSPC build failures); after cleanup all gates were re-run to completion as listed above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XnzUuAixdTJ8xDpP5S92Ts

… baseline failures

test:security had 6 known-failing suites on every clean checkout, and four
env-only local failures forced agents to memorize a failure baseline. This
eliminates all of them so a red check always means a regression.

test:security (now 51/51):
- Retire "Login Route"/"Signup Route"/"Mobile Login" — their test files were
  deleted with password auth in PR #861; repoint to the surfaces that
  replaced them (magic-link, passkey, passkey signup, mobile OAuth
  exchange/refresh) using directory-prefix filters so new tests are picked
  up automatically.
- Route "Session Service"/"Device Auth Utilities"/"Permissions" through the
  DB-aware test:db config (they are deliberately excluded from the default
  lib vitest config, so plain `test` found no files and exited 1).
- Make the script self-provision the dockerized test DB (reuse a running or
  stopped shared container, start it via compose otherwise, migrate), so a
  clean checkout goes green without ambient setup.

Env-only failures:
- processor magika suites: Node >= 23 removed util.isNullOrUndefined, which
  tfjs-node 4.x still calls — restore the predicate in a vitest setup shim
  so the real model runs on every Node version (the model assets were never
  missing).
- admin-role-version/activity-tools: fail fast with an actionable
  "test DB not provisioned" message via a shared ensureTestDb() probe
  instead of a cryptic drizzle "Failed query" wall.
- grouping.test.ts: pin TZ=UTC (fixtures are UTC but grouping compares
  local calendar days; the midnight test flipped west of UTC) and restore
  the original TZ afterwards.
- MachineFileTree.test.tsx: gone — deleted with the machines-world teardown
  (623e632); nothing to fix.
- test-with-db.sh: tolerate the fixed-name test container being owned by
  another checkout's compose project (reuse instead of name-conflicting).

Drive-by: remove the dead changelog:generate script (scripts/changelog/ was
deleted in #1044) plus the now-unused tsx root devDependency, and update
CLAUDE.md accordingly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XnzUuAixdTJ8xDpP5S92Ts
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@2witstudios, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f010efca-5f10-476a-b7c3-b871f9c5dbe7

📥 Commits

Reviewing files that changed from the base of the PR and between 3f8f0a5 and 145cfcd.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • CLAUDE.md
  • apps/processor/src/test/setup.ts
  • apps/processor/vitest.config.ts
  • apps/web/src/lib/ai/tools/__tests__/activity-tools.test.ts
  • apps/web/src/lib/auth/__tests__/admin-role-version.test.ts
  • apps/web/src/lib/messages/__tests__/grouping.test.ts
  • apps/web/src/test/ensure-test-db.ts
  • package.json
  • scripts/test-security.sh
  • scripts/test-with-db.sh

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@2witstudios
2witstudios changed the base branch from master to pu/broken-sessions August 6, 2026 01:02
@2witstudios
2witstudios merged commit 0e5b9e8 into pu/broken-sessions Aug 6, 2026
10 checks passed
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