Skip to content

fix(web): a Viewer or one-thread Collaborator isn't offered New thread, Fork or Add project - #729

Merged
Jacksondr5 merged 5 commits into
j5/mainfrom
fix/hide-controls-without-write
Oct 26, 2026
Merged

Jacksondr5 merged 5 commits into
j5/mainfrom
fix/hide-controls-without-write

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Problem

A device holds the permissions of its person's highest level anywhere on the server, and upstream hides a control only when a device lacks a permission everywhere. So a Viewer on one thread who is a Collaborator elsewhere, or a Collaborator on a single thread, is still offered New thread, Fork and Add project, and a Viewer is offered changes to a thread's branch. The server refuses each one. Closes #640, closes #641.

What changed

One J5 rule, sharingAllowsStart (packages/client-runtime/src/j5/sharing.ts): a new thread or a fork in a project is decided by the person's level over that project (projectLevelFor, from #638); a project of their own (Add project, threads without a project) needs a level at server scope. The web reads it through hooks beside useCanOperateThread (apps/web/src/j5/sharing/access.ts) and, outside a render, readCanStartThreadIn (threadOperability.ts). Until the server says who the connection is, nothing is withheld, as #638 does.

Each upstream control calls the rule beside the permission check it already makes, and hides or disables the way upstream does for that control when a permission is missing:

Control Change
Sidebar header New thread Disabled when no listed project can take a thread
Legacy sidebar project row's New thread button Hidden, as the row hides other actions; in a row grouping several checkouts, its chooser disables the ones that can't take a thread
"New thread on " in the thread menu Disabled (new sidebar and thread view through J5's sharingMenu.ts; one line in the legacy sidebar)
Command palette "New thread in…" / "New thread in " Lists only projects that can take a thread, choosing among a group's checkouts only those that can; left out when none can
chat.new / chat.newLocal keybindings, Shift+click New thread Do nothing where the project can't take a thread
"New thread without a project" and the other scratch doors Offered only on a server where the person can add a project
The thread header's project name, which starts a new thread in that project Disabled where the person can't start one
"Fork from this response" Hidden unless the thread's project lets the person start a thread
Add project submit (browse, clone and New project) Upstream's own disabled message, from useCanAddProject
A thread's branch changes (branch selector, "Commit on new branch", "Check out feature branch & continue") Follow the person's level over the thread (useCanOperateThread); the commit dialog's "Open file in editor" keeps upstream's permission

Left as they are, on purpose:

  • Commit, push, pull and Open in editor. The server allows folder actions to anyone who is a Collaborator at any scope (FORK.md case 69, Jackson 2026-10-17), and a Viewer everywhere already lacks them.
  • The Add project buttons in the sidebar headers still open the palette, which now shows upstream's disabled submit. Disabling the buttons themselves needs a new prop on one more upstream file.
  • "Merge back" is also refused to a one-thread Collaborator; it is a separate follow-up.
  • Mobile, with the rest of sharing on mobile (Share links: sharing on mobile #609). Desktop wraps web and gets the same change.

UI changes

Before is j5/main, after is this PR, on the same test server data. People: Alice is a Viewer of the whole server; Bob is a Viewer on a thread of project P1 and a Collaborator in project P2; Carol is a Collaborator on one thread only; Gus is a Viewer of an empty project; the Owner is the control.

Before After
Alice, thread header: the project name starts a new thread
Viewer everywhere (Alice), thread view: sidebar New thread, Fork and branch controls
Viewer on this project, Collaborator elsewhere (Bob): Fork on a thread he only views
Collaborator on one thread (Carol): New thread and Fork gone, composer still works
Owner, thread view: unchanged
Alice, thread menu "New thread on feature-x"
Owner, thread menu: unchanged
Alice, command palette search for "new thread"
Bob, palette "new thread" on a thread of the project he only views
Bob, branch picker on a thread he only views
Bob, commit dialog: "Commit on new branch" (Open in editor stays enabled)
Carol, Add project → New project: Create
Alice, legacy sidebar project row on hover
Viewer of an empty project (Gus), palette project search row

After only (states that didn't exist before):

After
Bob, palette "New thread in…" lists only the project he can start in
Erin, Viewer on P1 and Collaborator on a second checkout of it: the palette offers the grouped repo and starts in the checkout she can use
Fay, Collaborator on an empty project: its search row stays enabled
Bob in a P2 thread: Fork, New thread and the composer are all there

Not captured: the legacy sidebar's checkout chooser for a grouped row (the tester covered grouped checkouts through the palette and the header button instead); "Check out feature branch & continue", which needs a dirty tree on the default branch; the "This connection cannot add projects." tooltip on the disabled Create button, which did not show on hover in the browser panel.

Live testing

Pass, by a Sonnet 5.5 tester on a live-test server (report: artifacts/test-reports/fix-hide-controls-without-write/68ed60ecdb.md). Befores on j5/main 3e67f6bab0. Afters were taken across the review rounds: on e7029d0b47 (thread menu, Owner menu, Bob's "New thread in…"), on 65a78ffc7f (Carol's thread view, palette search, branch picker, commit dialog, Add project, grouped checkouts, Bob in P2), and on 68ed60ecdb (thread views, legacy sidebar row, empty-project search rows). Each later commit was checked against the states it changed, and the rest were left because those commits did not touch them.

The tester found one door the PR had missed: the thread header's project name, which opens a new draft. It is fixed in 3a73c3f120 and re-tested on that head: disabled for Alice and for Bob on a P1 thread, still working for Bob in P2 and for the Owner.

Checked per person: sidebar header New thread; legacy sidebar row (Alice); thread menu "New thread on " (Alice, Owner); palette "New thread in…" and search; chat.new, chat.newLocal and "New thread without a project" keybindings (Alice, Bob, Carol); "Fork from this response"; New project Create (Carol: disabled, Enter and Mod+Enter do nothing); branch picker and commit dialog (Bob); and that each still works where the person may write. The Owner's views are identical before and after.

By design: until the server has said who the connection is, just after a page load, nothing is withheld, as #638 does. Not exercised: desktop (it wraps web), mobile (out of scope, #609), relay and tunnel (client-side presentation only, no new requests).

Review: GPT-6-Astra, three rounds. Round 1 found the commit dialog's editor buttons disabled, New project's Create ungated and grouped checkouts mishandled. Round 2 found the header New thread doing nothing for a mixed group and the empty-project search fallback. All were fixed. One round-2 finding was declined: an already-open "New thread in…" submenu keeps its items if access changes while it is open. Access is answered when the client connects, and the server refuses the write anyway. Round 3: nothing blocking.

Upstream impact

Upstream-owned files edited, all under new FORK.md case 85: Sidebar.tsx, LegacySidebar.tsx, CommandPalette.tsx, lib/chatThreadActions.ts, hooks/useScratchProject.ts, chat/MessagesTimeline.tsx, chat/ChatHeader.tsx, GitActionsControl.tsx, BranchToolbarBranchSelector.tsx, and one vi.mock each in GitActionsControl.test.ts and GitActionsControl.lifecycle.test.ts.

This changes what upstream's product does: upstream offers a new draft to every connection, a read-only one included. Jackson approved this shape on 2026-10-25 (one J5 check beside each upstream check). Register: divergence D33 in docs/j5/product/upstream.md gains a line and a history entry.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (sharing.test.ts, sharingMenu.test.ts, startableProjects.test.ts)
  • UI changes: before/after screenshots above (no motion or interaction sequence to record)
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md
  • Surfaces: entry points (sidebars, palette, keybindings, thread menu, timeline), clients (web and desktop; mobile out of scope, Share links: sharing on mobile #609), reverse states (a level raised brings the controls back, as they read the live level)
  • Docs: register D33 updated; the People and access definition already says a one-thread Collaborator cannot start a thread in the project

Built by Claude Opus 5.5 in J5 Code (Claude Code harness).

🤖 Generated with Claude Code

Jacksondr5 and others added 2 commits October 26, 2026 00:05
…d, Fork or Add project

A device holds its person's highest level's permissions anywhere on the server, and upstream
offers a new thread to every connection, so a Viewer, a Viewer of one thread who writes to
another, and a Collaborator on one thread were offered New thread, Fork from this response, Add
project and a thread's branch changes, which the server then refused.

One J5 rule, sharingAllowsStart in client-runtime, says where a person may start something: a
thread or a fork takes the project's level, a project of its own a level at server scope. The web
reads it through useCanStartIn, useCanAddProject and useCanForkThread (and readCanStartThreadIn
outside a render), called beside each upstream check: the sidebars' New thread buttons and menus,
the command palette, the New thread keybindings, the scratch doors, the fork button, and the Add
project flow's submit. The git controls' thread-branch changes read useCanOperateThread. Each
control is hidden or disabled as that surface already does. FORK.md case 85.

Closes #640, closes #641.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…w the person's level

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 26, 2026 4:47am UTC

Request Review

@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 26, 2026
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (test files excluded in mixed PRs). label Oct 26, 2026
… start rule

- GitActionsControl keeps upstream's permission for the commit dialog's Open
  in editor buttons; only branch changes read the thread's level.
- The New project flow's Create is disabled where the person cannot add a
  project, with upstream's "This connection cannot add projects."
- A grouped project offers a new thread by a checkout that can take one: the
  palette narrows each group before upstream picks its checkout
  (startableProjectPicker), and the legacy sidebar's checkout chooser
  disables checkouts that cannot.
- Rows and buttons read one boolean (useCanStartInAny, useCanAddProject,
  useCanForkThread by the one server's access), so an unrelated access
  refresh no longer re-renders every project row and fork button.
- The legacy row hides its New thread button with `hidden` on upstream's
  positioning div instead of wrapping the block.
- D33 states upstream's baseline accurately; FORK.md case 85 lists each
  file's actual edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A plain New thread click whose open project refuses a thread starts it in a
checkout of the group the person can start in. A project picked from search
with no thread creates its draft in a startable checkout, and is listed
disabled when it has none. The start read moves to an import-free module so
upstream's new-thread helpers no longer load the connection runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re the person can't

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jacksondr5 added a commit that referenced this pull request Oct 26, 2026
@Jacksondr5
Jacksondr5 marked this pull request as ready for review October 26, 2026 05:00
@Jacksondr5
Jacksondr5 merged commit 882256d into j5/main Oct 26, 2026
32 checks passed
@Jacksondr5
Jacksondr5 deleted the fix/hide-controls-without-write branch October 26, 2026 05:00
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026
Jacksondr5 added a commit that referenced this pull request Nov 23, 2026

This branch was successfully deployed

1 active deployment
Preview — 3a73c3f1 Deployed Oct 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A thread-scope Collaborator isn't offered New thread or Fork A Viewer isn't offered upstream controls they can't use

1 participant