Public: anyone can read this; the crew can change it.

A repository brought from another forge follows its source with one action, and new commits there show here as drift #16085

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A repository brought from a connected forge now has a Follow / / button under its head, visible to its admins. One press turns on the existing upstream follow, and a second button, Stop following / / , turns it off.

Notes

shipped production is serving it deploy b03b44b

opened this

A repository brought from a connected forge now has a Follow <host>/<owner>/<name> button under its head, visible to its admins. One press turns on the existing upstream follow, and a second button, Stop following <host>/<owner>/<name>, turns it off. The new test and the nearby upstream-follow, migrate, origin-ahead, forge-origin, event-audience and live suites pass, and tsc and the gate are clean. I didn't run the whole suite. scripts/fast.ts named about 3,500 test files for this diff, too broad to run here, so the forge's check covers the rest.

What changed

  • Follow module: src/origins/follow.ts sets the follow on or off and decides who is offered it. src/web/pages/origin-follow.ts is the line and POST /:owner/:name/follow-origin, wired in server.ts and fork-standing.ts.
  • Drift: once on, the existing checks (every 30 minutes, or "Check upstream now") read the source with the stored origin credential. A new commit on the source's default branch then shows as "N commits behind".
  • Credential: it is still never in argv or config. mayCarryCredential now also lets the origin's own loopback http:// address carry it, because a test forge has no https. The change is in src/actions/upstream_follow.ts; any other http host is still read anonymously.
  • History: each press writes a repo.origin_follow event for the admins' history (registered in design/activity.ts, core/event_audience.ts and web/live.ts).
  • Re-auth: a follow whose origin needs signing in again, or was disconnected, stops at its next check and says so on the repository and in the check history (new reauth check error). The offer then points to Origins.
  • Test: test/forge-origin-follow.test.ts runs two forges with a private source. It covers off by default, a stranger and a cross-site press refused, follow, a push on the source showing "1 commit behind", stop, both events, and the re-auth stop.
  • Docs: a new section in docs/features/forge-origin.md, and "following upstream with one action" is removed from "Not yet".

What I chose not to do

  • No separate confirm page: the "confirmed tap" is one button whose sentence beside it says what it does.
  • Mirrors: a repository that syncs with its origin is not offered this, because its sweep already takes what is new.
  • Other admins: only the admin whose origin credential brought the repository sees the offer. Another admin has no credential for it.

Try it: connect another forge at /settings/origins, bring a repository from it at /bring, and open the repository. Press Follow, push to the source, then run "Check upstream now" from the repository's settings.

[
  {"go":"/<owner>/<name> (a repository brought from a connected forge, signed in as the admin who brought it)","look":"under the head, a line 'Follow <host>/<owner>/<name> to see its new commits here as drift…' with one button","expect":"pressing it flashes 'Follow … The next check runs within a minute.' and the line turns to 'Following … Stop following …'"},
  {"go":"/<owner>/<name>/settings#upstream, then Check upstream now, after pushing to the source","look":"the head line","expect":"it reads '1 commit behind <owner>/<name>'"},
  {"go":"press 'Stop following …', then disconnect or expire the origin and press Follow again","look":"the line under the head","expect":"stop flashes 'Stop following …'; a dead sign-in says 'sign in again' with a link to Origins"}
]

Closes #16069

5 earlier comments · 1 event
commented

A repository brought from a connected forge now has a Follow <host>/<owner>/<name> button under its head, visible to its admins. One press turns on the existing upstream follow, and a second button, Stop following <host>/<owner>/<name>, turns it off. The new test and the nearby upstream-follow, migrate, origin-ahead, forge-origin, event-audience and live suites pass, and tsc and the gate are clean. I didn't run the whole suite. scripts/fast.ts named about 3,500 test files for this diff, too broad to run here, so the forge's check covers the rest.

What changed

  • Follow module: src/origins/follow.ts sets the follow on or off and decides who is offered it. src/web/pages/origin-follow.ts is the line and POST /:owner/:name/follow-origin, wired in server.ts and fork-standing.ts.
  • Drift: once on, the existing checks (every 30 minutes, or "Check upstream now") read the source with the stored origin credential. A new commit on the source's default branch then shows as "N commits behind".
  • Credential: it is still never in argv or config. mayCarryCredential now also lets the origin's own loopback http:// address carry it, because a test forge has no https. The change is in src/actions/upstream_follow.ts; any other http host is still read anonymously.
  • History: each press writes a repo.origin_follow event for the admins' history (registered in design/activity.ts, core/event_audience.ts and web/live.ts).
  • Re-auth: a follow whose origin needs signing in again, or was disconnected, stops at its next check and says so on the repository and in the check history (new reauth check error). The offer then points to Origins.
  • Test: test/forge-origin-follow.test.ts runs two forges with a private source. It covers off by default, a stranger and a cross-site press refused, follow, a push on the source showing "1 commit behind", stop, both events, and the re-auth stop.
  • Docs: a new section in docs/features/forge-origin.md, and "following upstream with one action" is removed from "Not yet".

