refactor(server): extend ForgeIssueRef.sourceRepo; migrate deps.ts cross-repo filter off raw API #282

Merged
charles merged 1 commit from refactor/deps-sourcerepo-holdout into main 2026-04-23 23:06:20 +00:00
Collaborator

Removes the last raw forgejo-api import from production code (webhook.test.ts's remaining import is test-only).

What

  • ForgeIssueRef gains sourceRepo?: string — populated when the dependency edge crosses repo boundaries.
  • ForgejoAdapter.getBlockers / getBlocked stop filtering cross-repo entries out; they pass them through with attribution.
  • deps.ts::findDependents now calls forge.getBlocked(...) and filters entry.sourceRepo === undefined for the same-repo-only semantics issue #196 requires.
  • Adapter test file gains 2 tests covering the cross-repo attribution for both directions.

Why

deps.ts was the last production module still importing from forgejo-api directly. The port's getBlocked used to drop the repository.full_name field, which the cross-repo filter in findDependents needed — so we kept a raw import. Extending ForgeIssueRef with sourceRepo lets the port carry what the filter wants, and the raw import goes away.

Checks

  • bunx tsc --noEmit -p apps/server/tsconfig.json — EXIT=0
  • bun --cwd apps/server test — 1010 pass / 3 pre-existing fails (session JSONL pruning × 3)
  • grep -rn "infrastructure/forge/forgejo-api" apps/server/src --include="*.ts" | grep -v "forgejo-adapter\|forgejo-api.test\|forgejo-api.ts:"webhook.test.ts:88 (test-only, documented) is the only remaining import.
Removes the last raw `forgejo-api` import from production code (`webhook.test.ts`'s remaining import is test-only). ## What - `ForgeIssueRef` gains `sourceRepo?: string` — populated when the dependency edge crosses repo boundaries. - `ForgejoAdapter.getBlockers` / `getBlocked` stop filtering cross-repo entries out; they pass them through with attribution. - `deps.ts::findDependents` now calls `forge.getBlocked(...)` and filters `entry.sourceRepo === undefined` for the same-repo-only semantics issue #196 requires. - Adapter test file gains 2 tests covering the cross-repo attribution for both directions. ## Why deps.ts was the last production module still importing from `forgejo-api` directly. The port's `getBlocked` used to drop the `repository.full_name` field, which the cross-repo filter in `findDependents` needed — so we kept a raw import. Extending `ForgeIssueRef` with `sourceRepo` lets the port carry what the filter wants, and the raw import goes away. ## Checks - `bunx tsc --noEmit -p apps/server/tsconfig.json` — EXIT=0 - `bun --cwd apps/server test` — 1010 pass / 3 pre-existing fails (session JSONL pruning × 3) - `grep -rn "infrastructure/forge/forgejo-api" apps/server/src --include="*.ts" | grep -v "forgejo-adapter\|forgejo-api.test\|forgejo-api.ts:"` → `webhook.test.ts:88` (test-only, documented) is the only remaining import.
refactor(server): extend ForgeIssueRef.sourceRepo; migrate deps.ts cross-repo filter off raw API
All checks were successful
qa / qa (pull_request) Successful in 4m19s
qa / dockerfile (pull_request) Successful in 8s
f2ab4178ff
Eliminate the last raw forgejo-api import in production code. deps.ts::findDependents
previously needed getIssueBlocks directly because the port dropped the cross-repo
repository.full_name attribution the #196 same-repo filter depends on.

- ForgeIssueRef gains an optional sourceRepo ("owner/name" of a foreign repo, undefined
  for same-repo refs).
- ForgejoAdapter.getBlockers / getBlocked populate sourceRepo when the underlying row's
  repository.full_name differs from the queried repo; same-repo refs are unchanged.
- findDependents now calls forge.getBlocked and filters sourceRepo === undefined to
  preserve the original same-repo-only policy.
- Adapter tests cover the cross-repo attribution case (getBlockers + getBlocked).

After this, the only remaining forgejo-api import outside the adapter is webhook.test.ts
(test-only).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
charles deleted branch refactor/deps-sourcerepo-holdout 2026-04-23 23:06:21 +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!282
No description provided.