Skip to content

feat(web): classify every config option for the page and publish three it ignored - #1339

Open
benvinegar wants to merge 1 commit into
claude/web-keybindings-page-commandsfrom
claude/web-config-option-support
Open

benvinegar wants to merge 1 commit into
claude/web-keybindings-page-commandsfrom
claude/web-config-option-support

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Stacked on #1338 (claude/web-keybindings-page-commands), which is itself stacked on #1337. This PR targets #1338's branch so the diff contains only its own work. Merge order: #1337, #1338, then this; retarget to main once they land.

Problem

Nothing made the author of a config option decide what the browser review page does with it. Each option is wired to the terminal by hand, and the page gets only what someone remembered to publish. Three options the terminal honors were silently ignored by the page:

Option Terminal Page before this PR
tab_width default 4, or the configured value never set the renderer's tab size, so tabs drew at its stylesheet default of 2
auto_split_min_width configured value compared against the built-in constant
sidebar true, false, or "auto" decided from the viewport and the browser's stored choice only

Approach

1. A typed classification of every config option (core/run/webConfigSupport.ts), modelled on what web/commands/webCommandTable.ts does for commands. One record keyed by every key of CONFIG_REFERENCE_OPTIONS, each entry one of:

  • published — the host sends the resolved value to the page as a session default, and the entry names the presentation field it lands in. applied: false marks a value the page receives and cannot act on yet, with a reason.
  • host-side — it changes the review's input or seeds shared state, so both surfaces see the result.
  • terminal-only — a terminal mechanism the page has no counterpart for.
  • deferred — the page should honor it and cannot yet.

Enforcement:

  • The config table is now a literal table, so its keys form ConfigOptionKey and the record is satisfies Record<ConfigOptionKey, WebConfigSupport>. An option with no entry fails to typecheck. The table's contents and its consumers (runtime parsing, the docs generator) are unchanged.
  • The host's view block is satisfies ReviewViewDefaults & Record<WebPublishedViewField, unknown>, so a published field the host does not send, or an extra one, fails to typecheck. sharedState.test.ts checks the same thing at runtime in both directions and that each published value follows the option it is classified from.
Class Options
Published mode, theme, wrap_lines, line_numbers, tab_width, auto_split_min_width, sidebar; hunk_headers is sent but not applied (hiding header rows needs the renderer)
Host-side vcs, watch, exclude_untracked, agent_notes
Terminal-only cursor_line, scroll_off, file_gap, hunk_gap, wheel_scroll_lines, menu_bar, copy_decorations, prompt_save_view_preferences, transparent_background, animations
Deferred color_moved

2. The three options are published and applied. ReviewViewDefaults gains tabWidth, autoSplitMinWidth, and sidebar. The page keeps its precedence: this browser's stored choice, then the session default, then the page's own default. It sets Pierre's --diffs-tab-size, uses the configured column threshold for auto layout, and opens or closes the files sidebar at launch ("auto" leaves it to the viewport).

Decisions worth a look

  • HUNK_SESSION_DAEMON_VERSION moves from 22 to 23. The daemon parses the shared-state snapshot with the same strict, exact-key parser the page uses (session/broker/state.ts), and it serves the page bundle. Without a bump, an older daemon at the same revision would reject a newer window's state. The new fields are therefore required rather than optional. The wire fixture's contents are unchanged (shared state is not in the wire corpus); it is renamed v22 → v23, as feat(review): per-surface selection, direct note intents, and viewed files #1289 did for the same kind of change. HUNK_REVIEW_PROTOCOL_VERSION stays 1, per its own comment: the daemon and window are held to one build by the daemon revision.
  • User-visible default change: tabs in the page were 2 columns wide for everyone and are now 4, the terminal's default, not only for people who set tab_width.
  • A pager session publishes a closed sidebar whatever sidebar says, matching how the terminal opens one (useExtensionPaneController.ts).
  • animations is classified terminal-only: the page follows the browser's prefers-reduced-motion. Say so if the page should honor the option instead.
  • hunk_headers is published with applied: false rather than deferred, because the host already sends it and the "every sent field is accounted for" rule needs an entry for it.

Non-goals

  • No terminal behavior or default changes.
  • No key bindings touched. The hard-coded / filter key and Ctrl/Cmd+Enter note save found in the same audit are separate.
  • The page does not import the classification; the host-side checks are its consumers.

