Skip to content

fix: use @clerk/backend for backfill script clerk client#6056

Merged
lancy merged 2 commits intomainfrom
fix/backfill-clerk-import
Mar 25, 2026
Merged

fix: use @clerk/backend for backfill script clerk client#6056
lancy merged 2 commits intomainfrom
fix/backfill-clerk-import

Conversation

@lancy
Copy link
Copy Markdown
Contributor

@lancy lancy commented Mar 23, 2026

Summary

  • Fix createClerkClient import in backfill script — the script runs via tsx outside Next.js runtime, so @clerk/nextjs/server doesn't export createClerkClient at ESM runtime (only in type declarations)
  • Switch to importing from @clerk/backend which is the actual source package
  • Add @clerk/backend as explicit dependency

Context

The backfill script (#5972, PR #5973) was merged with import { createClerkClient } from "@clerk/nextjs/server" which fails at runtime:

SyntaxError: The requested module '@clerk/nextjs/server' does not provide an export named 'createClerkClient'

Test plan

  • tsx scripts/migrations/005-backfill-clerk-metadata/backfill.ts runs successfully (dry-run mode)
  • All 17 backfill tests pass
  • Type check passes

🤖 Generated with Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4252 1 4251 1
View the top 3 failed test(s) by shortest run time
t04-vm0-artifact-checkpoint.bats::
Stack Traces | 0s run time
(from function `setup_file' in test file .../tests/03-runner/t04-vm0-artifact-checkpoint.bats, line 50)
  `$VM0_CLI compose "$TEST_CONFIG" >/dev/null' failed with status 124
t32-zero-timezone.bats::zero preference --timezone and TZ injection
Stack Traces | 5.65s run time
(in test file .../tests/03-runner/t32-zero-timezone.bats, line 99)
  `$ZERO_CLI preference --timezone "Asia/Tokyo" >/dev/null' failed
node:.../modules/cjs/loader:1386
  throw err;
  ^

Error: Cannot find module '.../hostedtoolcache/node/22.22.1.../x64/bin/zero'
    at Function._resolveFilename (node:.../modules/cjs/loader:1383:15)
    at defaultResolveImpl (node:.../modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:.../modules/cjs/loader:1030:22)
    at Function._load (node:.../modules/cjs/loader:1192:37)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:.../modules/cjs/loader:237:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
    at node:internal/main/run_main_module:36:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v22.22.1
t08-vm0-conversation-fork.bats::t08-3: fork from conversation uses new artifact version
Stack Traces | 6.06s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t08-vm0-conversation-fork.bats, line 134)
  `assert_success' failed
# Creating initial artifact...
# Running agent to create conversation...

-- command failed --
status : 1
output (17 lines):
  node:.../modules/esm/resolve:205
    const resolvedOption = FSLegacyMainResolve(pkgPath, packageConfig.main, baseStringified);
                           ^

  Error: Cannot find package '.../hostedtoolcache/node/22.22.1....../x64/lib/node_modules/@.../node_modules/yaml/index.js' imported from .../hostedtoolcache/node/22.22.1....../x64/lib/node_modules/@vm0/cli/index.js
      at legacyMainResolve (node:.../modules/esm/resolve:205:26)
      at packageResolve (node:.../modules/esm/resolve:778:12)
      at moduleResolve (node:.../modules/esm/resolve:855:18)
      at defaultResolve (node:.../modules/esm/resolve:985:11)
      at #cachedDefaultResolve (node:.../modules/esm/loader:731:20)
      at ModuleLoader.resolve (node:.../modules/esm/loader:708:38)
      at ModuleLoader.getModuleJobForImport (node:.../modules/esm/loader:310:38)
      at ModuleJob._link (node:.../modules/esm/module_job:182:49) {
    code: 'ERR_MODULE_NOT_FOUND'
  }

  Node.js v22.22.1
--
t12-vm0-env-expansion.bats::vm0 run expands vars and secrets via --secrets flag
Stack Traces | 21.8s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t12-vm0-env-expansion.bats, line 82)
  `assert_success' failed
# Step 1: Create and push artifact
# Step 2: Build the compose
# Step 3: Run with --vars and --secrets flags

-- command failed --
status : 1
output (18 lines):
  node:internal/modules/run_main:123
      triggerUncaughtException(
      ^

  Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../hostedtoolcache/node/22.22.1........./x64/lib/node_modules/@.../node_modules/zod/index.js' imported from .../hostedtoolcache/node/22.22.1........./x64/lib/node_modules/@vm0/cli/index.js
  Did you mean to import "zod/index.cjs"?
      at finalizeResolution (node:.../modules/esm/resolve:275:11)
      at moduleResolve (node:.../modules/esm/resolve:861:10)
      at defaultResolve (node:.../modules/esm/resolve:985:11)
      at #cachedDefaultResolve (node:.../modules/esm/loader:731:20)
      at ModuleLoader.resolve (node:.../modules/esm/loader:708:38)
      at ModuleLoader.getModuleJobForImport (node:.../modules/esm/loader:310:38)
      at ModuleJob._link (node:.../modules/esm/module_job:182:49) {
    code: 'ERR_MODULE_NOT_FOUND',
    url: 'file://.../hostedtoolcache/node/22.22.1........./x64/lib/node_modules/@.../node_modules/zod/index.js'
  }

  Node.js v22.22.1
--
t13-vm0-cook.bats::cook command reads vm0.yaml and prepares agent with volume
Stack Traces | 27s run time
(from function `__assert_stream' in file .../bats-assert/src/assert_output.bash, line 238,
 from function `assert_output' in file .../bats-assert/src/assert_output.bash, line 125,
 in test file .../tests/03-runner/t13-vm0-cook.bats, line 76)
  `assert_output --partial "Running agent"' failed
# Step 1: Create vm0.yaml config with volume...
# Step 2: Create volume directory with test file...
# Step 3: Run cook without prompt (preparation only)...
# Step 4: Verify output...
# Step 5: Verify volume was initialized...
# Step 6: Verify artifact directory was created...
# Step 7: Run cook with prompt to test auto-pull...

-- output does not contain substring --
substring (1 lines):
  Running agent
output (35 lines):
  Reading config: vm0.yaml
  ✓ Config validated: 1 agent, 1 volume(s)

  Processing volumes:
  > cd e2e-cook-vol-1774425085594-17804
  > vm0 volume push
  > cd ..

  Processing artifact:
  > cd artifact
  > vm0 artifact push
  > cd ..

  Composing agent:
  > vm0 compose vm0.yaml
  node:fs:2791
        const stats = binding.lstat(base, true, undefined, true /* throwIfNoEntry */);
                              ^

  Error: ENOENT: no such file or directory, lstat '.../hostedtoolcache/node/22.22.1....../x64/lib/node_modules/@vm0/cli'
      at Object.realpathSync (node:fs:2791:29)
      at toRealPath (node:internal/modules/helpers:61:13)
      at Function._findPath (node:.../modules/cjs/loader:746:22)
      at resolveMainPath (node:internal/modules/run_main:39:23)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:163:20)
      at node:internal/main/run_main_module:36:49 {
    errno: -2,
    code: 'ENOENT',
    syscall: 'lstat',
    path: '.../hostedtoolcache/node/22.22.1....../x64/lib/node_modules/@vm0/cli'
  }

  Node.js v22.22.1
  ✗ Compose failed
    Cause: Command failed with exit code 1