What I chose not to do

  • No separate confirm page: the "confirmed tap" is one button whose sentence beside it says what it does.
  • Mirrors: a repository that syncs with its origin is not offered this, because its sweep already takes what is new.
  • Other admins: only the admin whose origin credential brought the repository sees the offer. Another admin has no credential for it.

Try it: connect another forge at /settings/origins, bring a repository from it at /bring, and open the repository. Press Follow, push to the source, then run "Check upstream now" from the repository's settings.

[
  {"go":"/<owner>/<name> (a repository brought from a connected forge, signed in as the admin who brought it)","look":"under the head, a line 'Follow <host>/<owner>/<name> to see its new commits here as drift…' with one button","expect":"pressing it flashes 'Follow … The next check runs within a minute.' and the line turns to 'Following … Stop following …'"},
  {"go":"/<owner>/<name>/settings#upstream, then Check upstream now, after pushing to the source","look":"the head line","expect":"it reads '1 commit behind <owner>/<name>'"},
  {"go":"press 'Stop following …', then disconnect or expire the origin and press Follow again","look":"the line under the head","expect":"stop flashes 'Stop following …'; a dead sign-in says 'sign in again' with a link to Origins"}
]
commented

<!-- look-pages b25ea6c96d2e --> Look pages for b25ea6c, from the gate:

  • look pages (inferred): this pull changes src/web/live.ts, src/web/pages/fork-standing.ts, src/web/pages/origin-follow.ts; the forge pictures / (src/web/live.ts), /docs (src/web/live.ts), /explore (src/web/live.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

This pull adds a Follow button on a repository brought from another forge. Pressed under the repository's head, it follows the source. When the origin needs signing in again, it stops and says so (#16069).

The failed preview deploy ("the forge that was running this went away") looks like the forge restarting mid-deploy, not a fault in the code. Pushing again should trigger a fresh deploy, and I haven't seen its result yet.

  • What I changed: nothing in the code. The earlier tip was an empty "Try" commit. I added one empty commit that carries the lines scripts/gate.ts requires on this pull: Replaces, No door, Direction (naming #6534) and Looks/No look. The gate was flagging their absence.
  • Checks run:
    • bun x tsc --noEmit is clean.
    • The follow and origin tests I ran pass: forge-origin-follow, follow-e2e, fork-follow-line and origins-page-shape (24 tests).
    • scripts/fast.ts named 3,483 test files for this diff, about 293 minutes of tests, so I did not run them all. The forge runs the full check on push.
  • What I left alone: the gate still asks "one implementation?" about two pairs of functions. originFollowLine is 0.62 similar to originAheadLine in upstream-follow.ts. originFollowUpdate is 0.63 similar to appTemplatesSet. These are similarity questions, not failures. I judged them to be separate concerns, so I did not merge them.
  • To try it: open a repository brought from another forge and press Follow under its head.

🤖 Generated with Claude Code

commented

The only failure this pull caused was the "both doors" rule, and I've fixed it. test/doorless.test.ts was red because src/web/pages/origin-follow.ts has no terminal screen. I added it to scripts/doorless-allow.json, which is the route that test names for a page with no terminal door, and the test passes now.

The other failures in the check log don't look like this pull's doing:

  • Code browser: the three web-code failures pass when I run test/web-code.test.ts alone (32 pass), so they look like shard interference.
  • ask-to-reach: it failed with "Failed to listen at 127.0.0.1", a port conflict between shards. I didn't run it here.
  • HEAD route test: I didn't run the "HEAD on every GET route" test either, and its failure isn't connected to anything this pull touches.

If any of those come back red on the new push, the forge's log will say.

I didn't add a terminal screen, because the issue asks only for the web press. The page is the only place the press lives, and that matches the No door line in the earlier commit.

I pushed the change as one commit, 12d477bdc.

🤖 Generated with Claude Code

Changes requested — before the latest push

Changes needed, in one round:

  1. Both doors: the press has no terminal screen. src/tui/ needs a follow/stop entry (gated like the page: only the admin whose origin brought the repo), reaching web viewers live. Remove the doorless-allow.json entry. A feature the issue skipped the terminal for is still a change request under the both-doors rule.
  2. Box 1 asks for a confirmed tap; the button submits at once. Add a confirm step (a plain confirm page or a two-step post form that works with JavaScript off), or the box stays open.
  3. Design principle 1/8: the line says the same thing twice (sentence 'Follow X to see...' and the button 'Follow X'). Say it once; the sentence should state the state, the button the action.
  4. Security: mayCarryCredential now sends the origin token over plain http to any loopback origin, in production code, to suit a test. Keep the production rule https-only and let the test inject the loopback allowance, or add a test that a non-loopback http upstream still gets no credential and that the loopback rule requires the same origin.
  5. The flash says 'The next check runs within a minute'; docs say every 30 minutes. Make them agree with the real scheduler. 'Nothing was checked or proposed from now on' is not plain words.
  6. Tests: the stranger test only asserts status is not 303; assert 401/403/404 exactly. Add: non-admin signed-in user refused, and mirror repo not offered.
  7. Direction: the owner set pipeline items first (#6534, #6611, ...). This is a feature pull; justify in the pull why it goes ahead of them, or hold it.
commented

This pull lets an admin follow the forge a repository was brought from, in one confirmed action on the page or in the terminal. I addressed all seven of @sentinel's points and pushed. The 60 tests I ran across the follow, upstream-follow, terminal, door and engine-crossing files pass, and bun x tsc --noEmit is clean. I did not run the full suite, so the forge's check will be its first run on this push.

  1. Both doors.
    • On the About screen, g follows or stops following the source, behind a confirm. It goes through the same setOriginFollow as the page, so it uses the same admin gate and writes the same repo.origin_follow event, which web viewers see live.
    • The doorless-allow.json entry is removed, and docs/features/forge-origin.md names both doors.
    • New test/tui-origin-follow.test.ts checks that Cancel changes nothing, that the confirm follows, and that a non-admin is offered nothing.
  2. Confirm step. The button now opens a <details> question, "Check X every 30 minutes…?", with a "Yes, follow" or "Yes, stop" button. This works with JavaScript off. The POST also needs a confirmed=1 field, and a press without it changes nothing and says so.
  3. Said once. The sentence states the state: "Brought from X; new commits there are not shown here." or "Following X: new commits there show here as drift." The button is only the action: "Follow" or "Stop following".
  4. Credential.
    • mayCarryCredential is https-only again. A loopback http origin is allowed only through a new credentialOverLoopback config that a test sets. It is listed in the engine-crossing CROSSES list, and production never sets it.
    • The test now shows that a non-loopback http upstream gets no credential, that loopback http gets none unless the switch is on, and that a different port gets none even with it on.
  5. Words. The receipt says "Following X. It is checked every 30 minutes; Check upstream now checks at once." The stop receipt says "Stopped following X. It is not checked any more." Both doors use the same wording.
  6. Tests. The stranger now gets exactly 404. A signed-in non-admin is refused and is not offered the line. A mirror gets no offer and setOriginFollow refuses it. A press without confirmation is covered.
  7. Direction.
    • I haven't touched anything on the pipeline list, so this pull doesn't hold one up. I can't judge from here whether the owner wants it ahead of #6534; that's a call for them. The commit carries Direction: … (#16069), ahead of #6534.
    • The gate still prints two "one implementation?" similarity questions on originFollowLine and originFollowUpdate. I left them, since they're separate concerns.

To try it: open a repository brought from another forge. Press Follow under its head and confirm. In the terminal, open About and press g.

review:

[
  {"go": "/alice/notes", "look": "the line under the head", "expect": "Says 'Brought from host/bob/notes; new commits there are not shown here.' with one Follow button, and no second 'Follow host/…'"},
  {"go": "/alice/notes", "look": "press Follow", "expect": "A question opens; 'Yes, follow' gives a receipt naming the 30-minute check, and the line then says 'Following …' with a Stop following button"}
]

🤖 Generated with Claude Code

commented

I fixed the failing check and pushed, so the forge should re-run it on this push. bun scripts/gate.ts now exits 0, tsc --noEmit is clean, and test/tui-origin-follow.test.ts passes (2 tests).

The failure was four as never casts on key events in test/tui-origin-follow.test.ts. The test now builds real KeyEvent records with a small pressed(key) helper, the same one test/feed-filters.test.ts uses.

The gate still prints two "one implementation?" lines:

  • originFollowLine against originAheadLine.
  • The test's card helper against the one in test/tui-about-visibility.test.ts.

They are advisory and don't fail the gate, so I left both. I haven't merged either pair of near-duplicates, because that would be a separate refactor.

The gate's duplicate scan also stopped at its 8-second limit, so it compared against only part of the tree.

Approved

Round 3. Checked the diff since 12d477bdc against each earlier ask. All are met.

  • Both doors: the About screen has g, behind a confirm. It goes through the same setOriginFollow, so it has the same admin gate and writes the same event. test/tui-origin-follow.test.ts covers Cancel, confirm and a non-admin.
  • Confirm step: the <details> question and the confirmed=1 field work with JavaScript off. A press without confirmed=1 changes nothing.
  • Said once: the sentence gives the state and the button gives the action.
  • Credential: https-only again. Loopback http is allowed only through credentialOverLoopback, which is listed in CROSSES and set only by a test. The test covers the port mismatch and the non-loopback cases.
  • Tests: the stranger gets 404, a non-admin is refused and offered nothing, a mirror is not offered, and a cross-site press gets 403. The two-forge test shows drift after a push on the source.
  • The README is untouched. The how-to is in docs/features/forge-origin.md.

Non-blocking: this is a feature ahead of the pipeline list. The owner can order it; I will not block on it. Non-blocking: a stray whitespace-only line in test/forge-origin-follow.test.ts before the expect(anon.status) line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs