Skip to content

improvement(tests): db-mock migration tranche 4 — billing, webhooks/execution/logs, routes/misc (final)#5866

Merged
waleedlatif1 merged 2 commits into
stagingfrom
test/db-mock-migration-4
Jul 22, 2026
Merged

improvement(tests): db-mock migration tranche 4 — billing, webhooks/execution/logs, routes/misc (final)#5866
waleedlatif1 merged 2 commits into
stagingfrom
test/db-mock-migration-4

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Type of Change

  • Improvement

Testing

Full apps/sim suite green locally (13704/13705; sole failure is the known local ripgrep dependency, green in CI). Every file verified standalone, per-cluster, and with neighbor sweeps (lib/billing 445 tests, webhooks/execution/logs 1001, routes/misc 527). tsc + biome clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 22, 2026 10:46pm

Request Review

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Changes are confined to test mocks and assertions; runtime billing, auth, and API behavior are untouched.

Overview
Test-only refactor: dozens of apps/sim suites stop defining private Drizzle chain mocks and instead use the shared @sim/testing helpers (dbChainMock, schemaMock, queueTableRows, resetDbChainMock, dbChainMockFns).

Suites now queue fixture rows per table (often in call order for multi-select flows) and assert via dbChainMockFns instead of hand-rolled mockDbSelect / makeBuilder / queryQueue state. beforeEach / afterAll call resetDbChainMock() so the single shared mock stays isolated between tests. Local drizzle-orm and duplicate @sim/db/schema mocks are dropped where the shared mock covers them.

Coverage spans SSO register (adds an assertion that domain-conflict SQL uses case-normalized values), chat OTP, resume poll, speech token, custom tools, audit-logs auth, billing (threshold settlement, seats, enterprise provisioning, limits, etc.), webhook outbox handlers, credentials access, and agent / skills executor tests. No production code changes.

Reviewed by Cursor Bugbot for commit 63ea1ef. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR consolidates the remaining database mocks onto the shared testing helpers. The main changes are:

  • Migrates 43 test suites to dbChainMock and table-specific row queues.
  • Standardizes database mock setup and cleanup across routes and libraries.
  • Removes private @sim/db mock factories from the remaining suites.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/app/api/auth/sso/register/route.test.ts Migrates membership and provider lookups to table-specific shared mock queues.
apps/sim/app/api/chat/[identifier]/otp/route.test.ts Moves chat and verification database behavior onto the shared chain mock.
apps/sim/lib/billing/enterprise-provisioning.test.ts Replaces ordered private database stubs with shared per-table queues.
apps/sim/lib/execution/payloads/large-value-metadata.test.ts Migrates transaction and mutation assertions to the shared database mock.
apps/sim/lib/logs/execution/logging-session.test.ts Updates logging-session database test setup to use shared mock controls.

Reviews (2): Last reviewed commit: "fix(tests): route agent-handler MCP serv..." | Re-trigger Greptile

Comment thread apps/sim/executor/handlers/agent/agent-handler.test.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 63ea1ef. Configure here.

@waleedlatif1
waleedlatif1 merged commit 21ac7b1 into staging Jul 22, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the test/db-mock-migration-4 branch July 22, 2026 23:56
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