fix(seed): chunk IdP user truncation and skip already-deleted users - #2197
Merged
Conversation
`tailor seed apply --truncate` deleted every IdP `_User` record inside a single TestExecScript call, so a few dozen users were enough to exceed the operator API deadline, and a user that was listed but gone by delete time failed the run on every retry. Split truncation into a listing script and a delete script that receives one chunk of 25 users per call, mirroring the `_User` upsert path, and count a "not found" delete as already deleted so truncation is idempotent.
…ially fails Also drop the derivable `total` from the listing script result.
…ugins Published seed plugins run the truncate script without input, so fall back to listing and deleting every user when no chunk is passed. Match only "user not found" when treating a delete as already done, since the gRPC code text of every NotFound error also contains "not found", and fail early with a clear message when the installed sdk lacks the listing script.
🦋 Changeset detectedLatest commit: 1303d70 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
@tailor-platform/create-sdk
@tailor-platform/eslint-plugin-sdk
@tailor-platform/sdk
@tailor-platform/sdk-plugin-seed
@tailor-platform/sdk-plugin-setup
@tailor-platform/sdk-plugin-tailordb-erd
commit: |
This comment has been minimized.
This comment has been minimized.
toiroakr
reviewed
Aug 29, 2026
This comment has been minimized.
This comment has been minimized.
toiroakr
reviewed
Aug 30, 2026
Code Metrics Report (packages/sdk)
Details | | main (c4da7c8) | #2197 (3acc9b3) | +/- |
|--------------------|----------------|-----------------|-------|
+ | Coverage | 81.5% | 81.5% | +0.0% |
| Files | 502 | 502 | 0 |
| Lines | 19742 | 19744 | +2 |
+ | Covered | 16107 | 16109 | +2 |
+ | Code to Test Ratio | 1:0.5 | 1:0.5 | +0.0 |
| Code | 147588 | 147745 | +157 |
+ | Test | 75733 | 75858 | +125 |Code coverage of files in pull request scope (100.0% → 100.0%)
SDK Configure Bundle Size
Runtime Performance
Type Performance (instantiations)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tailor seed apply --truncateno longer fails withdeadline_exceededonce the IdP holds more than a few dozen_Userrecords, and a user that is listed but already gone by the time it is deleted no longer fails every run.After
When a chunk still fails (for example
permission denied), the run reports the confirmed counts as a warning and exits non-zero; re-running is safe because already-deleted users are skipped.Affected surfaces
SeedIdpUserContext(@tailor-platform/sdk/cli): new requiredlistScriptCode;truncateScriptCodenow deletes the{ users, offset, total }chunk it receives, and still lists and deletes every user when called without input.Notes
@tailor-platform/sdk-plugin-seed0.2.x keeps working with this sdk through that no-input fallback. The reverse pairing (new plugin, older sdk) fails early asking to update the sdk.permission deniedon delete still fails the run; it is a server-side authorization decision and out of scope here.