Skip to content

Move janitor's PR-review routes onto HttpApi - #133

Merged
tim-smart merged 3 commits into
mainfrom
agent/nelson/fc167d36b5c0
Oct 20, 2026
Merged

tim-smart merged 3 commits into
mainfrom
agent/nelson/fc167d36b5c0

Conversation

@tim-smart

Copy link
Copy Markdown
Contributor

Moves the pullRequestReview group onto HttpApi: getSettings, updateSettings, listRuns and getRunTranscript. With that, apps/web/src/lib/api.ts has no callers left, so it's deleted.

  • Domain: Api/PullRequestReview.ts defines the group, and JanitorApi adds it. PullRequestReview/Settings.ts gains PrivateRepository (409), RunNotFound (404) and TranscriptExpired (410).
  • Cluster: Ingress/PullRequestReview.ts is now one HttpApiBuilder.group layer behind the API middleware. Same-origin writes, Access and Membership work as before. Unknown repositories fail with RepositoryNotFound. A private or unseen repository fails with PrivateRepository. A run that isn't in the repository fails with RunNotFound. Infrastructure failures die (store, read model, config, an unreachable run entity), so the 503 with Retry-After and the prose 410 message are gone.
  • Web: the settings panel, runs list and transcript call api.pullRequestReview.* and map the tags to their own copy with catchTag/catchTags. orElseSucceed covers everything else. A malformed run id in the URL counts as a missing run. The "Download JSON" link keeps its hand-built path because it's an href.
  • Tests: PullRequestReview.test.ts still runs on Postgres and now drives the typed client. That change landed in the first commit, ahead of the implementation.

Known failures: web tests need a follow-up

Four web tests fail. They provide only HttpClient to the commands, but the commands now need ApiClient (Service not found: ApiClient, plus a type error at each call site):

  • pull-request-review-settings.test.ts: "enables with a PUT of the flag…"
  • pull-request-reviews.test.ts: "loads the newest page, then older pages by cursor…" and "searches after the input settles…"
  • pull-request-review-transcript.test.ts: "fetches the run's transcript…"

The fix is the EFF-2304 setup: Effect.provide(ApiClient.layer.pipe(Layer.provide(Layer.succeed(HttpClient.HttpClient, client)))). The two runs-list stubs also have to read query params from request.urlParams, because the derived client doesn't put them in request.url. That correction goes in a separate run. Everything else in vp check and vp test passes.

Closes EFF-2519

Tests only: PullRequestReview stays on Postgres but calls the
pullRequestReview group through makeClient instead of the raw handler.
Refusals are asserted by tag: RepositoryNotFound for an unknown
repository, PrivateRepository for a private or unseen one, RunNotFound
for an unknown or foreign run and TranscriptExpired for an expired
transcript. An unreachable runner dies. The send helper, the cross-site
case (Routes covers it) and the malformed-id 400 cases go.

The web transcript test now serves tagged error bodies and maps
RunNotFound to the missing-run copy.

The cluster tests fail until the pullRequestReview group lands.
The pullRequestReview group (getSettings, updateSettings, listRuns and
getRunTranscript) joins JanitorApi, and the cluster serves it through
HttpApiBuilder behind the API middleware.

The handlers fail with domain errors. Unknown repositories get
RepositoryNotFound, and enabling a private or unseen repository gets
PrivateRepository. A run outside the repository gets RunNotFound, and an
expired transcript gets TranscriptExpired. The three new classes live in
PullRequestReview/Settings. Store, read model, config and run entity
failures die, so the old 503 with Retry-After and the prose 410 message
are gone.

The web settings panel, runs list and transcript call
api.pullRequestReview.* and own the copy for each tag. The transcript's
Download JSON link is an href, so it keeps its hand-built path.
lib/api.ts loses its last caller and goes.
@tim-smart
tim-smart merged commit c6602cf into main Oct 20, 2026
4 checks passed
@tim-smart
tim-smart deleted the agent/nelson/fc167d36b5c0 branch October 20, 2026 03:28
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