--
t04-vm0-artifact-checkpoint.bats::t04-1: build agent configuration
Stack Traces | 55.1s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t04-vm0-artifact-checkpoint.bats, line 69)
  `assert_success' failed

-- command failed --
status : 124
output (8 lines):
  Uploading compose...
  ✓ Compose version exists: e2e-runner/e2e-t04-1774424407679-28695
    Version: e8bd9798

    Run your agent:
      vm0 run e2e-runner/e2e-t04-1774424407679-28695:e8bd9798 --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t45-vm0-network-logging.bats::t45-0: non-http tcp passes through mitmproxy
Stack Traces | 55.1s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 from function `create_agent' in file .../tests/03-runner/t45-vm0-network-logging.bats, line 34,
 in test file .../tests/03-runner/t45-vm0-network-logging.bats, line 44)
  `create_agent' failed

-- command failed --
status : 124
output (8 lines):
  Uploading compose...
  ✓ Compose created: e2e-runner/e2e-netlog-1774424402818-5773
    Version: cc75451d

    Run your agent:
      vm0 run e2e-runner/e2e-netlog-1774424402818-5773:cc75451d --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t45-vm0-network-logging.bats::t45-1: udp dns queries appear in network logs
Stack Traces | 55.1s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 from function `create_agent' in file .../tests/03-runner/t45-vm0-network-logging.bats, line 34,
 in test file .../tests/03-runner/t45-vm0-network-logging.bats, line 74)
  `create_agent' failed

-- command failed --
status : 124
output (8 lines):
  Uploading compose...
  ✓ Compose created: e2e-runner/e2e-netlog-1774424402886-32693
    Version: 750fad1e

    Run your agent:
      vm0 run e2e-runner/e2e-netlog-1774424402886-32693:750fad1e --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t13-vm0-cook.bats::cook command succeeds when variables are set via --env-file
Stack Traces | 57.7s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t13-vm0-cook.bats, line 121)
  `assert_success' failed
