Repository navigation
feat(db): add manual Trigger.dev task for the account token sealing backfill - #9393
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 3 files
This PR changes a database schema or migrates data. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
[Critical impact] The follow-up appears safe to merge, with both previous findings addressed and no new actionable issues found. SummaryAdds a manual Trigger.dev task to seal or unseal account tokens using the existing backfill.
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
seal-account-tokens, a manual-only Trigger.dev task that runs the existing0037_seal_account_tokensbackfill from a worker, which already has the database and the fleet'sENCRYPTION_KEY(no scheduler, no app dispatch; queue concurrency 1,small-1x, 3h max duration, no retries){ mode: 'seal' | 'unseal', dryRun, expectedKeyId, batchSize?, pauseMs? }; returns{ keyId, scanned, pending, updated, foreignKey }as the run outputexpectedKeyIdis not the worker's own derived key id (replaces the CLI's ack env var), and refusessealwhileENCRYPT_ACCOUNT_TOKENSis off on the worker;unseal(the rollback) stays alloweddbclient resolves: the pass binds JS arrays through the postgres.js tag, which needs the array type map the shared pool skips (fetch_types: false), and it sets no startupsearch_path, which PgBouncer rejectsisAccountTokenWriteSealingEnabled()from@sim/db/sealed-textso the task checks the same predicate writers use; the script migration stays unregistered from the deploy runnerType of Change
Testing
background/seal-account-tokens.test.ts(3 tests): key-id mismatch and flag-off seal both reject without opening a connection; unseal with the flag off runs to completion. Each test goes red when its guard is removedChecklist
test-auditauthoring gate)