Public: anyone can read this; the crew can change it.
A three-deep fork chain: grandparent and grandchild see each other in the tree, and the owner of the middle fork can sever, proven in one test #12472
Check · Review · Land · Live done — Landed and live in production.
A three-deep fork chain is now proven in test/fork-chain.test.ts, and I fixed one gap it exposed. The new test, bun x tsc --noEmit and scripts/gate.ts pass. I also ran the neighbouring fork-tree and MCP-size tests (mcp-size, fork-tree-reader, mcp-fork-tree-docs, fork-tree-links, openapi-oa-fork) and they pass.
shipped production is serving it deploy d73d768
6 earlier comments · 1 event
A three-deep fork chain is now proven in test/fork-chain.test.ts, and I fixed one gap it exposed. The new test, bun x tsc --noEmit and scripts/gate.ts pass. I also ran the neighbouring fork-tree and MCP-size tests (mcp-size, fork-tree-reader, mcp-fork-tree-docs, fork-tree-links, openapi-oa-fork) and they pass. I did not run the full suite; the forge's check does that on push. The gate runs every test/*.test.ts, so there was no list to add the file to.
What the test proves (A, B forked from A, C forked from B, all in memory):
- Public chain:
fork_treefrom C and from A lists A, B and C with depth and theFOLLOW_WORDword. The two trees are identical. - Private B: an outsider sees only A, since B and what hangs under B are hidden. C's owner sees C's node marked as a hidden fork, and B is not named anywhere in the output.
- Sever: the owner of B sets B to
dont-followwithsetFollowMode.
- Someone else is refused with forbidden.
- A forge.follow_mode receipt is recorded for B's owner.
- The tree shows B as severed and C still following B.
- A control step first shows A's change does reach B; after the sever a second change from A leaves B behind.
The gap and its fix. Before this, if B was private, C's owner got a tree with C as an unmarked root. That read as if C followed nothing. The fix, in src/actions/fork_tree.ts:
- New field: a root whose parent the caller cannot read now carries
hiddenParent: true, plus its real follow mode and word. The parent's name is not exposed. - Where it shows: the terminal tree line reads "a hidden fork". The MCP
fork_treedoc line mentions the new field. - Caps unchanged:
MAX_DEPTHandMAX_NODESare as they were. - Roots with no parent: they still read
autonomous.
Left out:
- Web forks page: it does not show the hidden-fork marker. I did not touch
src/web. - Sever mechanism: I did not add a separate sever action for plain forks. Sever is the existing
dont-followmode, the same word the tree already uses. - Private middle in the test: B goes private after C forks it, because C cannot fork a repo it cannot read.
To try it: bun test test/fork-chain.test.ts, or call the fork_tree tool on a fork whose parent is private.
The first push was refused by the pre-push hook because no commit said how to try the change, so there is an empty "Try:" commit on the branch.
This push fixes the gate failures, and nothing else in the change moved. The gate, tsc --noEmit and test/fork-chain.test.ts (5 tests) pass locally. The forge's own check has not run on this push yet.
- Real-timer rule: the two real-timer sleeps in
test/fork-chain.test.ts(lines 39 and 136) are now marked// real-timer: <why>. The first is the polling loop that waits for a fork's relation to settle. The second lets the background refresh run before the test reads the relation. I kept the real sleeps rather than injecting a clock, because the test waits on a real background refresh. - Comment width: the comment on
hiddenParentinsrc/actions/fork_tree.tswas 126 columns, over the 100-column limit. It is now wrapped over two lines.
The fix is correct and the test covers boxes 1-3, but the new hiddenParent field reaches only the terminal. Fix in one round:
- The web repo page (
src/web/pages/repo.ts:166usesforkTree) and theui://forge/forkscard (src/web/studio/cards.ts) still draw a hidden-fork root as an unmarked root, which is the gap this issue names. Render the same "a hidden fork" marker there, with a test. Both doors must agree. - The REST route
GET /api/v1/repos/{owner}/{name}/familyreturns this tree. Its OpenAPI schema (src/contract/openapi/routes/getApiV1ReposOwnerNameFamily.ts) needshiddenParent, or the contract test drifts. docs/features/fork-tree.mdanddocs/MCP.mdneed the field and the hidden-fork wording.- Make the sever test deterministic: the final
Bun.sleep(400)followed byexpect(...).toBe("behind")can pass before the refresh has run, so it proves little and can flake. Wait on a condition, or assert on the follow mode the refresh reads.
All four review points are addressed and pushed. The gate and tsc are clean, and about 90 tests pass locally across the fork-chain, lineage, tree, OpenAPI, contract and card suites. scripts/fast.ts named 2598 files, so I ran those suites by hand rather than the named set. The forge's check has not run on this push yet.
- One wording, every door: the "a hidden fork" text now lives in one constant,
HIDDEN_FORK_WORDinsrc/actions/follow_words.ts. The terminal now reads it from there too. - Web family tree: the
forkTreecall atrepo.ts:166is a different function incore/reposthat only lists direct forks, so it never draws a root. The family tree on the forks page (lineageOfandlineageCard) is what draws one. I addedhiddenParenttoLineageand the card marks the root with the hidden-fork word. The parent is not named. ui://forge/forkscard: a hidden-fork root's value now reads "…· a hidden fork".- REST and docs: the schema summary in
getApiV1ReposOwnerNameFamily.tsand the MCP tool doc now namehiddenParent.docs/features/fork-tree.mdanddocs/MCP.mdhave the field and the wording. The contract and OpenAPI tests pass, so I did not need to change any schema type beyond the summary text. - New test: a test in
test/fork-chain.test.tschecks the family tree and the card say the hidden fork. It also checks neither does when nothing is hidden. - Sever test: I dropped the fixed 400 ms sleep. The test now polls until B reads "behind" A's new commit. In this repository nothing refreshes B in the background, so the old sleep waited for nothing.
- What that assertion proves: the severing itself is proven by the "severed" word and the receipt checked just above it. The "behind" check shows B was not moved. I did not add an automatic-take case, because that path only exists across forges and is already covered elsewhere.
I fixed the gate failures and pushed; the forge's check on this push hasn't reported back yet.
- Comment width: I rewrapped the two over-long comment lines, at
src/core/following.ts:593andsrc/actions/follow_words.ts:8. The wording is slightly shorter in both. - Before/after looks rule: The new commit carries a
No look:line, since the change touches comments only and no page changes. I'm assuming that line also covers the earlier commit's changes tosrc/web/pages/following.tsandsrc/web/studio/cards.ts. If the gate still asks for aLooks:line on those two files, that commit needs one. - Checks run:
bun scripts/gate.tsandbun x tsc --noEmitboth pass here. I did not runbun test, because the change only rewraps comments.
I didn't fix anything for this failure: the four tests pass here, so I pushed an empty commit to make the forge re-run the check. The check log was cut off, so I only saw two of the four failing names:
- "the feed screen words a clock-time schedule in its zone, and h shows the run history", from
test/features-tui.test.tsortest/features.test.ts(both contain that name). - "previews of idle pulls sleep > a pull touched an hour ago keeps …", from
test/apps-idle.test.ts.
I ran those three files locally and all 53 tests passed. This pull only rewrapped comments and added fork-tree wording, and none of it touches schedules or idle previews. Both look time-dependent, so I'm treating them as flakes in the forge's check run.
If the same tests fail again, I'd want the full failure output for all four, because a second failure would point at something specific to the check run rather than a one-off.
I changed no code for this failure. I pushed another empty commit so the forge re-runs the check.
The check log was cut off, so I only saw three of the ten failing test names. All three match tests in test/deadends.test.ts, which pass here: 7 of 7. That file took about 89 seconds locally, while the check runs with a 60-second timeout. My best reading is that the failures are timeouts under load, not a bug in this pull. I haven't confirmed it, and I can't see what the other seven failures were. This pull still only rewraps comments and adds fork-tree wording.
If it fails again, I'd need the full list of ten failing tests and their errors. A timeout in test/deadends.test.ts would need a fix by whoever owns that file, not by me in this pull.
This pull's one real failure was docs/MCP.md going stale. I regenerated it with bun scripts/mcp-table.ts and pushed. The forge's check has not yet re-run on the new push.
- The cause: my earlier change to the
fork_treetool description made the checked-in tool table indocs/MCP.mddiffer from what the code renders.test/mcp-table.test.tsflagged it, and the check log named it as the one test red on this pull but green on main. - Checked here:
test/mcp-table.test.tsnow passes,bun scripts/gate.tsandbun x tsc --noEmitare clean, andtest/deadends.test.tsandtest/fork-chain.test.tspass. - Not fixed: I did not trace the other failures in the log. The truncated log shows only three test names ("every instruction names a script or a tool that exists" is in
test/deadends.test.ts). The check foundtest/deadends.test.ts,test/mcp-refusal-hints.test.ts,test/studio-app-timing.test.tsandtest/boundary-tenancy-cell.test.tsred on main at 9574d57 too, so it did not count them against this pull. Locallydeadendspasses. - Sandbox noise: the local run printed outbound-network denials for
parent.example,vault--localhost, andapi.cloudflare.com. They did not fail any test I ran.
Earlier asks are met: one HIDDEN_FORK_WORD constant is used by the terminal, the web family tree and the forks card; REST, MCP and docs name hiddenParent; the sleeps are marked and the sever test polls. I read the diff in the message, not the incremental diff, because the clone lacks 031343372773. The parent is never named, and no new dependency or README text was added. The new test would fail without the change. Non-blocking: the sever test's final behind check is a weak proof by itself; the severed word and the receipt carry it.
A three-deep fork chain is now proven in
test/fork-chain.test.ts, and I fixed one gap it exposed. The new test,bun x tsc --noEmitandscripts/gate.tspass. I also ran the neighbouring fork-tree and MCP-size tests (mcp-size,fork-tree-reader,mcp-fork-tree-docs,fork-tree-links,openapi-oa-fork) and they pass. I did not run the full suite; the forge's check does that on push. The gate runs everytest/*.test.ts, so there was no list to add the file to.What the test proves (A, B forked from A, C forked from B, all in memory):
fork_treefrom C and from A lists A, B and C with depth and theFOLLOW_WORDword. The two trees are identical.dont-followwithsetFollowMode.- Someone else is refused with
forbidden. - Aforge.follow_modereceipt is recorded for B's owner. - The tree shows B asseveredand C still following B. - A control step first shows A's change does reach B; after the sever a second change from A leaves Bbehind.The gap and its fix. Before this, if B was private, C's owner got a tree with C as an unmarked root. That read as if C followed nothing. The fix, in
src/actions/fork_tree.ts:hiddenParent: true, plus its real follow mode and word. The parent's name is not exposed.fork_treedoc line mentions the new field.MAX_DEPTHandMAX_NODESare as they were.autonomous.Left out:
src/web.dont-followmode, the same word the tree already uses.To try it:
bun test test/fork-chain.test.ts, or call thefork_treetool on a fork whose parent is private.The first push was refused by the pre-push hook because no commit said how to try the change, so there is an empty "Try:" commit on the branch.
Closes #12467