# Step 1: Create vm0.yaml with variable references...
# Step 2: Create .env file with values...
# Step 3: Run cook with --env-file (should succeed)...

-- command failed --
status : 124
output (24 lines):
  Reading config: vm0.yaml
  ✓ Config validated: 1 agent, 0 volume(s)

  Processing artifact:
  > mkdir artifact
  > cd artifact
  > vm0 artifact init --name artifact
  > vm0 artifact push
  > cd ..

  Composing agent:
  > vm0 compose vm0.yaml
  Uploading compose...

  ⚠ Missing secrets/variables detected:
    Variables: E2E_TEST_VAR

  ✓ Compose created: e2e-runner/e2e-cook-1774424792115-11747
    Version: d0475d04

    Run your agent:
      vm0 run e2e-runner/e2e-cook-1774424792115-11747:d0475d04 --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t13-vm0-cook.bats::cook command with skills downloads and composes correctly
Stack Traces | 58.6s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t13-vm0-cook.bats, line 151)
  `assert_success' failed
# Step 1: Create vm0.yaml config with skill...
# Step 2: Run cook without prompt (preparation only)...

-- command failed --
status : 124
output (29 lines):
  Reading config: vm0.yaml
  ✓ Config validated: 1 agent, 0 volume(s)

  Processing artifact:
  > mkdir artifact
  > cd artifact
  > vm0 artifact init --name artifact
  > vm0 artifact push
  > cd ..

  Composing agent:
  > vm0 compose --yes vm0.yaml
  Uploading 1 skill(s)...
    Downloading: https://github..../tree/main/github
    ✓ Skill (unchanged): github (e55f71d0)

  Skills require the following environment variables:

    Secrets:
      GH_TOKEN                 (new) <- github

  Uploading compose...
  ✓ Compose created: e2e-runner/e2e-cook-1774424407989-19765
    Version: 7828e583

    Run your agent:
      vm0 run e2e-runner/e2e-cook-1774424407989-19765:7828e583 --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t42-firewall-placeholder.bats::firewall: permission-based request matching
Stack Traces | 59.2s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t42-firewall-placeholder.bats, line 144)
  `assert_success' failed

-- command failed --
status : 124
output (8 lines):
  Uploading compose...
  ✓ Compose created: e2e-runner/e2e-firewall-1774424398910-9785-perm
    Version: 056ff2ad

    Run your agent:
      vm0 run e2e-runner/e2e-firewall-1774424398910-9785-perm:056ff2ad --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t42-firewall-placeholder.bats::firewall: connector auto-adds firewall without experimental_firewalls
