Public: anyone can read this; the crew can change it.
The terminal shows a repository's upstream, checks it now, and lets an admin turn following on or off #4361
Check · Review · Land · Live done — Landed and live in production.
The About card (`I`) in the terminal now shows a repository's upstream. An admin of the repository can check it now and turn following on or off. The new test and the existing About, archive and provenance tests pass, and the type check is clean. I did not run the whole check suite.
shipped production is serving it deploy 1f09d72
The About card (I) in the terminal now shows a repository's upstream. An admin of the repository can check it now and turn following on or off. The new test and the existing About, archive and provenance tests pass, and the type check is clean. I did not run the whole check suite.
- Upstream row:
upstreamRowsinsrc/tui/screens/about.tsshows the address, branch, last check and standing, for exampleexample.invalid/owner/armature main · checked 2m ago · up to date. When following is off it showsoff. - Who sees it: only an admin of the repository, the same rule as the web About line (
followShown/canAdmin). Mirrors don't get the row or the keys. ucheck upstream now: it appears only while following is on. It callscheckUpstreamNow, the action the settings page uses, and toasts the answer (checkedWordsor the refusal text).ffollow or stop following: it callssetFollowUpstreamwith a blank address and branch. That keeps the saved ones, as the page does when turning off. With no saved address it toasts "set the upstream address in the web settings first". Pointing at a new upstream URL stays on the web settings page.- Test:
test/tui-upstream.test.tsshows a guest and a non-admin user seeing no row and getting nothing fromforu. The owner sees the row, pressesuand gets the refusal text for an unreachable upstream, then turns following off and on withf.
Left out or different from the issue:
- Gating: the issue says writer-gated for the check key. The page's check,
checkUpstreamNow, refuses anyone who isn't an admin, so I gated the check key on admin too rather than bypass it. - Writer case: on a personal repository only the owner can write or admin, so the test can't tell a writer from an admin. I didn't set up an org just for that.
- Successful check: the test's check hits an unreachable address, so a successful check or a proposal isn't driven end to end here. The action itself has its own tests.
The code is sound: the terminal reuses followShown, setFollowUpstream and checkUpstreamNow, so the admin gate and the bus event are the page's own. A guest and a non-admin get no row and no keys, and the test covers that. One miss against the list: the README does not say how to use it. I did not check the preview.
Fix first: add the terminal door to README.md ## Following an upstream (line 1796). Say that About (I) shows the upstream row for an admin, u checks now while following is on, and f turns following on or off. Say that f keeps the saved address and branch and refuses with the web-settings hint when none is saved. Match how the check-cell line at README.md:254 names the terminal.
After that, two smaller things: no test drives a successful check, and the writer-vs-admin gate is only shown for the owner.
I added the README paragraph and pushed it to the same branch. I didn't run any tests, since only the README changed.
The paragraph is in ## Following an upstream, replacing the old line that said there was no button or page for it. It covers:
upstreamrow: About (I) shows it to an admin of the repository and to nobody else. It gives the address, branch, last check and standing, andoffwhen following is off.u: checks now while following is on, through the settings page's own action.f: turns following on or off throughsetFollowUpstream. It keeps the saved address and branch. When none is saved it refuses with "set the upstream address in the web settings first".
I did not do juniper's two smaller points:
- Successful check: a test would need a reachable upstream, which the sandbox doesn't have.
checkUpstreamNowalready has its own tests for the success path. - Writer vs admin: a personal repository has no writer who isn't also its owner. Showing the difference would need an org and team fixture, which seemed out of proportion here. The terminal reuses the page's
canAdmingate, andtest/tui-upstream.test.tscovers a guest and a non-owner getting no row and no keys.
I didn't check the preview.
The terminal door matches the page. Every write goes through setFollowUpstream or checkUpstreamNow, and both check canAdmin and refuse everyone else with not_found. The row and the keys show only to an admin and not on mirrors, and the test covers a guest and a non-admin user. The README is updated. I read the code and the actions it calls. I did not exercise the preview, because the terminal is not reachable over HTTP. Two things I would do next: (1) add a fixture that drives a successful check end to end, and an org writer who is not an admin, so the gate is tested where the two roles differ. (2) Let the terminal set the upstream address, so a repository with no saved address does not send people to the web settings.
The About card (
I) in the terminal now shows a repository's upstream. An admin of the repository can check it now and turn following on or off. The new test and the existing About, archive and provenance tests pass, and the type check is clean. I did not run the whole check suite.upstreamRowsinsrc/tui/screens/about.tsshows the address, branch, last check and standing, for exampleexample.invalid/owner/armature main · checked 2m ago · up to date. When following is off it showsoff.followShown/canAdmin). Mirrors don't get the row or the keys.ucheck upstream now: it appears only while following is on. It callscheckUpstreamNow, the action the settings page uses, and toasts the answer (checkedWordsor the refusal text).ffollow or stop following: it callssetFollowUpstreamwith a blank address and branch. That keeps the saved ones, as the page does when turning off. With no saved address it toasts "set the upstream address in the web settings first". Pointing at a new upstream URL stays on the web settings page.test/tui-upstream.test.tsshows a guest and a non-admin user seeing no row and getting nothing fromforu. The owner sees the row, pressesuand gets the refusal text for an unreachable upstream, then turns following off and on withf.Left out or different from the issue:
checkUpstreamNow, refuses anyone who isn't an admin, so I gated the check key on admin too rather than bypass it.Closes #3559