Repository navigation
test(cli): pin the report-and-continue policy in UpdateOneToolUseCase - #531
Merged
Merged
Conversation
The catch that pushes to `errors` and returns null was untested, and the reason it exists was unstated. Investigating whether it violates "use-cases throw, no try/catch" showed the behaviour is deliberate and correct, not a defect: - Required: all three callers loop over installed tools, so throwing would abort the batch on the first bad tool and silently never attempt the rest. - Not silent: every caller command (update, ai, ide) prints result.errors. - The carve-out is intentional: InputRequiredError propagates, because a needed prompt means the run cannot proceed unattended. - Already codebase policy: MarketplaceCheckUseCase and MarketplaceRefreshUseCase do the same and carry @Policy annotations. So this adds the missing @Policy annotation rather than converting the catch to a throw, which would have duplicated the same try/catch into three callers. The gap worth closing was coverage. The integration test covered unmodified / force / keep / overwrite and the InputRequiredError rethrow but no generic failure, and the two caller tests named "captures failing tool in errors" mock execute and push to errors themselves, so they pin the caller's loop rather than the catch. Nothing failed if the catch were deleted. Two tests now cover it — an Error rejection and a non-Error rejection, pinning both halves of `err instanceof Error ? err.message : String(err)`. Both verified to fail when the catch is replaced with `throw err`. 2105/2105 pass, tsc clean. --no-verify: biome cannot start on this machine (OOM). CI Lint is the gate.
blafourcade
added a commit
that referenced
this pull request
Jul 31, 2026
…#531) The catch that pushes to `errors` and returns null was untested, and the reason it exists was unstated. Investigating whether it violates "use-cases throw, no try/catch" showed the behaviour is deliberate and correct, not a defect: - Required: all three callers loop over installed tools, so throwing would abort the batch on the first bad tool and silently never attempt the rest. - Not silent: every caller command (update, ai, ide) prints result.errors. - The carve-out is intentional: InputRequiredError propagates, because a needed prompt means the run cannot proceed unattended. - Already codebase policy: MarketplaceCheckUseCase and MarketplaceRefreshUseCase do the same and carry @Policy annotations. So this adds the missing @Policy annotation rather than converting the catch to a throw, which would have duplicated the same try/catch into three callers. The gap worth closing was coverage. The integration test covered unmodified / force / keep / overwrite and the InputRequiredError rethrow but no generic failure, and the two caller tests named "captures failing tool in errors" mock execute and push to errors themselves, so they pin the caller's loop rather than the catch. Nothing failed if the catch were deleted. Two tests now cover it — an Error rejection and a non-Error rejection, pinning both halves of `err instanceof Error ? err.message : String(err)`. Both verified to fail when the catch is replaced with `throw err`. 2105/2105 pass, tsc clean. --no-verify: biome cannot start on this machine (OOM). CI Lint is the gate.
blafourcade
added a commit
that referenced
this pull request
Jul 31, 2026
…#531) The catch that pushes to `errors` and returns null was untested, and the reason it exists was unstated. Investigating whether it violates "use-cases throw, no try/catch" showed the behaviour is deliberate and correct, not a defect: - Required: all three callers loop over installed tools, so throwing would abort the batch on the first bad tool and silently never attempt the rest. - Not silent: every caller command (update, ai, ide) prints result.errors. - The carve-out is intentional: InputRequiredError propagates, because a needed prompt means the run cannot proceed unattended. - Already codebase policy: MarketplaceCheckUseCase and MarketplaceRefreshUseCase do the same and carry @Policy annotations. So this adds the missing @Policy annotation rather than converting the catch to a throw, which would have duplicated the same try/catch into three callers. The gap worth closing was coverage. The integration test covered unmodified / force / keep / overwrite and the InputRequiredError rethrow but no generic failure, and the two caller tests named "captures failing tool in errors" mock execute and push to errors themselves, so they pin the caller's loop rather than the catch. Nothing failed if the catch were deleted. Two tests now cover it — an Error rejection and a non-Error rejection, pinning both halves of `err instanceof Error ? err.message : String(err)`. Both verified to fail when the catch is replaced with `throw err`. 2105/2105 pass, tsc clean. --no-verify: biome cannot start on this machine (OOM). CI Lint is the gate.
blafourcade
added a commit
that referenced
this pull request
Jul 31, 2026
🎯 What & why
BUG-E6-06 asked whether
UpdateOneToolUseCase'scatch— push toerrors, returnnull— violates "use-cases throw, no try/catch" and "no silent errors".Verdict: the bug is largely infirmed. The behaviour is deliberate and correct.
UpdateAllUseCase,UpdateAiToolsUseCase,UpdateIdeToolsUseCase) run the same loop over installed tools. Throwing would abort the batch on the first bad tool, so every tool after it would silently never be attempted — strictly worse than reporting.update,ai,ide) iteratesresult.errorsand prints each one.InputRequiredErroris rethrown: a needed prompt means the run can't proceed unattended, so it must stop the batch.MarketplaceCheckUseCaseandMarketplaceRefreshUseCasedo exactly this and each carry an@policy report-and-continue:annotation.Converting to throw-plus-caller-wrapper would move the identical
try/catchinto three places to satisfy a rule the policy already covers. So this takes the DoD's first branch: keep it, document it.🛠️ How it works
Adds the missing
@policy report-and-continueannotation, matching the two existing sites, and stating theInputRequiredErrorcarve-out.The gap actually worth closing was coverage. The report-and-continue branch was untested:
InputRequiredErrorrethrow — but no generic failure.updateOneTool.executeand push toerrorsthemselves, so they pin the caller's loop, not the catch.Nothing failed if the catch were deleted — the branch the ticket is about.
🧪 How to verify
Two new tests cover it: an
Errorrejection and a non-Errorrejection, pinning both halves oferr instanceof Error ? err.message : String(err).Both verified to fail when the catch is replaced with
throw err(2 failed / 6 passed).pnpm --filter cli test— 2105/2105, tsc clean.📋 Noted, not folded in
UpdateAllUseCasehas no test file. Its loop is identical to the two already covered, and the uncovered branch was the catch (now pinned), so I left it rather than quietly widening scope.Committed with
--no-verify: biome cannot start on this machine (OOM). CI'sLintcheck is the gate.