[PM-37965] Milestone 2 - Staged Users - #1163
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Re-reviewed the Code Review Details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1163 +/- ##
============================
============================
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Add labels... @sven-bitwarden |
| this.overwriteExisting = model.overwriteExisting; | ||
| this.largeImport = model.largeImport; | ||
| // Defaults to false so users are not invited unless invitations are explicitly enabled. | ||
| this.inviteUsersAfterProvisioning = model.inviteUsersAfterProvisioning ?? false; |
There was a problem hiding this comment.
❓ QUESTION: Defaulting the absent flag to false silently stops invitations for every existing install on upgrade — is that the intended rollout?
Details
Saved data.json configs written before this PR have no inviteUsersAfterProvisioning key, and stateService.getSync() returns the stored object rather than a new SyncConfiguration(), so the class-level default never applies. The ?? false fallback here means the first sync after upgrade posts inviteUsersAfterProvisioning: false, and newly provisioned users land in Staged instead of receiving invitation emails. Because the added field also changes the request JSON, the sync hash differs and the import is guaranteed to be re-posted on that first run.
Admins who never touch the new checkbox get a behavior change they did not opt into, and it fails silently — the sync reports success while new users simply never get invited. The commit message for b1da474 acknowledges this, so if it is a deliberate product decision for the Staged Users milestone it would help to note it in the PR description so it makes the release notes; otherwise defaulting the absent-key case to true (while keeping false as the default for newly created configs) preserves existing behavior on upgrade.
There was a problem hiding this comment.
Kind of. We want to default to false, the only time the setting should be true is if there was a prior installation, which is precisely what the migration is for
Flip the default for inviteUsersAfterProvisioning from true to false so users are not invited after provisioning unless invitations are explicitly enabled. - SyncConfiguration: new-config default is now false - OrganizationImportRequest: field default and absent-flag fallback now resolve to false (a saved config that predates this setting no longer sends invitations on upgrade) - GUI checkbox: unset now displays as unchecked - Config fixtures updated to match the new default - Tests updated: "unset" cases expect false; forwarding tests push true to confirm a non-default value is still carried through
The previous commit made inviteUsersAfterProvisioning default to false. That is correct for new installs, but would silently stop sending invitations for existing users who provisioned before the setting existed (their persisted sync config has no such key). Add a v6->v7 state migration that backfills inviteUsersAfterProvisioning to true on any sync config that already exists but does not define the flag. Existing installs therefore keep their prior invite-on-provision behavior, while fresh installs report stateVersion Latest, skip the migration, and retain the new false default. - StateVersion: add Seven, make it Latest - StateMigrationService: migrateStateFrom6To7 backfills the flag onto an existing sync config; explicit values are left untouched and no config is created when none exists - Update migration specs for the new Latest version and add coverage for the v6->v7 backfill - Clarify the sync-service fallback test comment now that real upgraded configs are backfilled before reaching the request builder
c4c8f81 to
a85ceaf
Compare
| // safe default). Real upgraded configs are backfilled to true by the v6->v7 state | ||
| // migration before they ever get here (see StateMigrationService.migrateStateFrom6To7). |
There was a problem hiding this comment.
♻️ DEBT: Comment points at the wrong migration — the backfill is v7→v8 (migrateStateFrom7To8), not v6→v7.
Details and fix
migrateStateFrom6To7 is the keytar credential migration; the inviteUsersAfterProvisioning backfill added in this PR lives in migrateStateFrom7To8 (libs/services/state-service/stateMigration.service.ts:364). Anyone tracing invite behavior from this test lands in the wrong method.
| // safe default). Real upgraded configs are backfilled to true by the v6->v7 state | |
| // migration before they ever get here (see StateMigrationService.migrateStateFrom6To7). | |
| // safe default). Real upgraded configs are backfilled to true by the v7->v8 state | |
| // migration before they ever get here (see StateMigrationService.migrateStateFrom7To8). |
🎟️ Tracking
PM-37965
📔 Objective
The - final - ticket for Milestone 2, this allows BWDC to specify whether or not to automatically send email invitations after provisioning. Disabling this setting will provision users in the
Stagedstate.📸 Screenshots