Skip to content

Move janitor's labeling routes onto HttpApi - #137

Merged
tim-smart merged 4 commits into
mainfrom
agent/nelson/e4437223fbc3
Oct 20, 2026
Merged

tim-smart merged 4 commits into
mainfrom
agent/nelson/e4437223fbc3

Conversation

@tim-smart

@tim-smart tim-smart commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The last group, labeling, moves onto HttpApi, and the raw Labeling routes go with it.

Cluster

  • Api/Labeling.ts defines the group: listRepositories, getCatalog, getConfiguration, listActivity, listReconciliations, listAudit, getAiConsent and updateAiConsent. The activity query struct stays inline.
  • Ingress/Labeling.ts serves it through HttpApiBuilder.group, merged in Routes.ts.
  • The repository-scoped reads and the consent write fail with RepositoryNotFound. listReconciliations declares nothing, since it has no requireRepository check.
  • LabelingOverviewError, AiConsentError, the ActivityReader failures (SQL, row decode, configuration) and LabelingConfigurationError die in the handlers. No service signatures change.
  • Ingress/LabelingRoutes.ts and test/Ingress/LabelingRoutes.test.ts are deleted. The authenticated raw-router middleware now wraps only the live routes.

Web

  • The workspace commands (FetchRepositories, FetchCatalog, FetchDetail, FetchConsent, SetConsent) and the activity journal's FetchActivity call api.labeling.*. RepositoryNotFound becomes "This repository is unavailable." Everything else falls back to each command's own copy through orElseSucceed.
  • labeling-wire.ts is deleted, and its importers read @janitor/domain. The PR-review components get RepositoryOverview from @janitor/domain/Labeling/Reconciliation.
  • The wire file also held display helpers, which now sit beside their domain types:
    • labelName, policyName and describeRevision go to Labeling/Policy/Configuration.
    • describeOutcome goes to Labeling/Policy/Program.
    • describePlan goes to Labeling/Reconciliation.
    • describeLocation was a copy of the existing formatNodeLocation, so callers use that instead.
  • The editor's free-JSON forms stay in the web app. ProgramSource and formatSource move to policy-source/format.ts, and TestSubject and TestCandidates move to test-bench.ts.

Checks

At 9f3d7a8, in the Nix shell:

  • vp check: 0 errors, 333 warnings.
  • vp test: 132 files, 822 tests pass.

9f3d7a8 updates the fixtures in 8 web test files (routing, ai-prompt, policy-editor, pull-request-review-transcript, pull-request-reviews, repository-switcher, rule-editor and workspace). They now build ids and revisions with the domain .make(...) constructors, because they were typed against the old wire copies. No casts, assertions or new tests.

Closes EFF-2523

The labeling group (listRepositories, getCatalog, getConfiguration,
listActivity, listReconciliations, listAudit, getAiConsent and
updateAiConsent) joins JanitorApi, and the cluster serves it from
Ingress/Labeling.ts through HttpApiBuilder behind the API middleware.

The repository-scoped reads and the consent write fail with
RepositoryNotFound; listReconciliations declares no errors. Overview,
consent, activity (including the row decode) and configuration
infrastructure failures die in the handlers.

The raw LabelingRoutes module and its test go, and Routes.ts no longer
mounts them.
The workspace loads repositories, the catalog, the configuration and AI
consent through api.labeling, and sets consent through updateAiConsent;
the activity journal pages through listActivity. Each command maps
RepositoryNotFound to "This repository is unavailable." and falls back to
its own copy with orElseSucceed.

labeling-wire.ts goes. Its importers read the domain schemas instead:
RepositoryOverview and ReconciliationRecord from Labeling/Reconciliation,
the configuration records from Labeling/Policy/Configuration, and so on.
The display helpers move beside their types: labelName, policyName and
describeRevision to Configuration, describeOutcome to Program, and
describePlan to Reconciliation; describeLocation was a copy of
formatNodeLocation. The editor's free-JSON ProgramSource and formatSource
move to policy-source/format, and TestSubject and TestCandidates to the
test bench.
The fixtures were typed against the deleted labeling-wire copies. Brand
their ids and revisions with the domain constructors and build catalog
entries with FactDescription.make.
@tim-smart
tim-smart merged commit faaa576 into main Oct 20, 2026
4 checks passed
@tim-smart
tim-smart deleted the agent/nelson/e4437223fbc3 branch October 20, 2026 05:23
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