fix(api): provision defaults for invited teams - #2922
Conversation
🦋 Changeset detectedLatest commit: 4ec0a23 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@mfroembgen is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR provisions configured default connections and sources when an invited user creates their account, while allowing invite acceptance to continue after provisioning errors.
Confidence Score: 4/5This PR should not merge until invited-team provisioning is guaranteed to resolve and write resources for the invitation's actual team. The new invite path reaches a helper whose team lookup discards the supplied ID, allowing configured defaults to be assigned to another tenant; the added test mocks that helper and therefore does not detect the failure. Files Needing Attention: packages/api/src/routers/api/root.ts, packages/api/src/setupDefaults.ts, packages/api/src/controllers/team.ts
|
| Filename | Overview |
|---|---|
| packages/api/src/routers/api/root.ts | Adds invited-team default provisioning, but the newly exposed lookup path can provision resources under the wrong team and lacks required instrumentation. |
| packages/api/src/routers/api/tests/team.int.test.ts | Verifies the setup helper receives the invited team ID, but mocking the helper does not exercise its incorrect internal team lookup. |
| .changeset/tidy-invites-share.md | Correctly records the API behavior change as a patch release. |
Reviews (1): Last reviewed commit: "fix(api): provision defaults for invited..." | Re-trigger Greptile
| } | ||
|
|
||
| try { | ||
| await setupTeamDefaults(teamInvite.teamId.toString()); |
There was a problem hiding this comment.
Provisioning resolves the wrong team
If the invited team is not the first team returned by MongoDB, this call reaches getTeam(teamId), which ignores the supplied ID, causing default connections and sources to be assigned to another tenant while the invited team remains unprovisioned.
Knowledge Base Used:
| try { | ||
| await setupTeamDefaults(teamInvite.teamId.toString()); | ||
| } catch (error) { | ||
| logger.error( | ||
| { err: serializeError(error) }, | ||
| 'Failed to setup team defaults', | ||
| ); |
There was a problem hiding this comment.
Provisioning lacks operational context
The added team-scoped provisioning call and its countable failure log attach neither business context nor a metric, preventing failures from being reliably attributed and counted by team during incident diagnosis.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
How to test on Vercel preview
N/A — non-UI change
Testing
make dev-int FILE=teammake ci-lintmake ci-unitReferences