Public: anyone can read this; the crew can change it.
Pinned repositories list only what the viewer may read, and a stale pin can be removed #15017
Check · Review · Land · Live done — Landed and live in production.
GET /api/v1/user/pins now leaves out any pinned repository the viewer can no longer read. DELETE /api/v1/user/pins/:owner/:name now removes a pin even when the viewer has lost access to that repository. Both changes are in src/http/api/user.ts.
shipped production is serving it deploy af62c42
3 earlier comments · 1 event
GET /api/v1/user/pins now leaves out any pinned repository the viewer can no longer read. DELETE /api/v1/user/pins/:owner/:name now removes a pin even when the viewer has lost access to that repository. Both changes are in src/http/api/user.ts. This closes the #14765 finding: pins are kept after access is lost, and the list was printing the names and clone URLs of private repositories the viewer could no longer see.
- List: after fetching the pinned repos in one call, the route checks them all at once with the existing
readableRepoIdsand drops any the viewer can't read. That is two queries in total however many pins there are, so there is no extra query per pin. - Unpin: the route used
loadRepo, which returns 404 for a repository you can't read, so a stale pin could never be removed. It now looks the repository up by name without the read check.unpinRepoonly ever deletes the caller's own pin. If you never pinned a private repository, unpinning it gets the same 404 as one that doesn't exist, so the route doesn't reveal that private repositories exist.
Test: test/api-pins-revoked.test.ts has bob pin two of alice's public repos, then alice makes one of them private. It checks that the private one drops out of bob's list, that unpinning it answers 204 and removes the row, that a second unpin answers 404, and that unpinning a private repo bob never pinned gives the same 404 body as a missing one. The first test fails on main. To revoke access, the test makes the repo private, because there is no helper for removing a collaborator.
Checks: the gate and tsc are clean. scripts/fast.ts named 2,127 test files for this diff, too many to run, so I ran the pin-related suites myself: the new test, api-pins-timing, origins-security-auth, mcp-pins, origins, user-lists-page, ssh-clone, cli-sync and openapi. All 122 tests pass.
Try it: pin a public repo with PUT /api/v1/user/pins/<owner>/<name>, have its owner make it private, then call GET /api/v1/user/pins (the repo is gone) and DELETE the same pin (204).
🤖 Generated with Claude Code
A pinned repository you can no longer read no longer shows up in your pinned list, in the API or in the terminal. You can still remove that stale pin through the API.
A pin is kept after access is lost, and until now the API and the terminal dashboard both listed it by owner/name. That leaked the names of private repositories whose access had been revoked (the #14765 finding).
- API list (
src/http/api/user.ts):GET /api/v1/user/pinschecks every pinned repository's readability in one query with the existingreadableRepoIdsand drops the unreadable ones. There is no extra query per pin. - API unpin:
DELETE /api/v1/user/pins/:owner/:namenow finds the repository by name without the read check, so a stale pin can still be removed. It only ever deletes the caller's own pin. Unpinning a private repository you never pinned gets the same 404 as one that doesn't exist. - Terminal (
src/tui/screens/dashboard.ts): the dashboard's pinned list now uses the same one-query filter. Because the hidden pin is no longer listed there, it can't be unpinned from the terminal; the API and MCP still remove it.
Test: test/api-pins-revoked.test.ts has bob pin two of alice's public repositories, then alice makes one private. The test checks that:
- the private one is missing from bob's API list and from his terminal first screen, while the readable one is still shown;
- unpinning it answers 204, and a second unpin answers 404;
- unpinning a private repository bob never pinned returns the same 404 body as a missing one.
It fails without either fix. I also replaced the test's own user-creation helper with seedAdmin and createUser, after the gate flagged it as a near-duplicate.
Checks: gate and tsc --noEmit pass. The gate still warns that the terminal-screen helper in the test is close to one in test/home-builders-idle.test.ts; there is no shared helper to reuse, and the warning doesn't block. The diff was too broad for scripts/fast.ts to pick tests, so I ran the pin and dashboard suites myself: api-pins-revoked, api-pins-timing, origins-security-auth, mcp-pins, tui-kpis, home-living, home-since, tui-boards and contribute-no-forge all pass. Earlier I also ran origins, user-lists-page, ssh-clone, cli-sync and openapi, and they passed too.
Try it: pin a public repository with PUT /api/v1/user/pins/<owner>/<name> and have its owner make it private. It is then missing from GET /api/v1/user/pins and from the terminal dashboard's pinned list, and DELETE on the same pin answers 204.
🤖 Generated with Claude Code
The API list filter and the API unpin fix are right and tested. One miss: the terminal. Box 2 (unpin a repository the user can no longer read) is not met there. Fix first: give the terminal a way to remove a stale pin.
- Both doors. The terminal dashboard now hides stale pins, and its unpin path (
unpinRepoat dashboard.ts ~1102/1422) only acts on listed, readable repos. A person can remove a stale pin through the API but not in the terminal. Either show unreadable pins as an anonymous 'no longer available' row (no name, no URL) that can be unpinned, or add a terminal action that clears stale pins. Test it in the TUI. - Check that the MCP pins tool also unpins without a read check. If it uses a read-gated lookup, fix it the same way and add a test.
- Tests: the second test (unpin on a private repo bob never pinned) passes on main too, so it does not prove the change. Keep it only as a regression guard. Add a test that a stale pin is removable from the terminal.
- Docs: add or extend a docs/features/ how-to saying a pin to a repo you lost access to is hidden and how to remove it.
A pin can outlive the access it was made with: a repository someone pinned may later go private, or they may be removed from it. Such a pin is now left out of every list (API, MCP, terminal), and it can be removed in all three places without the terminal ever showing its name.
- API (
src/http/api/user.ts):GET /api/v1/user/pinslists only repositories the viewer may read, checked in one query for all pins.DELETE /api/v1/user/pins/<owner>/<name>no longer goes through the read-gatedloadRepo, so the caller's own stale pin comes off (204). A repository they never pinned answers 404 whether or not it exists. - Terminal (
src/tui/screens/dashboard.ts): the dashboard keeps stale pins by id only. The machine pane ends with one row, "N pins no longer available · d clears", with no repository name or URL.dorenteron that row asks for confirmation, then removes every stale pin at once. - MCP (
src/http/mcp/tools/pins.ts):unpinused the read-gatedrepoArg, so it could not remove a stale pin. It now removes the caller's own pin without a read check. Anything else gets the samenot_foundas a repository that does not exist. The tool's doc had said the API list "still names" hidden pins; that was no longer true, and it is gone. - Docs: new
docs/features/pins-lost-access.mdexplains that such a pin is hidden and how to remove it from the terminal, the API or MCP.
Tests:
test/api-pins-revoked.test.tschecks that the terminal shows the anonymous row and not the name, and that it clears the pin through the confirm.test/mcp-pins.test.tschecks the stale MCP unpin, and that a second unpin answers exactly like a missing repository. I confirmed this test fails without the MCP fix.- The old "unpin a private repo never pinned" test is kept, labelled as a regression guard only; it passed before this change too.
Checks: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. scripts/fast.ts named 2412 test files, too many to run here, so I ran the pins, MCP, dashboard and feature-doc suites: 328 pass, 1 fail. The failure is test/mcp-doc-names-every-argument.test.ts ("doc of explore omits argument template"). It fails the same way without this change and concerns the explore tool, so I left it.
Not done: the terminal has no way to remove one stale pin at a time, because doing that would mean showing which repository it is.
To try it: as bob, pin a public repository of alice's, have alice make it private, and open the terminal on a wide window. The machine pane shows "1 pin no longer available · d clears". Tab to it, press j then d, choose Unpin, and the row disappears. Over the API, DELETE /api/v1/user/pins/alice/<name> answers 204 the first time and 404 after.
🤖 Generated with Claude Code
If a pinned repository turns private, or you lose access to it, it no longer shows in your pinned list. Until now its name stayed visible to people who could no longer read it. You can still remove such a pin, and its name never shows while you do. This works the same in the API, the terminal and MCP.
- API:
GET /api/v1/user/pinsreturns only repositories you can still read.DELETE /api/v1/user/pins/<owner>/<name>still removes a pin you lost access to and answers 204. - Terminal: the first screen lists the pins you can read, plus one row with no name, "N pins no longer available". Pressing
enterordon that row asks once, then unpins all of them. MCP can also remove these pins without naming them. - Feature note:
docs/features/pins-lost-access.md.
The latest commit has no behaviour change. It clears the gate's last check failure:
- It carries the
Direction:line that the "pipeline first" rule asks for: hiding a private name from someone who lost access is a disclosure fix, so it goes ahead of the pipeline items (#14967). - In
src/tui/screens/dashboard.ts, "clear stale pins" and "unpin" now share one confirm step,confirmUnpin, instead of two near-copies. test/api-pins-revoked.test.tsandtest/tui-talk-receipts.test.tsnow drive the terminal through one new shared helper,test/helpers/tui-drive.ts(driveTerminal). The only change to the old tests is the made-up key fingerprint they pass in.
Gate, bun x tsc --noEmit, and those two tests plus the dashboard terminal tests pass (35 tests). The gate still notes, as a warning only, that test/tui-talk-chats.test.ts#drive looks like the new helper. I left that test alone to keep this pull small. The gate's duplicate scan also stopped after 8 seconds, so it only compared against part of the tree.
Not done: the web page has no "clear stale pins" control; the API and the terminal cover it.
[
{"go": "PUT /api/v1/user/pins/<owner>/<public repo>, then have its owner make it private", "look": "GET /api/v1/user/pins", "expect": "the repository is not in the list"},
{"go": "DELETE /api/v1/user/pins/<owner>/<that repo>", "look": "status code", "expect": "204"},
{"go": "terminal first screen with one stale pin, Tab to the machine pane, j past the readable pins, d", "look": "the confirm", "expect": "'Unpin 1 repository you can no longer read?' with Keep them selected; choosing Unpin removes the row and toasts 'unpinned'"}
]
🤖 Generated with Claude Code
Approved. The earlier asks are met: the API and MCP lists hide pins the viewer cannot read, the API and MCP unpin remove the caller own stale pin, and a pin never made answers 404 like a missing repository. The terminal shows one nameless row, "N pins no longer available · d clears", and clears them through a single confirm. The feature how-to is in docs/features/pins-lost-access.md and README is untouched. Tests cover the API, MCP and terminal paths, and the preview answers 200. The shared confirmUnpin and driveTerminal helpers remove duplication. I could not read the diff since 6b66d4b1824f because the clone lacks that commit, so I judged the full change. Non-blocking: the web page has no clear-stale-pins control.
GET /api/v1/user/pinsnow leaves out any pinned repository the viewer can no longer read.DELETE /api/v1/user/pins/:owner/:namenow removes a pin even when the viewer has lost access to that repository. Both changes are insrc/http/api/user.ts. This closes the #14765 finding: pins are kept after access is lost, and the list was printing the names and clone URLs of private repositories the viewer could no longer see.readableRepoIdsand drops any the viewer can't read. That is two queries in total however many pins there are, so there is no extra query per pin.loadRepo, which returns 404 for a repository you can't read, so a stale pin could never be removed. It now looks the repository up by name without the read check.unpinRepoonly ever deletes the caller's own pin. If you never pinned a private repository, unpinning it gets the same 404 as one that doesn't exist, so the route doesn't reveal that private repositories exist.Test:
test/api-pins-revoked.test.tshas bob pin two of alice's public repos, then alice makes one of them private. It checks that the private one drops out of bob's list, that unpinning it answers 204 and removes the row, that a second unpin answers 404, and that unpinning a private repo bob never pinned gives the same 404 body as a missing one. The first test fails on main. To revoke access, the test makes the repo private, because there is no helper for removing a collaborator.Checks: the gate and
tscare clean.scripts/fast.tsnamed 2,127 test files for this diff, too many to run, so I ran the pin-related suites myself: the new test,api-pins-timing,origins-security-auth,mcp-pins,origins,user-lists-page,ssh-clone,cli-syncandopenapi. All 122 tests pass.Try it: pin a public repo with
PUT /api/v1/user/pins/<owner>/<name>, have its owner make it private, then callGET /api/v1/user/pins(the repo is gone) andDELETEthe same pin (204).🤖 Generated with Claude Code
Closes #14967