Skip to content

fix(migrate): list no unconfirmed user an undo deleted - #610

Open
royanger wants to merge 1 commit into
mainfrom
ra/aie-2014-clerk-migrate-runs-id-an-undone-run-still-lists-a-user-as
Open

royanger wants to merge 1 commit into
mainfrom
ra/aie-2014-clerk-migrate-runs-id-an-undone-run-still-lists-a-user-as

Conversation

@royanger

@royanger royanger commented Nov 4, 2026

Copy link
Copy Markdown
Member

Summary

Undoing an interrupted import deletes the user whose create had no answer: undo finds it by the run's marker. Afterwards, clerk migrate runs <id> for the import still listed that user under "Not confirmed (Clerk may have created them; a continue checks)". The user was gone, and no continue could run after the undo.

Changes

  • runs <id> reads the deleted lines of every undo of the run, and leaves the users they deleted out of "Not confirmed" and out of unconfirmed in --json.
  • A user no undo deleted stays listed, because Clerk may still hold it. One case: undo found a user by external_id without this run's marker, so it left the user in Clerk. Hiding the whole list for any undone run would have dropped that user too.
  • The Result line (1 created, 1 not confirmed) is unchanged. It records what the import did, like the run's other counts.

Testing

  • New runs.test.ts case: an undone import with two creating users, one of which the undo deleted. Only the other is listed, in human output and --json. Checked that it fails without the fix.
  • bun test src/ --parallel in packages/cli-core: 6599 pass. Typecheck, oxfmt, and oxlint are clean.

References

🤖 Generated with Claude Code

Undo deletes a user whose create was cut off when it finds it by the
run's marker, and writes the delete to its own run. `runs <id>` read
only the import's lines, so it kept listing that user under "Not
confirmed (Clerk may have created them; a continue checks)" after the
undo. It now leaves out any user an undo of the run deleted, in the
human output and in `unconfirmed` in --json. A user no undo deleted
stays listed, since Clerk may still hold it.

Fixes AIE-2014

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 64b4d75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
clerk Patch

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

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

showJson now excludes creating lines from the unconfirmed list when their source IDs appear as deleted in associated undo runs. A test checks that the deleted user is absent from both JSON and text output while the other unconfirmed user remains. The README and changeset document this behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Low

Merge Risk: Minimal · up to 64b4d

Recorded undo deletions are excluded from the listing, while other unconfirmed users remain. No merge-blocking issue was established.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the main change: undo-deleted users are no longer listed as unconfirmed in migrate runs output. It matches the changeset, which changes runs.ts to exclude users deleted by undo runs fr…
Description check Passed The description matches the changeset. It explains that migrate runs lists a user that an undo already deleted under Not confirmed. It says the fix reads deleted lines from undo runs and excludes…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: undo-deleted users are no longer listed as unconfirmed in migrate runs output. It matches the changeset, which changes runs.ts to exclude users deleted by undo runs from the unconfirmed list. The title uses the conventional fix(migrate) prefix and is specific.

Full details: Description check

Explanation

The description matches the changeset. It explains that migrate runs <id> lists a user that an undo already deleted under Not confirmed. It says the fix reads deleted lines from undo runs and excludes those users from the unconfirmed list and the JSON output. It also covers the test case and the test results, which align with the runs.test.ts addition.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files. (2 skipped: 2 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 03230724-c1f5-4c8d-b222-f5350523c26a
Commits

Reviewing files that changed from the base of the PR and between 4b196c7 and 64b4d75.

Files selected for processing: 4
  • .changeset/migrate-runs-undone-unconfirmed.md
  • packages/cli-core/src/commands/migrate/README.md
  • packages/cli-core/src/commands/migrate/runs.test.ts
  • packages/cli-core/src/commands/migrate/runs.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.

@blacksmith-sh

blacksmith-sh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Matches runs drops users an undo deleted

After a real import cut off mid-create and an undo that deleted alice by the run's marker, runs lists only bob as not confirmed in both the human output and --json; before, it listed alice and bob.

Merge-base

Before: alice still listed

This PR 64b4d757

After: alice gone

After: bob still listed

Caution

New issue found while testing

Not-confirmed count ignores the undo

After the undo, runs lists 1 not-confirmed user but its Result line, run.counts.creating in --json, and the runs listing still say 2 not confirmed.

Proof on 64b4d757 · Did Proof get it right? Yes · No

View full Proof report

@royanger
royanger requested a review from manovotny November 5, 2026 06:16
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.

1 participant