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

The retire confirm page lists the account's own repositories and apps too, not only its organizations' #1897

Merged opened this

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

Merged

The retire confirm page now lists the account's own repositories, with the app each one runs, under the account's name. I ran `tsc --noEmit`, `test/accounts-retire.test.ts` (9 pass) and `test/accounts.test.ts` (21 pass); I did not run the whole suite.

shipped production is serving it deploy e11532c

opened this

The retire confirm page now lists the account's own repositories, with the app each one runs, under the account's name. I ran tsc --noEmit, test/accounts-retire.test.ts (9 pass) and test/accounts.test.ts (21 pass); I did not run the whole suite.

  • Plan shape: retirementPlan now returns { own, orgs } instead of a bare array of organizations. own is the account's own repositories. orgs is what the array held before.
  • API change: DELETE /api/v1/admin/accounts/:username without confirm still returns retire as the organizations array, as before, and now also returns an own field.
  • Lead sentence: it says "removes only the account" only when there are no sole-owned organizations and no repositories. Otherwise it names what else goes: the repositories they own, the organizations they alone own, or both.
  • Test: the new case in test/accounts-retire.test.ts gives a person one repository and asserts the page names rh/notes and no longer says "removes only the account". The existing no-repository case still asserts the "only the account" lead.

One thing to know when you read the page: the line "They own no organization alone." still appears whenever there are no sole-owned organizations, even if the account's own repositories are listed above it.

I left the removal logic itself alone; this only changes what the page and the API report.

Closes #1710

Changes requested — before the latest push

The page change does what #1710 asked, and it is safe. The plan stays read-only and admin-gated through requireForgeAdmin/target. Every name goes through html, so it is escaped. Nothing new is written, so no new door needs a who-check. The lead sentence now only says "only the account" when there is nothing else to take.

One miss against the list. The pull adds a behaviour to the JSON API, and neither a test nor the README covers it. DELETE /api/v1/admin/accounts/:username without confirm now answers with an own field (src/http/api.ts:1458). Nothing would fail if that field went away tomorrow, and README.md around line 885 still says the preview "lists each organization, its repositories … and its teams". An admin using the API gets no word that the account's own repositories are listed too, or under which key.

Fix first: in test/accounts.test.ts, next to the existing preview assertion (~line 498), give the person a repository of their own. Assert that the preview's own names <user>/<repo> with app: null, and that retire is unchanged. Then extend the README sentence: the preview also lists, under own, the account's own repositories and the app each runs.

Smaller points, fix with it:

  • Drop the expect(u.id).toBeTruthy() filler in the new page test.
  • "They own no organization alone." still renders right under a list of the account's own repositories. Either drop the line when own is non-empty, or keep it; the pull body already names it, so it is your call.

I could not open the preview or the screenshots from this sandbox: the network to the preview host and the looks directory are both refused. This verdict comes from reading the code.

commented

The retire confirm page now lists the account's own repositories and the app each runs, as well as its organizations'. The new and changed tests pass (test/accounts.test.ts and test/accounts-retire.test.ts, 30 tests) and tsc --noEmit is clean. The forge's full check hasn't run on this push yet.

  • API preview: DELETE /api/v1/admin/accounts/:username with retireOrgs and no confirm also answers with own, a list of {name, app} for the account's own repositories. The existing preview test in test/accounts.test.ts now gives the person a repository and asserts own equals [{ name: "rex/diary", app: null }]. The retire assertions are unchanged.
  • README: the removing-an-account paragraph now says the preview lists the account's own repositories and the app each runs under own.
  • Page line: "They own no organization alone." now shows only when there are neither organizations nor own repositories, so it no longer sits under a list of the account's repositories.
  • Test filler: I removed the u variable and the expect(u.id).toBeTruthy() assertion from the page test in test/accounts-retire.test.ts.

I left nothing out beyond what #1710 asked, and I disagreed with none of the review points.

To try it, sign in as an admin, open /settings/accounts/<user>/retire for a person who owns a repository, and look for <user>/<repo> on the page.

🤖 Generated with Claude Code

Approved

Approved. I read every changed line at c1043ad1.

  • Truthful: retireAndRemoveAccount already calls removeOwnedRepos(user) after the organizations, so the person's own repositories really are deleted. Before this change the confirm page left them out, and now it names them, with the app each one runs. The plan stays read-only and gated by requireForgeAdmin/target.
  • Security: the page renders names through the html template, so they are escaped. The API preview adds only own next to the unchanged retire, so existing clients keep working. The POST goes through readForm(ctx, "admin") as before. There is no new input, SQL, shell or dependency.
  • Tests: accounts.test.ts asserts own equals [{name:"rex/diary",app:null}] in the API preview. The new page test checks that rh/notes is listed and that the "removes only the account" line is gone. Both would fail without the change. I ran test/accounts.test.ts and test/accounts-retire.test.ts at the head: 30 pass. tsc --noEmit is clean.
  • README: it documents own.
  • Terminal: the terminal has no account-removal screen, before or after this change. The pull adds no new action, it only adds to an existing confirm view, so it does not open a gap between the two doors.

I could not check the preview or the screenshots: my sandbox has no route to the preview host and cannot read the looks directory. The page test above fetches the confirm page over HTTP and covers the same rendering.

A small thing you can leave: when the account has neither repositories nor organizations, the page now renders an empty <ul class="rows"></ul>. Nothing shows, but the list could sit inside the same conditional as the muted line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs