refactor: extract verify flagged command#159
refactor: extract verify flagged command#159ndycode wants to merge 4 commits intorefactor/pr1-forecast-commandfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
codex auth verify-flaggedimplementation into a dedicated command moduleWhat Changed
lib/codex-manager/commands/verify-flagged.tsfor the flagged-account verification and restore flowlib/codex-manager.tssorunVerifyFlagged(...)delegates to the extracted command module through injected helpers and storage operationstest/codex-manager-verify-flagged-command.test.tsfor command-level coverageValidation
npm run test -- test/codex-manager-verify-flagged-command.test.ts test/codex-manager-cli.test.tsnpm run lintnpm run typechecknpm run buildRisk and Rollback
f12e002to restore the inline verify-flagged implementationAdditional Notes
note: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
this PR extracts the
codex auth verify-flaggedimplementation from the 3000-linecodex-manager.tsinto a dedicated, dependency-injected command module (lib/codex-manager/commands/verify-flagged.ts), continuing the manager-split refactor.the two most important correctness improvements over the inline version:
applyRefreshChecksis now a pure function that returns its result instead of closing over and mutating outerreports/nextFlaggedAccountsarrays — this eliminates the duplicate-push corruption on EBUSY transaction retriestransactionResult === undefinednow returns exit code 1 with an explicit error log instead of silently completing with zeroed counters — this is the windows-EBUSY-queue-exhaustion path flagged in prior reviewsthe test file adds 8 focused unit tests covering help, invalid args, JSON output, EBUSY retry isolation (both persist calls get the correct non-duplicated account list), dry-run,
--no-restore, human summary, and empty-list early-return paths.one remaining gap: the
!transactionResult→ exit-1 guard has no test. at an 80% coverage threshold this is the logical next step before the module is considered fully covered.Confidence Score: 5/5
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[runVerifyFlaggedCommand args, deps] --> B{--help / -h?} B -- yes --> C[printVerifyFlaggedUsage\nreturn 0] B -- no --> D[parseVerifyFlaggedArgs] D -- error --> E[logError + usage\nreturn 1] D -- ok --> F[loadFlaggedAccounts] F -- empty --> G{options.json?} G -- yes --> H[logInfo JSON empty\nreturn 0] G -- no --> I[logInfo No flagged accounts\nreturn 0] F -- accounts --> J[queuedRefresh for each account\nbuilds refreshChecks array] J --> K{options.restore?} K -- no --> L[applyRefreshChecks empty storage\nassignRefreshCheckResult] K -- yes --> M{options.dryRun?} M -- yes --> N[loadAccounts\napplyRefreshChecks\nassignRefreshCheckResult] M -- no --> O[withAccountAndFlaggedStorageTransaction\ncallback: applyRefreshChecks + persist] O --> P{transactionResult set?} P -- no --> Q[logError silent failure\nreturn 1] P -- yes --> R[assignRefreshCheckResult] L --> S[maybe saveFlaggedAccounts\nif flaggedChanged and not dryRun] N --> S R --> S S --> T{options.json?} T -- yes --> U[logInfo JSON summary\nreturn 0] T -- no --> V[logInfo human summary\nreturn 0]Prompt To Fix All With AI
Reviews (4): Last reviewed commit: "test: expand verify-flagged command cove..." | Re-trigger Greptile