refactor(contracts): declare the scroll reasons in one typed table with their owning command
Summary
error.details.reason is published vocabulary, but most reasons are string literals at new AppError(...) sites with no owner. This PR sets the pattern on the scroll family.
packages/contracts/src/scroll-reasons.tsdeclaresSCROLL_REASONS: one row per reason,{ reason, command }, typed byCommandReasonRow. No prose.- All 12 scroll construction sites read
SCROLL_REASONS.<member>.reason. An undeclared reason does not compile. Wire values are unchanged; the tests that pin the literals are untouched. - The table supersedes
SCROLL_REFRESH_REFUSALSandSCROLL_KEYBOARD_OCCLUDES_SURFACE_REASON. The runner row for the keyboard refusal carries no reason, so the table is its only source. test/repo-guards/command-reason-owners.test.tschecks every row: itscommandis a CLI command and no two rows share a reason. The command reference will read the table directly when it prints refusal reasons.commands.mdnow names the seven scroll reasons it omitted.
Not device-facing: behavior and wire output are unchanged.
Value
| base | head | |
|---|---|---|
| R89 untyped reason sites | 388 in 194 files | 378 in 190 files |
| Scroll reasons with a declared owner | 0 | 12 |
| Scroll reasons checked against commands.md | 0 | 12 |
Validation
At b844ca59d6, local: pnpm build; check:layering, check:fallow, check:production-exports, check:command-docs, check:daemon-wire-compat, check:quick all pass; 276 unit-core files (3373 tests) pass, including the eager-closure budget, repo guards, and the scroll tests in contracts, daemon, capture-kit, platform-apple and platform-android. CI owns the full suite.
Risk: the eager-closure budget admits a new table module only at flat statement weight. Here three superseded statements pay for it; later families need the same or a maintainer decision.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.