From fd0ca09590a1b36c3df9fd417a4874663b2a4465 Mon Sep 17 00:00:00 2001 From: Evgeniy Podivilov Date: Tue, 21 Jul 2026 21:45:11 +0100 Subject: [PATCH] docs: record the Result-handling convention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port calls return Result and every one must be checked. The single deliberate exception — best-effort worktree rollback in the create cleanup handler — now carries an "// ignored: " marker so review can tell intent from oversight. Mechanical enforcement was considered and deferred: Biome 2.x GritQL has no type information, so a syntactic rule would need a hand-maintained list of ~42 port method names, and adding a second type-aware linter is disproportionate for a bug class with no live instances. --- CLAUDE.md | 6 ++++++ src/cli/commands/create.ts | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 591e7d8..47d0b99 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -46,3 +46,9 @@ src/ - Ports & Adapters: interfaces in `domain/ports/`, implementations in `infrastructure/adapters/` - External libraries (clack, picocolors) only in `infrastructure/` - Exception: valibot in `domain/schemas/` (declarative type definitions) + +### Result handling + +- Every `Result` from a port call must be checked (`.success` / `Result.isOk` / `Result.isErr`) before the code moves on +- A deliberately discarded `Result` is marked with `// ignored: ` so review can tell intent from oversight +- Mechanical enforcement was considered and deferred: Biome 2.x GritQL has no type information, so a syntactic rule would need a hand-maintained list of ~42 port method names, and a second type-aware linter is disproportionate for a bug class with no live instances diff --git a/src/cli/commands/create.ts b/src/cli/commands/create.ts index 5e84715..a1927f5 100644 --- a/src/cli/commands/create.ts +++ b/src/cli/commands/create.ts @@ -127,6 +127,8 @@ export function createCommand(container: Container) { const cleanup = new CleanupHandle(); cleanup.register(async () => { + // ignored: best-effort rollback on an already-failing path — a failed cleanup + // has no useful handling and must not mask the original error await git.removeWorktree(createResult.data.worktree.path, { force: true }); });