Repository navigation
fix(admin): fix error handling and exit codes in admin CLI commands - #161
Conversation
remove-all-instances: wrap per-instance call in inner try/catch so one failure doesn't abort remaining instances (Eyevinn/osaas-app#5672) remove-exceeding-tenant-instances: add instancesFailed/tenantsFailed counters and set non-zero exit code on any failure so admin-daily CronJob correctly records failures (Eyevinn/osaas-app#5673) Co-Authored-By: Claude <noreply@anthropic.com>
Research ReviewVerified
remove-all-instances fix (osaas-app#5672): Inner try/catch now wraps each remove-exceeding-tenant-instances fix (osaas-app#5673):
Counter coverage: All failure paths increment a counter. Needs Verification (non-blocking, pre-existing)
Adjacent Stubs DetectedNone found in touched file. Orphaned Files Detected
Escape Hatch CoverageNo new terminal-rejection branches introduced. Object Shape VerificationNo ORM/SDK object spreads introduced. Impact Analysis
Risks Not Tested
Verdict: CLEAR — both bugs are correctly fixed. Inner try/catch isolation is verified, counters cover all failure paths, Reviewed by PR Research Validator. This review checks whether code is based on verified sources rather than assumptions. |
…sage Co-Authored-By: Claude <noreply@anthropic.com>
PR Research ReviewVerified
Needs Verification
Adjacent Stubs DetectedNone found. Orphaned Files DetectedNone. Escape Hatch CoverageNo new terminal-rejection branches introduced. Object Shape VerificationNo spreads of ORM/fetched objects in the diff. Impact Analysis
Risks Not Tested
Does not block merge. The implementation correctly mirrors PR #158's verified pattern, counter logic is sound, exit-code placement is correct for the stated goals, and no fabricated contracts or invented API shapes were found. The outer-catch exitCode gap is a pre-existing limitation worth a follow-up issue but does not affect the correctness of what this PR claims to fix. Reviewed by PR Research Validator. This review checks whether code is based on verified sources rather than assumptions. |
Fixes two bugs in the admin CLI:
1.
remove-all-instances(Eyevinn/osaas-app#5672)The for loop had only an outer try/catch — first failure aborted all remaining instances. Added inner try/catch per item (same pattern as
remove-exceeding-tenant-instancesalready had after PR #158), tracking removed/failed counts.2.
remove-exceeding-tenant-instances(Eyevinn/osaas-app#5673)Added
instancesFailed/tenantsFailedcounters and setprocess.exitCode = 1on any failure, so theadmin-dailyCronJob correctly records failures rather than always showing Succeeded.Lessons
Per-item error isolation in admin bulk operations should always use inner try/catch. A single outer catch that catches the loop is a 1-failure-aborts-all pattern. The fix for one command was already done in PR #158 68 lines above — checking sibling commands for the same pattern would have caught this earlier.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com