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

A detached mirror can be reconnected in one click, and a frozen upstream says so #1100

Closed opened this in answer to
Closed without merging

I made no change and pushed nothing: the failing capacity test passes here, so I found nothing in this work to fix. The failed check was test/capacity.test.ts ("an admin changes each one from the page, the API and MCP; a wrong value is refused; every change is kept").

Notes

stopped closed without shipping deploy 8d755ee

opened this

I made no change and pushed nothing: the failing capacity test passes here, so I found nothing in this work to fix.

The failed check was test/capacity.test.ts ("an admin changes each one from the page, the API and MCP; a wrong value is refused; every change is kept"). That file doesn't touch origins, mirrors or following. Here all 11 tests pass on this branch, and all 11 also pass on origin/main. The file takes about 20 seconds and boots a crew, so the check's failure looks like load or timing on the check runner. I'm guessing at that cause; I couldn't see the check's log.

The branch is still at 8d755ee, unchanged since the last push. The only open step is a re-run of the check, which a person or the crew can trigger. If it fails there again, the log should name the capacity assertion that tripped, and that is a capacity-test fix rather than part of this pull.

Splitting this issue smaller wouldn't help. It is already one concern, with tests of its own.

What the pull does:

  • Frozen note and Reconnect. A mirror whose origin was disconnected says so on its page and branches. When you own an origin on the same site, it offers Reconnect. Otherwise it links to connect one. POST /:owner/:name/settings/origin/reconnect and POST /api/v1/repos/:owner/:name/origin/reconnect { originId } (admin token) re-link the mirror and sync it before the page redirects.
  • Refusals. reattachMirror compares sites (scheme, host, port) and binds by the remote's id. It refuses with not_detached, wrong_host, origin_cannot_see, remote_unknown or not_found.
  • Connecting again. connectOrigin re-attaches every detached mirror of that site you administer and the new account can see, and the flash names them. The OAuth callback re-attaches too, without a flash.
  • Forks. A fork of a frozen mirror says its upstream is frozen, with a Reconnect link, instead of ahead/behind.
  • Needs re-authorizing. An origin in that state is said on the origins page, on each mirror it feeds, and as a feed decision for its owner.
  • API shape. A repo carries origin: { fullName, detached, frozenSince }, and the pins list carries the same shape.
  • Docs and tests. docs/ORIGINS.md and docs/FOLLOWING.md are updated, and test/origins-reconnect.test.ts covers the cases above.

Choices:

  • The date shown is the mirror's last_fetch_at, because the schema doesn't record when an origin was disconnected.
  • Re-authorizing an origin means disconnecting and connecting it again, because createOrigin refuses a login that is already connected. The mirrors then come back by themselves.
  • I changed one assertion in test/origins.test.ts that expected origin: null for a detached mirror, which the new API shape deliberately contradicts.

Left out:

  • No one-click re-authorize for an origin that is still connected.
  • A fork's ahead/behind is not recomputed against the frozen state; the sentence is replaced instead.

To try it: mirror a repo, fork it, disconnect the origin, and open the mirror and the fork. Then connect an origin on the same site, or press Reconnect.

🤖 Generated with Claude Code

Closes #1090

commented

Parked by the crew: the check failed ("capacity: only a forge admin reads or changes it > an admin changes each one from the page, the API and MCP; a wrong value is refused; every change is kept") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs