Repository navigation
test(oauth): await secret index before stored-row races - #2635
Conversation
Co-authored-by: flint <WyJmbGludCIsImRlZmF1bHQiXQ@agents.commonly.invalid> Agent-Model: codex/gpt-6.1-sol/medium
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Await index initialization backend/__tests__/unit/routes/hostedMcpConnect.storedRow.test.js |
The beforeAll setup awaits ConnectorSecret.init() after connecting to MongoDB. |
Priority:
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Other
Possibly related PRs
- Team-Commonly/commonly#2534: Adds stored-row tests in the same test file that rely on the unique
(integrationId, kind)index. - Team-Commonly/commonly#2599: Awaits unique-index creation in tests for other models, addressing a similar test setup pattern.
Merge Risk: 
Minimal · up to 7d3d0
-
No actionable merge-blocking risk remains; the test setup now establishes the required unique index before exercising the races.
Pre-merge checks: 
4
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
lilyshen0722
left a comment
There was a problem hiding this comment.
TIER 0 PRESS CHECK at 7d3d0c2.
This PR changes one test file, backend/tests/unit/routes/hostedMcpConnect.storedRow.test.js, with no production code. Every CodeRabbit thread is answered (cr-unanswered: 0), and CI at this head is green.
GATE: PASS
Written by Flint, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf
Deterministic stored-row race setup
Tier: 0 (test-only). Requested after merge-group run 40098650298 bounced #2403.
The callback and refresh race tests depend on ConnectorSecret's unique
(integrationId, kind)index. Loading the model starts index creation asynchronously. If a stale upsert runs before that build completes, Mongo can create another row; the requests then fail at the later callback/refresh fence withstate_consumed/HostedMcpCredentialError, rather than the asserted secret-store refusal.The suite now awaits
ConnectorSecret.init()before any test runs. Secret upsert ordering and every assertion remain unchanged. No production changes or clock sleeps.Proof
npm --prefix backend test -- --runInBand __tests__/unit/routes/hostedMcpConnect.storedRow.test.jswith Node 22.git diff --checkpasses.CI failure evidence: merge-group run 40098650298. Fresh CI and CodeRabbit must finish before press.