* refactor(query): deepen runtime context, native adapter, and cli output seams * chore(changeset): add fragment for query seam deepening continuation * refactor(query): converge internal command-resolution imports on canonical seam * refactor(query): remove dead seam wrappers and converge on canonical modules * docs(architecture): update context and adr for query seam completion * fix(query): preserve gsd-tools stderr in cli output and clarify static ws test scope * test(query): cover whitespace stderr and null exitCode fallback
1.5 KiB
Dispatch policy module as single seam for query execution outcomes
We decided to centralize query dispatch outcomes in one Dispatch Policy Module that returns a structured union result (ok success or failure with typed kind, details, and final exit_code) instead of mixing throws and ad-hoc error mapping across CLI and SDK paths. This keeps fallback policy, timeout classification, and exit mapping in one place for better locality, prevents drift between native and fallback behavior, and makes callers thin adapters over a stable interface.
Amendment (2026-05-03): query seam deepening completion
To complete the query architecture pass, we deepened adjacent seams around the Dispatch Policy Module:
- Extracted Query Runtime Context Module to own
projectDir+wsresolution policy. - Extracted Native Dispatch Adapter Module so Dispatch Policy consumes a stable native dispatch Interface (not closure-wired call sites).
- Extracted Query CLI Output Module to own projection from dispatch results/errors to CLI output contract.
- Converged internal command-resolution and policy imports onto canonical modules and removed dead wrapper modules.
Dead-wrapper convergence
Removed wrapper Modules after call-site convergence:
normalize-query-command.tscommand-resolution.tspolicy-convergence.tsquery-policy-snapshot.tsquery-registry-capability.ts
This amendment preserves the original ADR direction: keep policy depth high, adapters thin, and locality concentrated in explicit modules.