Skip to content

feat(native): settings sharing & access, worktrees, source control, scheduled tasks - #52

Merged
rynfar merged 6 commits into
nativefrom
nw/w16-settings2
Nov 2, 2026
Merged

rynfar merged 6 commits into
nativefrom
nw/w16-settings2

Conversation

@rynfar

@rynfar rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner

The native settings modal had no Sharing & access, Worktrees, Source control or Scheduled tasks pages, so pairing a phone, revoking a client, or changing worktree, merge and writing defaults still meant opening the web app.

What ships

Four new settings sections, registered in the web's nav order (SETTINGS_NAV_GROUPS) with their settingsSearch.ts entries. Logic, wire decoding and payloads live in crates/core/src/settings/{access,worktrees,source_control,scheduled_tasks}.rs and have tests; the views are in crates/app/src/settings/.

  • Sharing & access (AuthorizedClientsSettings.tsx, the access parts of ConnectionsSettings.tsx). Shows the environment's version and a Permissions disclosure with this connection's grants. Pairing links and authorized clients follow subscribeAuthAccess (snapshot, upsert and remove events). Create link has a client label, the Read only and Standard presets, and the 16 scope checkboxes (using terminals turns on viewing them), with the web's notices. Created links show Share: the <server>/pair#token=… URL, Copy link, Copy code only, and a QR code. The QR is built with the qrcode crate (ECC M, one-module margin) and drawn as quads on a canvas. A loopback server gets the code only, as on the web. Revoke works per link and per client; the current session has no Revoke. Revoke others calls /api/auth/clients/revoke-others. The server fixes link TTL at 5 minutes and has no TTL field, so the native app has no TTL control either. The expiry countdown ticks once a second, and only while a link is visible on this page.
  • Worktrees (WorktreesSettings.tsx, BranchNamingSettings.tsx, WorktreeSubmodulesRow, WorktreesDirectoryRow, WorktreeCleanupSection). Worktree location (gated on capabilities.worktreesDirectory), Start from remote, Submodules under Advanced, branch naming (static prefix, semantic with its status line, custom instructions), and cleanup. Cleanup covers deleted, merged and inactive worktrees with the RetentionControl day field. Advanced adds settled worktrees (gated on settledWorktreeCleanup), unchanged worktrees, and keep-when (gated on storageCleanupRun). Cleanup reads through resolveWorktreeCleanup, so a worktreeCleanup policy wins over storageCleanup.
  • Source control (SourceControlSettings.tsx, the source-control rows of ProjectDefaultsSettings.tsx, SourceControlWritingSettings.tsx). Repositories: automatic pull, remove agent credits, and default merge method. The Version Control and Source control providers lists come from server.discoverSourceControl, which encodes Effect Option fields as _tag objects. Rows have status dots, versions, Coming Soon and Not authenticated badges, the web's summaries, the account hidden until clicked, and Rescan. Writing & review: writing style with custom instructions, review guides with their model and instructions, and under Advanced, follow templates and the writer model.
  • Scheduled tasks (ScheduledTasksSettings.tsx, scheduledTasksSettings.logic.ts, scheduledTaskWebhook.ts). The list follows scheduledTasks.subscribe and replaces itself on every item. Rows show the schedule label, state (paused, listening, next run in …, policy block), the last-run badge and error, an enable switch, and a "…" menu with Edit, Run now (not on webhook tasks) and Delete. The editor has name, destination, project, workspace (new worktree with base branch and start from remote, project checkout, or a specific checkout), prompt, model, schedule (at a time with day toggles, once, every interval, on webhook) and enabled. It validates with the web's messages and builds ScheduledTaskUpsertInput the way the web does. Once is gated on capabilities.oneTimeSchedules.

Shared controls gained two small, generic additions: Row::status (the SettingsRow status line) and Switch::disabled. Three lucide icons are vendored: calendar-clock, shield-check and qr-code.

Not ported (noted for follow-up)

  • Source control: host token and account editing (SourceControlTokenSettings, SourceControlAccountSettings, SourceControlHostSettings, app sign-in) and the model traits picker. Host rows show discovery only, and secrets are never shown.
  • Scheduled tasks: webhook signature, filters and dedupe fields, and the deliveries log. A webhook task saves its stored webhook settings back unchanged. The editor opens in the page, not in a dialog over the modal. It uses a typed YYYY-MM-DD HH:MM field instead of datetime-local, and a text field for the base branch instead of a branch picker.
  • Sharing & access: the network access, Tailscale, WSL, T3 Connect and version-update rows. The Authorized clients list is shown open, not folded.
  • Environments: the read-only linked environments, load balancing and PR routing parts (ST-ENVS) are still to do.