Stack Traces | 59.3s run time
(from function `assert_success' in file .../bats-assert/src/assert_success.bash, line 45,
 in test file .../tests/03-runner/t42-firewall-placeholder.bats, line 196)
  `assert_success' failed

-- command failed --
status : 124
output (8 lines):
  Uploading compose...
  ✓ Compose created: e2e-runner/e2e-firewall-1774424398935-23416-auto
    Version: 737f2b92

    Run your agent:
      vm0 run e2e-runner/e2e-firewall-1774424398935-23416-auto:737f2b92 --artifact-name <artifact> "your prompt"

  ⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
--
t29-zero-secret.bats::vm0 run masks multiple CLI secrets in output
Stack Traces | 60s run time
(from function `teardown' in test file .../tests/03-runner/t29-zero-secret.bats, line 16)
  `$ZERO_CLI secret delete -y "$TEST_SECRET_NAME" 2>/dev/null || true' failed due to timeout
# Running agent with multiple CLI secrets...
# Output:
▶ Run started
  Run ID:   894fc4ec-d717-44fb-9fec-805b70cfc458
  (use "vm0 logs 894fc4ec-d717-44fb-9fec-805b70cfc458" to view logs)

▷ Claude Code Started
  Session: mock-1774424816563794
  Model: mock-claude
  Tools: Bash

● Executing command...

● Bash(echo API_KEY=$API_KEY && echo CLI_SECRET=$CLI_SECRET)
  └ API_KEY=***
    CLI_SECRET=***



◆ Claude Code Completed
  Duration: 0.1s
  Turns: 1
  Tokens: input=0 output=0

✓ Run completed successfully
  Checkpoint:    094a4552-29de-4940-8a04-89d31215dd85
  Session:       d5ee97d5-efd6-4ee9-94e4-d7e5c2256c7c
  Conversation:  215b49f0-c3ff-494e-87a4-dd03a3072ecf
  Artifact:
    e2e-secret-multi-1774424795936-879: a716666c

  View agent logs:
    vm0 logs 894fc4ec-d717-44fb-9fec-805b70cfc458
  Continue with session (latest conversation and artifact):
    vm0 run continue d5ee97d5-efd6-4ee9-94e4-d7e5c2256c7c "your next prompt"
  Resume from checkpoint (snapshotted conversation and artifact):
    vm0 run resume 094a4552-29de-4940-8a04-89d31215dd85 "your next prompt"

⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
Terminated
t31-zero-variable.bats::vm0 run expands server-stored variables
Stack Traces | 60s run time
(from function `teardown' in test file .../tests/03-runner/t31-zero-variable.bats, line 16)
  `$ZERO_CLI variable delete -y "$TEST_VAR_NAME" 2>/dev/null || true' failed due to timeout
✓ Variable "E2E_TEST_VAR_1774425352690_20363" saved
# Running agent that echoes variable value...
# Output:
▶ Run started
  Run ID:   e13f743d-f948-41c2-a822-626f3839564d
  (use "vm0 logs e13f743d-f948-41c2-a822-626f3839564d" to view logs)

▷ Claude Code Started
  Session: mock-1774425380789586
  Model: mock-claude
  Tools: Bash

● Executing command...

● Bash(echo MY_VAR=$MY_VAR)
  └ MY_VAR=var-value-1774425352706-14909



◆ Claude Code Completed
  Duration: 0.1s
  Turns: 1
  Tokens: input=0 output=0

✓ Run completed successfully
  Checkpoint:    a6d23a10-09b4-4116-937e-3b8431304568
  Session:       de42cb81-ae09-4f2c-a14b-cd7b94171b72
  Conversation:  703576ab-f913-47a3-be93-0cdd240868e8
  Artifact:
    e2e-var-expand-1774425352706-14909: 229815d3

  View agent logs:
    vm0 logs e13f743d-f948-41c2-a822-626f3839564d
  Continue with session (latest conversation and artifact):
    vm0 run continue de42cb81-ae09-4f2c-a14b-cd7b94171b72 "your next prompt"
  Resume from checkpoint (snapshotted conversation and artifact):
    vm0 run resume a6d23a10-09b4-4116-937e-3b8431304568 "your next prompt"
Terminated
t30-vm0-model-provider-inject.bats::model-provider credential is injected into container
Stack Traces | 60s run time
(in test file .../tests/03-runner/t30-vm0-model-provider-inject.bats, line 53)
  `$VM0_CLI compose "$TEST_DIR/vm0.yaml"' failed due to timeout
Uploading compose...
✓ Compose created: e2e-runner/mp-inject-1774424658033-20222
  Version: 2c1663a4

  Run your agent:
    vm0 run e2e-runner/mp-inject-1774424658033-20222:2c1663a4 --artifact-name <artifact> "your prompt"

⚠ vm0 auto upgrade failed. Please run: npm install -g @vm0/cli@latest
Terminated
t31-zero-variable.bats::vm0 run CLI vars override server-stored variables
Stack Traces | 60s run time
(from function `teardown' in test file .../tests/03-runner/t31-zero-variable.bats, line 16)
  `$ZERO_CLI variable delete -y "$TEST_VAR_NAME" 2>/dev/null || true' failed due to timeout
✓ Variable "E2E_TEST_VAR_1774425352746_3849" saved
# Running agent with CLI var override...
# Output:
▶ Run started
  Run ID:   6fc895e2-7e17-4341-a13a-951ea567064e
  (use "vm0 logs 6fc895e2-7e17-4341-a13a-951ea567064e" to view logs)

▷ Claude Code Started
  Session: mock-1774425381241758
  Model: mock-claude
  Tools: Bash

● Executing command...

● Bash(echo MY_VAR=$MY_VAR)
  └ MY_VAR=cli-value-1774425352757-19784



◆ Claude Code Completed
  Duration: 0.1s
  Turns: 1
  Tokens: input=0 output=0

✓ Run completed successfully
  Checkpoint:    f1056dea-c893-4ab0-8e7f-6296b87fcf0c
  Session:       dbd430ad-0932-49d9-80cd-b5e02e00be6f
  Conversation:  3dc8dddf-9034-47ce-a019-51eaf59e5cd8
  Artifact:
    e2e-var-override-1774425352757-19784: 112e780b

  View agent logs:
    vm0 logs 6fc895e2-7e17-4341-a13a-951ea567064e
  Continue with session (latest conversation and artifact):
    vm0 run continue dbd430ad-0932-49d9-80cd-b5e02e00be6f "your next prompt"
  Resume from checkpoint (snapshotted conversation and artifact):
    vm0 run resume f1056dea-c893-4ab0-8e7f-6296b87fcf0c "your next prompt"
Terminated
t29-zero-secret.bats::vm0 run masks secret values in output
Stack Traces | 60s run time
(from function `teardown' in test file .../tests/03-runner/t29-zero-secret.bats, line 16)
  `$ZERO_CLI secret delete -y "$TEST_SECRET_NAME" 2>/dev/null || true' failed due to timeout
# Running agent that echoes secret value...
# Output:
▶ Run started
  Run ID:   70fccb49-39f0-4bd4-931e-74e8a77db4e7
  (use "vm0 logs 70fccb49-39f0-4bd4-931e-74e8a77db4e7" to view logs)

▷ Claude Code Started
  Session: mock-1774424815216259
  Model: mock-claude
  Tools: Bash

● Executing command...

● Bash(echo SECRET=$MY_SECRET)
  └ SECRET=***



◆ Claude Code Completed
  Duration: 0.1s
  Turns: 1
  Tokens: input=0 output=0

✓ Run completed successfully
  Checkpoint:    c6a30471-f4d2-43b3-b759-18c46e866c6d
  Session:       dc4ff3c6-8d34-40b5-906c-e83aaef1b7a8
  Conversation:  3bc6b65f-ad56-415c-ba66-d52b38754a18
  Artifact:
    e2e-secret-mask-1774424789816-27275: e30d0803

  View agent logs:
    vm0 logs 70fccb49-39f0-4bd4-931e-74e8a77db4e7
  Continue with session (latest conversation and artifact):
    vm0 run continue dc4ff3c6-8d34-40b5-906c-e83aaef1b7a8 "your next prompt"
  Resume from checkpoint (snapshotted conversation and artifact):
    vm0 run resume c6a30471-f4d2-43b3-b759-18c46e866c6d "your next prompt"
Terminated

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 23, 2026

⚡ Lighthouse — Web

Category Score
🟠 Performance 69
🟢 Accessibility 96
🟠 Best Practices 79
🟢 SEO 92

Tested URL: https://pr-6056-www.vm6.ai/ · Full report

@e7h4n e7h4n added this to VM0 Kanban Mar 25, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in VM0 Kanban Mar 25, 2026
lancy and others added 2 commits March 25, 2026 07:28
The backfill script runs outside Next.js runtime via tsx, so
`createClerkClient` from `@clerk/nextjs/server` is not available
at ESM runtime (only re-exported in type declarations). Switch
to importing directly from `@clerk/backend` which is the actual
source package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dry-run mode should still read from Clerk API to show what
would be backfilled. Previously it skipped Clerk initialization
entirely, making dry-run output useless (0 processed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lancy lancy force-pushed the fix/backfill-clerk-import branch from 1e7d8bf to 7147476 Compare March 25, 2026 07:28
@lancy
Copy link
Copy Markdown
Contributor Author

lancy commented Mar 25, 2026

Code Review: PR #6056

Summary

This PR fixes a runtime import error in the backfill script (005-backfill-clerk-metadata) where @clerk/nextjs/server does not export createClerkClient at ESM runtime when run via tsx. The fix switches to importing from @clerk/backend directly and simplifies the Clerk client initialization logic.

Two well-separated commits:

  1. 86782f8 — Fix the import source from @clerk/nextjs/server to @clerk/backend
  2. 7147476 — Always initialize the Clerk client (including dry-run mode), removing unnecessary null guards

Key Findings

Critical Issues (P0)

  • None

High Priority (P1)

  • None

Testing Review

Coverage

  • fix: import from @clerk/backend instead of @clerk/nextjs/server → Covered by existing test suite (turbo/apps/web/src/__tests__/backfill-clerk-metadata.test.ts, 17 tests). Tests import the exported functions directly from the backfill module and exercise all three backfill phases.
  • fix: always initialize clerk client → Covered by existing tests. The backfillOrgMetadata, backfillOrgMembersMetadata, and backfillUsers functions are tested with both dry-run and migrate modes using mock Clerk clients.

Convention Compliance

  • No test files were modified in this PR
  • Existing tests use mock Clerk client objects (created via a mockClerkClient factory), which is acceptable since Clerk is an external dependency boundary
  • No convention violations detected

Testing Verdict: Adequate

Existing tests cover all changed behavior. The import fix is a runtime environment issue (tsx vs Next.js) that wouldn't be caught by vitest-based tests, but the PR description confirms manual verification (tsx scripts/migrations/005-backfill-clerk-metadata/backfill.ts runs successfully).

Bad Smell Analysis

All 17 bad smell categories checked — zero violations. The PR actually improves code quality:

  • Removed 3 defensive if (clerk) null guards
  • Removed conditional env var requirement pattern
  • Net reduction of ~10 lines in backfill.ts

Recommendations

No action items. This is a clean, well-scoped bug fix.

Verdict: LGTM


Full review details: codereviews/20260325/pr-6056/

@lancy lancy added this pull request to the merge queue Mar 25, 2026
Merged via the queue into main with commit 22d87e4 Mar 25, 2026
271 of 294 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in VM0 Kanban Mar 25, 2026
@github-actions github-actions Bot mentioned this pull request Mar 25, 2026
@github-actions github-actions Bot deleted the fix/backfill-clerk-import branch March 26, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants