Skip to content

feat(editor): Settings → General → Name the tab after the folder - #2536

Open
BenNewman100 wants to merge 2 commits into
backnotprop:mainfrom
BenNewman100:feat/folder-tab-setting
Open

BenNewman100 wants to merge 2 commits into
backnotprop:mainfrom
BenNewman100:feat/folder-tab-setting

Conversation

@BenNewman100

@BenNewman100 BenNewman100 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

This is the optional setting I offered in my comment on #2392.

Your ruling on #2392 stays the default: a folder session's tab names the open file, so several
tabs of one folder stay apart (#2061).
This adds a switch for people who review one folder per tab and want the tab to name the
subject of the review, which is usually the folder.

What changes

  • Settings → General gets Name the tab after the folder. It is off by default.
  • It shows in every annotate session, a single file included, so you can turn it on before you
    open a folder. Its text says it is for folder reviews. Plan review doesn't show it.
  • On, the tab names the folder whichever file is open: add-refund-flow/ · acme/payments-service.
  • Off, nothing changes.
  • One file, several files and the last message are unchanged either way.
  • The header names the folder either way (feat(editor): a folder session's header and tab name the folder #2392).
  • The choice is a cookie, like the other General switches, so a reload keeps it.

The row reads:

Name the tab after the folder
In a folder review, the browser tab shows the folder name instead of the open file. Leave it off to tell several tabs of one folder apart.

Settings → General in a folder session

The same row in a single-file session. The tab strip is drawn, as explained below, and still names the file:

Settings → General in a single-file session

Before and after

A folder session with proposal.md open. A page screenshot has no browser tab, so the strip
along the top is drawn: its text is the page's own document.title, read at the moment of the
shot.

Off (the default):

Setting off: the tab names proposal.md

On:

Setting on: the tab names add-refund-flow/

After a reload with design.md open, the tab still reads add-refund-flow/ · acme/payments-service.

Relation to #2537

A companion PR adds --title <text> to annotate, annotate-last and review (#2289).
It lets whoever starts the session name the tab.
That solves the same problem more generally, so it could land instead of this setting.
Both could land too:

  • this setting serves people who start sessions by hand and want every folder tab named the same way.
  • the flag serves agents and scripts, which know what they are opening and can name it.

If both land, --title wins over this setting. Both PRs edit documentTabTitle, so whichever
lands second needs a small merge. I'll do it.

How

  • folderTabNamesFolder in packages/ui/config/settings.ts: cookie-only
    (plannotator-folder-tab-names-folder), default false, shaped like hideRepoOwner.
  • documentTabTitle (packages/editor/documentTitle.ts) checks it first for a folder session
    that has a folder path. Nothing else in the resolver changes.
  • Settings gains showFolderTabSetting (default false): the row only stores the setting, so a
    host opts in. AppHeader passes annotateMode, so every annotate session shows it and plan
    review doesn't. Other hosts are unchanged.
  • Docs: ui-settings.md, guides-and-shared-ui.md and the ui HANDOFF.md.

Tests

Each one fails without the change it guards:

  • packages/editor/documentTitle.test.ts, with the setting on:
    • the open file, a linked document, outside a repository, the owner hidden, and a Windows path
      all name the folder. With the rule removed, those four tests fail.
    • one file, several files and the last message keep naming what is open. With the rule
      allowed past folder sessions, that test fails.
  • packages/ui/config/folderTabNamesFolderSetting.test.ts: off by default, and only an explicit
    true or false cookie is read. With the default flipped on, it fails.
  • packages/ui/components/Settings.folderTab.test.tsx (DOM, added to tests/dom-test-list.txt):
    • the row starts off and its switch sets the setting. With the row removed, it fails.
    • a host that doesn't ask for the row gets none. With the row always shown, it fails.
  • packages/editor/components/AppHeader.folderTabSetting.test.tsx (DOM, registered too):
    • a single-file annotate session shows the row. With the row hidden there, it fails.
    • plan review shows none. With the row shown everywhere, it fails.
  • tests/e2e/folder-session-header.spec.ts now also opens Settings, turns the switch on, checks
    the tab names the folder, and reloads. Against a build where the switch doesn't reach the tab,
    it fails with Expected: "add-refund-flow/ · Plannotator", Received: "proposal.md · Plannotator".

Verified on Windows 11

  • The tests above pass. So do every Settings.*.test.tsx, packages/ui/config,
    AppHeader*.test.tsx and DocBadges.test.tsx: 202 tests across 35 files, under --isolate
    as CI runs them.
  • folder-session-header.spec.ts and doc-badges-fit.spec.ts pass headless against the
    compiled binary.
  • bun run build:review, bun run build:hook and the compiled binary build succeed.
  • Typecheck, project by project: every project this touches passes, including
    packages/ui/tsconfig.strict-consumer.json. The only errors are in packages/inbox and
    apps/inbox, which this doesn't touch.

Drafted by Ben's agent at his request.

An opt-in, cookie-only switch (folderTabNamesFolder, cookie
plannotator-folder-tab-names-folder, default off). Off keeps the owner's
ruling on backnotprop#2392: a folder session's tab names the open file, so several tabs
of one folder stay apart (backnotprop#2061). On, the tab names the folder whichever file
is open, `add-refund-flow/ · acme/payments`, as the header already does.

- documentTabTitle: the folder rule, for folder sessions only; one file,
  several files and the last message are unchanged, and the repository label
  still follows "Hide the repository owner"
- Settings: the General row, shown where a host passes showFolderTabSetting;
  Plannotator does in a folder annotate session
- Docs: ui-settings.md, guides-and-shared-ui.md, ui HANDOFF
- Tests: documentTitle with the setting on, the setting's default and cookie,
  a DOM test for the row (registered in tests/dom-test-list.txt), and the
  folder-session e2e spec turns it on through Settings and reloads
…ession

The row showed only in a folder session, so it could not be set from a
single file before a folder was opened. Every annotate session now offers
it, as "Hide the repository owner" shows everywhere; the row's text already
scopes it to folder reviews. Plan review still gets none.

- AppHeader passes showFolderTabSetting={annotateMode}, as it passes mode;
  App's folderTabSettingAvailable prop is gone
- Help text: "the browser tab shows the folder name instead of the open file"
- Docs: ui-settings.md, guides-and-shared-ui.md, ui HANDOFF
- Tests: AppHeader DOM test, the row in a single-file annotate session and
  none in plan review (registered in tests/dom-test-list.txt)

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