refactor(janitor): migrate to adapter factory (MF-10) #320

Merged
code-lead merged 1 commit from feat/mf10-migrate-janitor into main 2026-04-24 10:39:52 +00:00
Collaborator

Summary

Cleanup of MF-8 (#299) out-of-scope list — migrates janitor.ts from hard-coded new ForgejoAdapter(token) instantiations to createForgeAdapterForRepo(repo, token) from the adapter factory (MF-4).

All 15 call sites in the production impl seam now resolve the correct adapter (Forgejo / GitHub / GitLab) per-repo via the forge: binding in config/agents.json, instead of silently falling back to Forgejo. This finally makes the janitor's auto-heal paths actually multi-forge.

  • Replaces new ForgejoAdapter(token).X(...) with createForgeAdapterForRepo(repo, token).X(...) at all 15 call sites
  • Drops ForgejoAdapter from the forgejo-adapter import (only parseRepo remains — the helper is generic)
  • Adds createForgeAdapterForRepo import from ../infrastructure/forge/adapter-factory
  • Refreshes the module and impl doc-blocks to describe the factory-driven seam
  • No seam-shape change: every existing method already takes repo: string as the first argument, so callers and tests are unchanged

Test plan

  • bun x turbo run typecheck clean
  • bun x biome check clean (299 files)
  • bun test src/background/janitor.test.ts — 42 pass / 0 fail, 89 expect() calls
  • Ship on main and confirm the janitor pass still reports actions against the Forgejo repos; no behaviour change expected for currently-bound repos.

Refs MF-8 (#299, #313) — this was the explicit out-of-scope follow-up called out in the MF-8 PR body.

## Summary Cleanup of MF-8 (#299) out-of-scope list — migrates `janitor.ts` from hard-coded `new ForgejoAdapter(token)` instantiations to `createForgeAdapterForRepo(repo, token)` from the adapter factory (MF-4). All 15 call sites in the production `impl` seam now resolve the correct adapter (Forgejo / GitHub / GitLab) per-repo via the `forge:` binding in `config/agents.json`, instead of silently falling back to Forgejo. This finally makes the janitor's auto-heal paths actually multi-forge. - Replaces `new ForgejoAdapter(token).X(...)` with `createForgeAdapterForRepo(repo, token).X(...)` at all 15 call sites - Drops `ForgejoAdapter` from the `forgejo-adapter` import (only `parseRepo` remains — the helper is generic) - Adds `createForgeAdapterForRepo` import from `../infrastructure/forge/adapter-factory` - Refreshes the module and `impl` doc-blocks to describe the factory-driven seam - No seam-shape change: every existing method already takes `repo: string` as the first argument, so callers and tests are unchanged ## Test plan - [x] `bun x turbo run typecheck` clean - [x] `bun x biome check` clean (299 files) - [x] `bun test src/background/janitor.test.ts` — 42 pass / 0 fail, 89 expect() calls - [ ] Ship on main and confirm the janitor pass still reports actions against the Forgejo repos; no behaviour change expected for currently-bound repos. Refs MF-8 (#299, #313) — this was the explicit out-of-scope follow-up called out in the MF-8 PR body.
refactor(janitor): migrate to adapter factory (MF-10)
All checks were successful
qa / qa (pull_request) Successful in 3m51s
qa / dockerfile (pull_request) Successful in 8s
1e82a5f440
code-lead deleted branch feat/mf10-migrate-janitor 2026-04-24 10:39:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!320
No description provided.