Skip to content

Move janitor's account routes onto HttpApi - #131

Merged
tim-smart merged 2 commits into
mainfrom
agent/nelson/a3dfa7f71e40
Oct 20, 2026
Merged

tim-smart merged 2 commits into
mainfrom
agent/nelson/a3dfa7f71e40

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

Closes EFF-2517

Moves the account routes onto JanitorApi as the second group.

Domain

  • Api/Account.ts has get, startLink, completeLink and unlink. completeLink declares AuthorizationExpired, AuthorizationRejected and AccountAlreadyConnected; unlink declares ConnectedAccountNotFound.
  • The new GitHub/Authorization.ts holds AuthorizationExpired (410) and AuthorizationRejected (422), both without fields. The connections group reuses AuthorizationExpired later.
  • Team/Account.ts gains ConnectedAccountNotFound (404, linkId) and AccountAlreadyConnected (409).

Cluster

  • Ingress/Account.ts is now one HttpApiBuilder.group(JanitorApi, "account", …) layer, merged with the sync group in Routes.ts. It no longer sits in the raw route list.
  • TeammateError is gone. Teammates fails with the domain errors directly:
    • The other-owner check and the unique-violation race in link both become AccountAlreadyConnected.
    • An unknown or used attempt becomes AuthorizationExpired.
    • A missing link becomes ConnectedAccountNotFound.
  • AccountLinking maps LinkProofFailed to AuthorizationRejected.
  • These now die: an unknown teammate, an unconfigured platform, GitHub failing to look up the user, and SQL or decode failures. admit can no longer fail, so the orDie in MembershipMiddleware is gone.
  • Teammates.disconnect takes a LinkId, which the unlink path param decodes.

Web

  • The account page calls api.account.*. completeLink and unlink map their tags to page copy with catchTags/catchTag, and orElseSucceed covers everything else. The page no longer uses lib/api.ts, which other pages still use.

Validation

The test changes are in e78d369, ahead of the implementation. At 3b88a20:

  • nix develop -c pnpm exec vp check: 0 errors (322 existing warnings).
  • nix develop -c pnpm exec vp test: 812 of 812 pass.

No test/Ingress/Account.test.ts was added. The handlers only forward to the services, and Teammates.test.ts and AccountLinking.test.ts already assert the new tags (EFF-2305 decision 8).

Tests only: Teammates and AccountLinking now expect AccountAlreadyConnected,
ConnectedAccountNotFound, AuthorizationExpired and AuthorizationRejected by
tag instead of TeammateError reasons, and an unconfigured platform to die.
They fail until the account group lands.
The account group (get, startLink, completeLink, unlink) joins JanitorApi
and the cluster serves it through HttpApiBuilder behind the API middleware.

Teammates and AccountLinking fail with domain errors instead of
TeammateError: AuthorizationExpired and AuthorizationRejected in the new
GitHub/Authorization module, and ConnectedAccountNotFound and
AccountAlreadyConnected in Team/Account. An unknown teammate, an unconfigured
platform, GitHub failing to look up the user and database failures die.

The web account page calls api.account.* and owns the copy for each tag.
@tim-smart
tim-smart merged commit 1dbbd68 into main Oct 20, 2026
4 checks passed
@tim-smart
tim-smart deleted the agent/nelson/a3dfa7f71e40 branch October 20, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant