fix: report site/adapter-source command errors cleanly instead of crashing - #327
fix: report site/adapter-source command errors cleanly instead of crashing#327ayushsingh82 wants to merge 1 commit into
Conversation
…shing webcmd site * (notes, endpoints, field-maps, fixtures, samples) and adapter source get/put/path had no error handling, so any failure surfaced as a raw unhandled-rejection stack trace and always exited 1, discarding the intended CliError exit code (e.g. a missing fixture should exit 66, a bad flag 2). Wrap these actions the same way the rest of the CLI reports errors. Also adds e2e coverage for the local-mode portion of the manual QA checklist in agentrhq#311 (override/source workflow, site memory, browser init/verify flags, mutable input-output files).
|
@beubax mind taking a look? Quick summary of what's here: Working through the local-mode checklist in #311, every Full details and test plan are in the PR description above. Happy to adjust scope if you'd rather this land as smaller pieces. |
🟠 Maintainer review suggested — low confidenceThe automated review could not reach a fully supported conclusion. Limitations
This review is advisory and does not block merging. |
Summary
Working through the local-mode portion of the manual QA checklist in #311, I found that every
webcmd site *subcommand (notes, endpoints, field-maps, fixtures, samples) andwebcmd adapter source get/put/adapter pathhad no error handling in their commander actions. Any failure — a missing fixture, an invalid site name, a duplicate field-map key, an unsupported local write — surfaced as a raw unhandled-rejection stack trace instead of the CLI's normalError: ...output, and always exited1regardless of the error's intended exit code (e.g.SITE_MEMORY_NOT_FOUNDshould exit66, anArgumentErrorshould exit2).src/site-memory/commands.ts(shared by local and hosted mode viaregisterSiteCommands) — added awrapActionhelper so every action reports errors and exit codes consistently.src/cli.ts— same fix foradapter source get,adapter source put, andadapter path.src/cli.test.ts— updated 3 pre-existing unit tests that had encoded the old crash-and-reject behavior as expected, to instead assert the clean error message + correctprocess.exitCode.tests/e2e/adapter-authoring-parity.test.ts(new, registered invitest.config.ts) — e2e coverage for the local-mode-testable sections of test: validate adapter authoring and override parity in local and hosted modes #311: mode boundaries, override/source/reset workflow, site memory + fixtures + samples,browser init/verifyand its flags, and mutable input-output files via a private test adapter.Sections of #311 requiring a live hosted Cloud deployment (workspace/user isolation, marketplace metadata) are out of scope here — this addresses the local-mode reliability gap surfaced while working through the checklist.
Test plan
npm run typechecknpm test(unit + plugin, 5589 passed)npx vitest run --project e2e tests/e2e/adapter-authoring-parity.test.ts(28 passed)site fixture get(missing → clean error, exit 66),site note add ../evil(clean error, exit 1),adapter source get --output(clean error, exit 2)