Ledger

ST-WORKTREES and ST-SHARING are done. ST-SOURCECTL and ST-SCHEDULED are partial, with the gaps listed above.

Evidence

Offscreen snapshots (--settings <section>) against the smoke server:

  • /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w16-worktrees.png
  • /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w16-sourcecontrol.png
  • /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w16-scheduledtasks.png (a disabled probe task, deleted afterwards)
  • /private/tmp/claude-501/-Volumes-DevSSD-t3code/31a183a0-8354-4d43-b031-d9f81d50685d/scratchpad/w16-access.png (the share panel was injected for this capture only, to show the QR drawing; real links show it after Create link)

Wire transcript from the new access_probe example against the smoke server. Every write was undone: the link was revoked, the task deleted and the setting restored.

server  http://127.0.0.1:14658 (0.1.6)
wt      Static startFromOrigin=Some(true) cleanup=CleanupRules { worktree_keep_when: UncommittedChanges, worktree_after_days: None, worktree_settled_after_days: None, worktree_on_merge: false, worktree_on_delete: false, worktree_unchanged: false }
scm     Git Some("git version 2.54.0 (Apple Git-157)"): Available
scm     Jujutsu None: Support for Jujutsu is coming soon.
scm     GitHub Some("gh version 2.97.0 (2026-07-31)"): Authenticated
scm     GitLab None: Not available on this server: Install the GitLab command-line tool (`glab`) from https://gitlab.com/gitlab-org/cli or your packag…
access  snapshot (revision 1)
access  4 clients; this device: Some("T3 Code Native")
create  pairing link 0b1845bd-7dd8-4bb0-86c8-96d7c5758e13: Expires in 4m 59s; url none (loopback server)
access  pairingLinkUpserted (revision 2)
revoke  pairing link 0b1845bd-7dd8-4bb0-86c8-96d7c5758e13: {"revoked":true}
access  pairingLinkRemoved (revision 3)
access  4 clients
tasks   0 scheduled tasks
upsert  scheduled-task:86afb399-59b3-414a-be24-95a325fd77c4: Weekdays at 09:00 · Paused
stream  1 tasks after upsert
delete  scheduled-task:86afb399-59b3-414a-be24-95a325fd77c4: {"id":"scheduled-task:86afb399-59b3-414a-be24-95a325fd77c4"}
stream  0 tasks after delete
send    {"patch":{"newWorktreesStartFromOrigin":false}} -> newWorktreesStartFromOrigin = false
send    {"patch":{"newWorktreesStartFromOrigin":true}} -> newWorktreesStartFromOrigin = true

Gates: cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings, node scripts/gen-theme.ts --check, node --test parity/sync.test.ts, node conformance/generate.ts --check.

Unverified: clicks in a real window (screen recording was not used; views were captured offscreen), and scanning the QR with a phone.

Model: Claude Opus 5.5 · Harness: Claude Code (factory worker W16)

@rynfar

rynfar commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Review follow-up in 6cf459b. All six findings were real and are fixed. None were dismissed.

  1. While a link is being created, the presets, scope checkboxes and label are disabled, and their handlers do nothing, so the request's scopes match what the dialog shows.
  2. Webhook saves now leave out filters, so the server keeps its current ones. The editor doesn't show filters, so this matches what the web sends when filters are unchanged.
  3. When startFromOrigin is missing, the editor now reads it as false (local), as taskToDraft does.
  4. The interval keeps exact minutes (String(Math.max(1, everyMs / 60000))), so a 90-second task saves as 90 seconds.
  5. clampManagedRuntimeMode is ported: the runtime mode is capped at managedPolicy.limits.maxRuntimeMode. ServerConfig keeps managedPolicy raw.
  6. The QR matrix is cached by URL, so countdown ticks and hovers no longer re-encode it.

New tests cover 2–5. Gates rerun on the latest fork/native: 713 tests, clippy, theme, parity, conformance.

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