Import repair: Done card retried via an existing remote issue is linked but not closed on Forgejo #100

Open
opened 2026-10-19 02:39:58 +08:00 by Breadway · 0 comments
Owner

How found: coordinator re-review of Breadway/breadboard PR98 at head 4e404eca (code reading; not reproduced against a live Forgejo).

Confidence: medium-high (clear from the code paths; not covered by any test).

Explanation: in writeback_new_issue_result, the remote closed state for a Done card is applied only on the fresh-create-then-link success path. Two early-return paths skip it: (a) when forgejo::find_import_issue finds the marker and links the existing issue, and (b) when store::link_issue errors and find_issue_by_forgejo finds the already-linked issue. A Done local card retried through either path links to an open remote issue, so local and remote state diverge and a reconcile pass may report drift. Reachable when an earlier create succeeded but the subsequent link failed for a card that is Done.

Suggested fix: apply the same Done-close after a successful link in both early-return paths, for example by extracting a helper that links and then closes when the linked status is Done.

Also observed: forgejo::find_import_issue lists only page 1 (limit 50) of /issues?state=all, so on a busy repository the marker lookup can miss a just-created issue that is not on the first page. Consider paging the lookup or a marker-targeted search.

Refs PR98 (merged 2a538f089a), review 5442.

**How found:** coordinator re-review of Breadway/breadboard PR98 at head 4e404eca (code reading; not reproduced against a live Forgejo). **Confidence:** medium-high (clear from the code paths; not covered by any test). **Explanation:** in `writeback_new_issue_result`, the remote closed state for a Done card is applied only on the fresh-create-then-link success path. Two early-return paths skip it: (a) when `forgejo::find_import_issue` finds the marker and links the existing issue, and (b) when `store::link_issue` errors and `find_issue_by_forgejo` finds the already-linked issue. A Done local card retried through either path links to an open remote issue, so local and remote state diverge and a reconcile pass may report drift. Reachable when an earlier create succeeded but the subsequent link failed for a card that is Done. **Suggested fix:** apply the same Done-close after a successful link in both early-return paths, for example by extracting a helper that links and then closes when the linked status is Done. **Also observed:** `forgejo::find_import_issue` lists only page 1 (limit 50) of `/issues?state=all`, so on a busy repository the marker lookup can miss a just-created issue that is not on the first page. Consider paging the lookup or a marker-targeted search. Refs PR98 (merged 2a538f089aca78df9b192dacd1b97da807d820b5), review 5442.
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
Breadway/breadboard#100
No description provided.