Skip to content

test(server): pin migration invariants + embedding-model literal drift guard#1138

Merged
buremba merged 1 commit into
mainfrom
feat/stability-test-hardening
May 28, 2026
Merged

test(server): pin migration invariants + embedding-model literal drift guard#1138
buremba merged 1 commit into
mainfrom
feat/stability-test-hardening

Conversation

@buremba
Copy link
Copy Markdown
Member

@buremba buremba commented May 28, 2026

Summary

Follow-up to the 2-week stability audit. Adds two additive CI guards (no prod-code behavior change) so recently-changed, load-bearing invariants can't silently regress in a future migration — directly serving the "reliable and consistent tests" goal.

Audit context

The #1121 "dropped pending-uniqueness for browser_session" concern turned out to be a false positive on closer reading: browser_session rows are created with connector_key = NULL (manage_auth_profiles.ts:696), and the old dropped index was a standard unique index — Postgres treats NULLs as distinct, so it never enforced uniqueness for that kind. oauth_account (the only reachably-pending kind with non-null keys) is correctly covered. So no code guard was added; the real contract is pinned by the functional test instead.

Test plan

  • vitest run both files green (5 integration + 1 unit) against embedded Postgres
  • red→green proof: drifting DEFAULT_EMBEDDING_MODEL makes the literal guard fail; reverting restores green
  • tsc --noEmit clean (server); pre-commit biome + typecheck pass

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

…t guard

Stability-audit follow-up. Adds CI guards so two recently-changed schema
invariants can't silently regress in a future migration:

- migration-invariants.test.ts: asserts the per-user pending oauth_account
  unique index from #1121 exists (and the old org-wide index is gone), plus a
  functional contract test — a user's second parallel pending OAuth flow
  collides while a distinct user's is allowed. Also asserts event_embeddings
  carries the embedding_model stamp column (#1069/#1080).
- embedding-model-literal.test.ts: the legacy-stamp backfill migration
  hard-codes the model literal; this fails if it ever drifts from
  DEFAULT_EMBEDDING_MODEL, which would silently re-open the full-corpus recall
  regression. Exports DEFAULT_EMBEDDING_MODEL for the assertion.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@buremba, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 31 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 36cc4706-2e70-4fa9-8590-e7646a7745a4

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5a3ce and 860eb25.

📒 Files selected for processing (3)
  • packages/server/src/__tests__/integration/db/migration-invariants.test.ts
  • packages/server/src/utils/__tests__/embedding-model-literal.test.ts
  • packages/server/src/utils/embeddings.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/stability-test-hardening

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 and usage tips.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@buremba buremba merged commit f515e4d into main May 28, 2026
21 checks passed
@buremba buremba deleted the feat/stability-test-hardening branch May 28, 2026 18:54
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.

2 participants