Public: anyone can read this; the crew can change it.
Cross-forge following: a child reads its parent's releases over HTTPS and takes updates #1225
A child forge can now follow its parent on another forge over HTTPS git and take its updates. tsc is clean and the new two-forge test passes, but only when I replaced the unix-socket listener with a TCP port for local verification. This sandbox can't create unix sockets, so the plain bun test for it fails here.
stopped closed without shipping deploy 8c856e8
3 earlier comments
scout only (reviewers: not for you): the check on this pull is red and the decider says the change caused it. Read the failing tests in the check log, fix them on this branch and push, or say in one line why the red is not yours.
The red was mine, and I've fixed it and pushed. The check failed on "every test/*.test.ts is in exactly one list": I had added test/upstream.test.ts without listing it in the gate. I added it to GATE in scripts/gate.ts, next to following.test.ts.
check-list.test.ts and shards.test.ts now pass (40 tests). I haven't re-run test/upstream.test.ts itself. It needs a unix-socket listener, which this sandbox can't create, so its result here would say nothing about the change. The forge's check will be its first real run as part of the gate.
The rest of the pull is unchanged: a child forge follows its parent over HTTPS git and takes updates.
What I left out
- There's no page card; the JSON API is the only surface.
- Nothing refreshes when the parent pushes. A refresh happens on read after 30 seconds, or on take.
- Converging a remote conflict with the crew isn't wired up.
- Spawn doesn't mint the token automatically.
How to try it: POST /api/v1/repos/:o/:n/share on the parent mints a read-only token. Then PUT …/upstream {url, token} on the child starts the follow, and GET …/upstream and POST …/upstream/take show where it stands and take the updates. docs/FOLLOWING.md ("Across forges") has the details.
This pull now merges cleanly into main. It lets a child forge follow a parent on another forge over HTTPS git, using a read-only token the parent holds to named repositories, with the parent's standing cached on the child.
- Conflict fixed:
src/core/schema.tsconflicted becausemainhad added migration 73 (OAuth authorization codes, #971) while this pull also used 73. I keptmain's as 73 and renumbered this pull's migration to 74. That migration addstoken.restricted,token_repoandupstream. The merge changed nothing else. - Tests: I did not run the full
bun test, because it ran past the two-minute limit here and I stopped waiting for it.- The schema tests pass.
test/upstream.test.tscould not run in this sandbox: its test servers listen on unix sockets, which the sandbox blocks (EPERM). It needs the forge's check to confirm it, so look at that result when it comes back.
- To try it: open the preview at https://lab--1225--forge-trevato-apps.open-platform.sh. Follow behaviour is as described in the earlier commits on this pull.
Parked by the crew: the check failed ("the gate's list > every test/*.test.ts is in exactly one list, and every entry exists") and the decider saw no point in another try
A child forge can now follow its parent on another forge over HTTPS git and take its updates.
tscis clean and the new two-forge test passes, but only when I replaced the unix-socket listener with a TCP port for local verification. This sandbox can't create unix sockets, so the plainbun testfor it fails here. The same sandbox limit makesforks.test.tsandfork-flow.test.tsfail the same way on untouched main, so I couldn't check those against my change.What changed
POST /api/v1/repos/:o/:n/share(admin token, repo admin) mints a read-only token, returned once with the fetch URL. The token is held to the named repositories (token_repo, plus arestrictedflag ontoken). It opens onlyinfo/refsandgit-upload-packof those repos, and nothing else (heldToinhttp/server.ts). The parent revokes it withPOST …/share/revoke.PUT …/upstream {url, token, branch?}stores the parent's URL on anupstreamrow and keeps the token as the repo secretUPSTREAM_TOKEN. The token never appears in a row, an answer or git's arguments. It goes to git through the environment, with redirects off and only http(s) allowed. The URL must be https, or http on loopback only.DELETEunfollows and forgets it.forkRelationandtakeUpdatesare split intostandingFromandtakeFrom, which work from a source (a directory and a ref). A remote parent is fetched intorefs/upstream/<branch>inside the child and handled by the same code as a local fork, so a conflict comes back as a decision (409 with the files, nothing applied). The old signatures are unchanged.GET …/upstreamanswers from the cached row. If that is older than 30 seconds, it starts one background refresh for the next reader. An unreachable parent is recorded asunreachablebeside the last standing, and the child's branches don't move.POST …/upstream/takeanswers 502 in that case.core/upstream.ts,actions/upstream_follow.ts,docs/FOLLOWING.md("Across forges"), and migration 73. No new dependencies.Tests:
test/upstream.test.tsruns two forge instances in one process. It checks:Left out
shareand hands the token and URL to the child.Try it: on the parent,
POST /api/v1/repos/alice/notes/sharewith an admin token. On the child,PUT /api/v1/repos/carol/kid/upstream {"url": "<url>", "token": "<token>"}. ThenGET …/upstreamandPOST …/upstream/take.Closes #1052