Repository navigation
refactor(contracts): declare the scroll reasons in one typed table with their owning command - #4820
Conversation
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on b844ca5. The verdict and the full list are in the summary comment.
|
The refactor looks sound at b844ca5, but one doc sentence names a reason that cannot arrive on the CLI. CI is green, including the diff-relevant jobs, Repo Guards & Compatibility and Lint/Typecheck/Package. Before merge, the commands.md sentence needs a fix. The new sentence at website/docs/docs/commands.md:652 says an out-of-range Not blocking, and you can take or leave these: the assertion in scroll.test.ts:76 now compares the table to itself, so asserting the literal The open thread on the missing Not verified here: the R89 388/194 to 378/190 counts were not re-measured. The diff removes 10 measured literals across 4 files, which matches the claimed deltas, and the R89 no-growth gate passes in CI. The local gate list from the PR body was not re-run. There are no conflicts. |
…th their owning command Every scroll details.reason is one row of SCROLL_REASONS, and each construction site reads the row, so an undeclared reason does not compile. The wire values are unchanged. The table supersedes SCROLL_REFRESH_REFUSALS and the SCROLL_KEYBOARD_OCCLUDES_SURFACE_REASON constant. scripts/command-docs/reasons.ts groups the rows by command for the command reference. commands.md now names the seven scroll reasons it omitted. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…contracts subpath The published-reason docs guard reads the scroll table, a new guard holds each reason to one owning command, and the contracts export snapshot lists the scroll-reasons entry. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…heck every reason row's owner Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
b844ca5 to
56de069
Compare
|
Fixed at
Local: build, typecheck, the owner and reason-docs guards, the Apple scroll tests, |
This comment has been minimized.
This comment has been minimized.
|
One doc sentence still needs a fix at 56de069. The The new sentence at commands.md:659 says the Node client and MCP reject an out-of-range Not verified here: the client and MCP routes were traced by reading the code and not run. A single Not blocking: The only open inline thread, #4820 (comment) (reasons module not reachable from public exports), no longer applies and can be resolved. CI is green at this head and there are no conflicts. Once the doc sentence is fixed, this is ready. |
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Fixed at |
This comment has been minimized.
This comment has been minimized.
|
At 644859a the routing sentence from the last review is fixed: the docs now say the CLI rejects an out-of-range One precision note, take or leave: the missing-until sentence in commands.md#L659 promises For a follow-up issue: the repo guards could register each command reason table once in the existing The earlier inline thread on the reasons module export no longer applies and can be resolved: #4820 (comment) Not verified here: the Node client and MCP routes were traced by reading the code and not run. |
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Optional precision taken at |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on fc80f70. The verdict and the full list are in the summary comment.
| - `scroll refresh` is one slow pull down (`scroll up 0.4 --duration-ms 1200` by default; an amount, `--pixels`, or `--duration-ms` overrides it). On iOS, the pull runs down the middle of the screen. A list that sits only in the top or bottom part of the screen is not pulled. | ||
| - With a keyboard up, the scroll stays above the keyboard and leaves it open. The result reports this as `keyboardAvoided` and `keyboardMinY`. If too little room is left, end editing first. On Android, use `keyboard dismiss`. On iOS, use a visible dismissal control. | ||
| - A refused scroll names its cause in `details.reason`, and the hint gives the next step. The reasons are `scroll_refresh_not_at_top` (run `scroll top` first), `scroll_until_no_progress`, `scroll_until_edge_reached`, `scroll_keyboard_occludes_surface`, and `scroll_no_progress`. | ||
| - A refused scroll names its cause in `details.reason`, and the hint gives the next step. The reasons are `scroll_refresh_not_at_top` (run `scroll top` first), `scroll_keyboard_occludes_surface`, and `scroll_no_progress`. With `--until`, they are `scroll_until_pass_limit`, `scroll_until_edge_reached`, `scroll_until_no_progress`, and `scroll_until_capture_unreadable`. For `scroll top` and `scroll bottom`, they are `scroll_edge_pass_limit`, `scroll_edge_no_progress`, and `scroll_edge_capture_unreadable`. `--max-passes` without `--until` fails with `INVALID_ARGS` and `scroll_max_passes_requires_until`. The CLI checks the range first: it rejects an out-of-range `--max-passes` with `INVALID_ARGS` and no reason before the command runs, with or without `--until`. The Node client and MCP send the value to the daemon, which fails with `INVALID_ARGS` and `scroll_max_passes_invalid`. |
There was a problem hiding this comment.
No longer raised on c03d507: marked fixed in c03d507 by thymikee in this comment; the code it pointed at changed.
🆕 🟡 Minor · commands.md says MCP out-of-range --max-passes fails in the daemon, but the tool input layer bounds it first
A caller that sends maxPasses: 500 through the MCP / AI SDK tool surface is refused at the tool-input layer, not by the daemon's assertScrollUntilCompatible, because scrollFields.maxPasses is integerField(..., { min: 1, max: SCROLL_UNTIL_MAX_PASSES }) and buildOptionField copies those bounds. The new commands.md sentence attributes a daemon reason (scroll_max_passes_invalid) to a path that may not reach it.
Suggested change
Confirm which layer refuses an out-of-range maxPasses for the MCP and AI SDK audiences and state that layer's error in commands.md; drop the claim that the daemon reports scroll_max_passes_invalid there if the tool schema rejects it first.
Details
Also raised here
Also raised at this location by persona senior-developer: commands.md says the range is checked first; the daemon checks until-presence first — The bullet at website/docs/docs/commands.md:659 states "The CLI checks the range first: it rejects an out-of-range --max-passes with INVALID_ARGS and no reason before the command runs", which holds for a CLI caller. The next sentence says the Node client and MCP "fail with INVALID_ARGS and scroll_max_passes_invalid", but assertScrollUntilCompatible tests until === undefined before the range, so scroll down --max-passes 500 from the Node client reports scroll_max_passes_requires_until and says nothing about the out-of-range value. Only a client that also passes --until reaches scroll_max_passes_invalid. Say the range error comes only for a request that carries until.
persona: javascript, senior-developer
Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.
Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if it is wrong — I will re-check the cited code.
There was a problem hiding this comment.
Both points confirmed and fixed at c03d507b8c. This time I ran the code instead of reading it:
- MCP:
runCommandgoes throughinvoke, which calls the field reader.readInput({ direction: 'down', until, maxPasses: 500 })throwsINVALID_ARGS"Expected maxPasses to be at most 200." with no reason, with or withoutuntil. So MCP refuses before the daemon, like the CLI. - Node client:
prepareDaemonCommandRequest('scroll', { …, maxPasses: 500 })returns the request withmaxPasses: 500intact, so the value reaches the daemon. - Daemon order:
assertScrollUntilCompatibletestsuntilbefore the range, so the range reason needs a request that carriesuntil.
The sentence now says: the CLI and MCP reject an out-of-range value with INVALID_ARGS and no reason; the Node client reaches the daemon, where the value fails with scroll_max_passes_invalid when until is present and scroll_max_passes_requires_until when it is not. I left the AI SDK out because I did not trace it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
The earlier evidence request is now satisfied, and this PR is ready at c03d507. The docs now state the CLI/MCP range-first rule and the daemon ordering, which matches scroll-command.ts. Not blocking, and fine to take or leave: commands.md:659 lists The one earlier inline thread on the range-first docs is fixed at this head, so it can be resolved: #4820 (comment) All 23 checks pass, and the change since the last review is one docs sentence. No conflicts are known. Not verified here: the CLI and MCP paths were not executed, and the review relied on the declared min/max in the flag and field definitions plus the author's run. Nothing else needs to happen before merge. |
Summary
error.details.reasonis published vocabulary, but most reasons are string literals atnew 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.SCROLL_REASONS.<member>.reason. An undeclared reason does not compile. Wire values are unchanged; the tests that pin the literals are untouched.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
Validation
At b844ca5, local:
pnpm build;check:layering,check:fallow,check:production-exports,check:command-docs,check:daemon-wire-compat,check:quickall 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
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.