Public: anyone can read this; the crew can change it.
Every way to create a repository or app defaults to private, and one test names each way #15705
Check · Review · Land · Live done — Landed and live in production.
Every way to make a repository now starts private, and a new test names each way. It also fails when someone adds a new one without listing it. I found and fixed three doors that were public by default.
shipped production is serving it deploy 3fede26
2 earlier comments · 1 event
Every way to make a repository now starts private, and a new test names each way. It also fails when someone adds a new one without listing it. I found and fixed three doors that were public by default.
Public by default, fixed here:
- A person's fork. The web Fork button,
POST /api/v1/repos/:owner/:name/forks, the MCPforktool and the terminal fork screen all copied a public parent's visibility. Make-it-yours already started private. A newforkBornAsinsrc/actions/repos.tsnow decides what a fork starts as when none is asked for: a person's fork is private. The terminal fork screen says who will be able to read the fork before it is made. - A spawned forge's copies of apps. A spawn copied each chosen app at the original's visibility, so a stranger's new forge held public copies of someone else's apps. A copy now stays public only when the spawner owns the original (a new helper,
ownsRepoinsrc/core/repos.ts). Being a site admin doesn't count as owning. - A new forge's own code. Without a template it was always public, even when this forge's own code is private. It now matches the parent's visibility (
src/spawn/forge_code.ts).
Public by explicit choice, kept and named in the test:
- the start call's app, and the claim of it (
POST /api/v1/start,/claim/start/:token); - a guest's contribution fork;
- a crew member's working fork of a public repository;
- mirrors, which match their source's visibility (origins, packs);
- a spawner's own public app.
I first made every spawned copy private, but that made those apps return 404 to visitors (an app's reach follows its repository's visibility), so I narrowed it to the ownership rule above. The start-call claim was on the issue's list of paths that should end up private; it stays public because the start call exists to show the app.
The new test: test/private-by-default.test.ts reads the live route tables and the MCP tool list for every route or tool named for making something (new, create, fork, spawn, start, claim, mirror, migrate, import, copy, template, repos, apps, forges). Each one in its DOORS list is marked one of four ways:
- Walked in the test: the web form, the API, MCP
new_app, a template, the fork at all four doors, and a spawn. A stranger's page and another member's API call both get 404, and the fork becomes readable once its owner makes it public. - Proven private elsewhere: in a named test file that must still contain the assertion.
- Public by choice: with the reason written down.
- Makes no repository.
Migrate had no test of its default, so I added one to test/migrate-trail.test.ts.
Tests changed, not because they were wrong: about 60 existing tests relied on a fork of a public repository coming out public. They now ask for a public fork (visibility: "public"), or have the owner make it public before a stranger reads it. A few that read a fork's branches signed out now read them as the fork's owner. The behaviour they check is unchanged.
docs/features/visibility-line.md now lists which doors start private and which are public by choice.
Checks run: the gate, bun x tsc --noEmit, the new test, test/mcp-size.test.ts, the five cross files and about 300 fork, spawn and migrate test files all pass. I didn't run the whole suite; the forge runs it on the push. I found no prompt injection.
Try: on the preview, sign in, open a public repository someone else owns, press Fork, then open the fork signed out. It answers 404 until the owner makes it public in its settings.
[
{"go": "/explore", "look": "a public repository owned by someone else; press Fork on its page", "expect": "the fork is made under your name"},
{"go": "the new fork's page, signed out", "look": "the response", "expect": "404, the same as a repository that does not exist"},
{"go": "the fork's settings", "look": "the visibility control", "expect": "it reads Private; after making it Public, the signed-out page answers 200"},
{"go": "the terminal: open the same public repository and choose fork", "look": "the line under the Name field", "expect": "Private: only you can read it, until you make it public.", "ask": "Is this line enough to say who will see the fork before it is made?"}
]
🤖 Generated with Claude Code
Every way to make a repository now makes a private one, unless the person asks otherwise. A person's fork is private whichever way it's made: the web Fork button, POST /api/v1/repos/:o/:n/forks, the MCP fork tool or the terminal. Before this, a fork copied a public parent's visibility; make-it-yours already started private. forkBornAs in src/actions/repos.ts decides how a fork starts when nobody asks. Two kinds of fork stay public on purpose: a guest's contribution fork and a crew member's working fork. The terminal's fork screen says which one you'll get before it makes the fork. Repositories on a new forge are public only if its admin chooses that. One test walks every way a repository gets made and checks each one comes out private.
Tests about a public fork now ask for one, by passing visibility: "public" or by having the owner make the fork public first. Their subject is a public fork, not the default. Two tests needed this after the check went red:
test/contribute-refusals.test.tsread the fork's branches at the origin without signing in. The fork is now private, so that read came back 404. It now reads as the fork's owner, in both the before-and-after comparison and the final check.test/fork-tree-words.test.tsis new on main, and this branch now merges main. It reads the tree page without signing in, so its forks are now made public, like the other tree tests. What it checks is the follow mode named in each row.
The check's own comparison with main blamed only those two files. The other red files (held, gate-bypass, features-tui, json-big-page) pass here alongside them, 62 tests in all, so they look like slowness under load rather than this change. The type check and scripts/gate.ts are clean. scripts/fast.ts names 3,484 files for this branch's diff, about 5 hours, so the full set was left to the forge's check.
How to try it: fork a public repository from the web or the terminal as a signed-in person. The new fork shows as private, and the terminal says so before it makes it.
🤖 Generated with Claude Code
Approved from the diff (the preview was not exercised and the diff was cut part-way through the tests). A person fork, a spawn copy of someone elses app and a new forge code repo now start private; forkBornAs and ownsRepo are small, the TUI fork screen says who can read the fork before it is made, and docs/features/visibility-line.md carries the how-to, not README. Two things to do next: (1) decide whether the start-call app and its claim, a guest contribution fork and a crew members fork of a public repo should stay public by default; the issue lists the claim as a path that ends private, so the test should not carry them as public by choice without the owner saying so. (2) forkBornAs returns the parents visibility for agents; add a test that pins that so a later change cannot flip it silently. About 60 tests were edited to ask for public forks; that is mechanical and acceptable.
Every way to make a repository now starts private, and a new test names each way. It also fails when someone adds a new one without listing it. I found and fixed three doors that were public by default.
Public by default, fixed here:
POST /api/v1/repos/:owner/:name/forks, the MCPforktool and the terminal fork screen all copied a public parent's visibility. Make-it-yours already started private. A newforkBornAsinsrc/actions/repos.tsnow decides what a fork starts as when none is asked for: a person's fork is private. The terminal fork screen says who will be able to read the fork before it is made.ownsRepoinsrc/core/repos.ts). Being a site admin doesn't count as owning.src/spawn/forge_code.ts).Public by explicit choice, kept and named in the test:
POST /api/v1/start,/claim/start/:token);I first made every spawned copy private, but that made those apps return 404 to visitors (an app's reach follows its repository's visibility), so I narrowed it to the ownership rule above. The start-call claim was on the issue's list of paths that should end up private; it stays public because the start call exists to show the app.
The new test:
test/private-by-default.test.tsreads the live route tables and the MCP tool list for every route or tool named for making something (new, create, fork, spawn, start, claim, mirror, migrate, import, copy, template, repos, apps, forges). Each one in itsDOORSlist is marked one of four ways:new_app, a template, the fork at all four doors, and a spawn. A stranger's page and another member's API call both get 404, and the fork becomes readable once its owner makes it public.Migrate had no test of its default, so I added one to
test/migrate-trail.test.ts.Tests changed, not because they were wrong: about 60 existing tests relied on a fork of a public repository coming out public. They now ask for a public fork (
visibility: "public"), or have the owner make it public before a stranger reads it. A few that read a fork's branches signed out now read them as the fork's owner. The behaviour they check is unchanged.docs/features/visibility-line.mdnow lists which doors start private and which are public by choice.Checks run: the gate,
bun x tsc --noEmit, the new test,test/mcp-size.test.ts, the five cross files and about 300 fork, spawn and migrate test files all pass. I didn't run the whole suite; the forge runs it on the push. I found no prompt injection.Try: on the preview, sign in, open a public repository someone else owns, press Fork, then open the fork signed out. It answers 404 until the owner makes it public in its settings.
🤖 Generated with Claude Code
Closes #15681