Why core

The classification describes host config and gates what the host publishes; core/ may not import web/. The page-side changes are presentation only.

Tests

  • core/run/webConfigSupport.test.ts: the record covers exactly the config reference's options; every option the page does not apply has a one-sentence reason; each published option lands in its own field.
  • app/review/sharedState.test.ts: the three options project as the launch resolved them, fall back to the terminal's built-in defaults when unset, a pager session's sidebar starts closed, and the built defaults match the record in both directions.
  • session/reviewSharedState.test.ts: the parser requires every published view field with a well-formed value.
  • web/view/viewPreferences.test.ts: override, then session, then page default for each; the sidebar mapping; auto splitting at the configured threshold.
  • test/web/review-config.e2e.ts (new, real Chromium): computed tab-size on Pierre's code column is 8 with tab_width = 8 and 4 without config; auto layout switches to split at a 1000px viewport only because of auto_split_min_width = 100; sidebar = false closes the sidebar at 1440px and sidebar = true opens it at 1000px; the state route carries the new fields.

Commands run (macOS, Darwin 25.6.0; Bun 1.4.4):

Command Result
bun run typecheck pass
bun run lint 0 warnings, 0 errors
bun run format:check pass
bun run deps:check no violations
bun test ./test/review-conformance 203 pass
bun test over core/run, app/review, web, ui/lib, scripts/quality, scripts/generate, and the shared-state, protocol-schema, and wire-snapshot tests 1239 pass, 0 fail
bun run build:web && bun run test:web 146 passed, 9 skipped (the opt-in screenshot captures)

Enforcement was checked by breaking it: deleting one option's entry from the record, and deleting one published field from the host's view block, each fail bun run typecheck; both were restored.

Not run: the full bun run test. On this machine it fails 55 tests on the base branch for unrelated reasons (44 pick up a globally installed extension under ~/.config/hunk/extensions, 8 are macOS /var vs /private/var, 3 are file-watch and daemon-launcher timing); the affected directories were run directly instead, as listed. Also not run: test:integration and test:tty-smoke (no terminal rendering or interaction change). Linux and Windows not tested locally.

Not verified: a browser tab left open across a daemon upgrade. By the exact-match hello an old tab only exists for an old-revision session, which the new daemon refuses, but that is inferred from code, not tested.

Known limitations / follow-up

  • The website's "Config the page follows" list is hand-written and could drift from the record; generating it, or testing it against the record, would close that.
  • docs/web-review-plan.md and docs/browser-review-seam-audit.md still list the old four view defaults.
  • The generated config reference does not say which options the page follows.

This PR description was generated by Claude Code using Claude Fable 5.2

…e it ignored

Nothing made a config option's author decide what the browser review
page does with it, so `tab_width`, `auto_split_min_width`, and `sidebar`
reached the terminal and were silently ignored by the page.

`core/run/webConfigSupport.ts` classifies every key of the config
reference table in one record (`published`, `host-side`,
`terminal-only`, `deferred`), as `webCommandTable.ts` does for commands.
The table's keys are now a literal union, so an option without an entry
fails to typecheck. A `published` option names the presentation field it
lands in; the host's `view` block must carry exactly those fields (a
`satisfies` check plus a test in both directions).

The three options are published in `ReviewViewDefaults` and applied by
the page under its existing precedence: this browser's stored choice,
then the session default, then the page's own. The page sets Pierre's
`--diffs-tab-size` (it drew tabs 2 wide before; the terminal's default
is 4), uses the configured column threshold for `auto` layout, and opens
or closes the files sidebar at launch. A pager session publishes a
closed sidebar, as the terminal opens it.

The daemon parses the shared state with the same strict parser the page
uses, and the new fields are required, so `HUNK_SESSION_DAEMON_VERSION`
moves to 23. The wire fixture's contents are unchanged; it is renamed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

The browser review page now follows the session’s tab width, automatic split threshold, and sidebar setting, with a typed record covering every config option.

  • Browser reviews now follow the session’s tab, layout, and sidebar settings.
  • Every config option now has a clear place in the browser review.

No actionable issues found. benvinegar explicitly leaves header hiding, moved-line colors, generated support documentation, and updates to the older design docs for follow-up. The hand-written support list remains a known drift risk.

Reviews (1) · Last reviewed commit: "feat(web): classify every config option ..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant