main does not typecheck: clearProgressLabel calls the removed this.swapLabels #256

Closed
opened 2026-11-11 10:33:02 +01:00 by omp-deck · 1 comment
Collaborator

bun run typecheck fails on main (8d03452):

@omp-deck/server typecheck: src/forgejo/dispatcher.ts(2535,27): error TS2339: Property 'swapLabels' does not exist on type 'ForgejoDispatcher'.

Cause

Two branches merged into main in the same window:

  • #249 (feat(server): mark planned issues with a configurable planned_label, a690585) replaced the private ForgejoDispatcher.swapLabels helper with the free function applyLabelDelta in apps/server/src/forgejo/issue-labels.ts and migrated its call sites.
  • #250 (fix(server): do not report a merged implementation as abandoned, a0f3b07) added clearProgressLabel, which calls this.swapLabels(api, { owner, repo, number }, { add: null, remove: progressLabel }).

The merge commit 8d03452 took both, so the new call site refers to a method that no longer exists. Neither branch was red on its own; only the merge is.

Fix

In clearProgressLabel (apps/server/src/forgejo/dispatcher.ts:2694), use the replacement — note that applyLabelDelta takes arrays, not single names:

const why = await applyLabelDelta(api, { owner, repo, number }, { remove: [progressLabel] });

applyLabelDelta is already imported in that file.

Impact

main is red, so every branch cut from it fails the typecheck job until this lands. Found while implementing #238; not fixed there to keep that branch on topic.

`bun run typecheck` fails on `main` (8d03452): ``` @omp-deck/server typecheck: src/forgejo/dispatcher.ts(2535,27): error TS2339: Property 'swapLabels' does not exist on type 'ForgejoDispatcher'. ``` ## Cause Two branches merged into `main` in the same window: - #249 (`feat(server): mark planned issues with a configurable planned_label`, a690585) replaced the private `ForgejoDispatcher.swapLabels` helper with the free function `applyLabelDelta` in `apps/server/src/forgejo/issue-labels.ts` and migrated its call sites. - #250 (`fix(server): do not report a merged implementation as abandoned`, a0f3b07) added `clearProgressLabel`, which calls `this.swapLabels(api, { owner, repo, number }, { add: null, remove: progressLabel })`. The merge commit 8d03452 took both, so the new call site refers to a method that no longer exists. Neither branch was red on its own; only the merge is. ## Fix In `clearProgressLabel` (`apps/server/src/forgejo/dispatcher.ts:2694`), use the replacement — note that `applyLabelDelta` takes arrays, not single names: ```ts const why = await applyLabelDelta(api, { owner, repo, number }, { remove: [progressLabel] }); ``` `applyLabelDelta` is already imported in that file. ## Impact `main` is red, so every branch cut from it fails the typecheck job until this lands. Found while implementing #238; not fixed there to keep that branch on topic.
Author
Collaborator

It is not only a type error: this.swapLabels(…) throws TypeError at runtime, which clearProgressLabel's own try/catch swallows into a log.warn, so the progress label silently stays on the issue.

The existing test already catches it — bun test in apps/server on main fails with:

(fail) ForgejoDispatcher own-PR CI > a merged implementation loses the progress label of its issue
expect(h.api.labelPuts).toEqual([{ number: 4, ids: [] }])
Received: []

So both typecheck and test are red on main until this is fixed.

It is not only a type error: `this.swapLabels(…)` throws `TypeError` at runtime, which `clearProgressLabel`'s own `try`/`catch` swallows into a `log.warn`, so the progress label silently stays on the issue. The existing test already catches it — `bun test` in `apps/server` on `main` fails with: ``` (fail) ForgejoDispatcher own-PR CI > a merged implementation loses the progress label of its issue expect(h.api.labelPuts).toEqual([{ number: 4, ids: [] }]) Received: [] ``` So both `typecheck` and `test` are red on `main` until this is fixed.
lucas closed this issue 2026-11-11 11:19:54 +01:00
Sign in to join this conversation.
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
lucas/omp-deck#256
No description provided.