fix(sync): gitea_task_tracker_sync claims "1 card(s) processed" for read-only actions #35

Closed
opened 2026-10-24 00:59:25 +00:00 by dsh · 1 comment
Owner

Symptom

gitea_task_tracker_sync reports Task Tracker Sync: 1 card(s) processed. for actions that process no cards. status_map only returns the status mapping and convert_card only converts one card, yet both claim a card was processed.

Repro

gitea_task_tracker_sync {action:"status_map", owner:"dsh-plugins", repo:"dsh-gitea"}
→ Task Tracker Sync: 1 card(s) processed.

gitea_task_tracker_sync {action:"convert_card", card:{id:"gitea-2", title:"QA probe", status:"in_progress", number:2}}
→ Task Tracker Sync: 1 card(s) processed.

gitea_task_tracker_sync {action:"export_cards", owner:"ml-lab", repo:"tardits", state:"all"}
→ Task Tracker Sync: 1 card(s) processed.     (actually correct: 1 issue exported)

Observed vs expected

  • Observed: the formatter uses data.count ?? 1, so any action without a count is reported as "1 processed".
  • Expected status_map: print the contract + mapping (open→status/ready, …). convert_card: print the converted Gitea fields (state, target label) without claiming a sync/process. export_cards: keep the count.

Root cause

lib/handlers/formatters.js:

if (name === 'gitea_task_tracker_sync') {
  return [{ type: 'text', text: `Task Tracker Sync: ${data.count ?? 1} card(s) processed.` }]
}

lib/task-tracker-sync.js returns {contract, mapping} for status_map and the converted payload for convert_card — neither has count.

Proposed fix

Branch on the returned shape (mapping present → print the mapping; converted card present → print state + target label + number; count present → keep the current line). Add formatter tests for all four actions.

Acceptance: read-only actions never claim processing; export_cards/sync_card keep accurate counts.

Duplicate check

Searched tracker/sync (state all) — no existing issue.

Layer

dsh-gitea plugin/tool (formatter).

## Symptom `gitea_task_tracker_sync` reports `Task Tracker Sync: 1 card(s) processed.` for actions that process no cards. `status_map` only returns the status mapping and `convert_card` only converts one card, yet both claim a card was processed. ## Repro ``` gitea_task_tracker_sync {action:"status_map", owner:"dsh-plugins", repo:"dsh-gitea"} → Task Tracker Sync: 1 card(s) processed. gitea_task_tracker_sync {action:"convert_card", card:{id:"gitea-2", title:"QA probe", status:"in_progress", number:2}} → Task Tracker Sync: 1 card(s) processed. gitea_task_tracker_sync {action:"export_cards", owner:"ml-lab", repo:"tardits", state:"all"} → Task Tracker Sync: 1 card(s) processed. (actually correct: 1 issue exported) ``` ## Observed vs expected - Observed: the formatter uses `data.count ?? 1`, so any action without a `count` is reported as "1 processed". - Expected `status_map`: print the contract + mapping (open→status/ready, …). `convert_card`: print the converted Gitea fields (state, target label) without claiming a sync/process. `export_cards`: keep the count. ## Root cause `lib/handlers/formatters.js`: ```js if (name === 'gitea_task_tracker_sync') { return [{ type: 'text', text: `Task Tracker Sync: ${data.count ?? 1} card(s) processed.` }] } ``` `lib/task-tracker-sync.js` returns `{contract, mapping}` for `status_map` and the converted payload for `convert_card` — neither has `count`. ## Proposed fix Branch on the returned shape (mapping present → print the mapping; converted card present → print state + target label + number; count present → keep the current line). Add formatter tests for all four actions. Acceptance: read-only actions never claim processing; `export_cards`/`sync_card` keep accurate counts. ## Duplicate check Searched `tracker`/`sync` (state all) — no existing issue. ## Layer dsh-gitea plugin/tool (formatter).
Author
Owner

Fixed in 281eade (PR #40).

The formatter branches on the returned shape: status_map prints the contract + mapping, convert_card prints the converted state/label, export_cards prints the real count, sync_card the sync result. Read-only actions no longer claim “1 card(s) processed”.

Live: status_map → contract + todo → status/ready …; convert_card → #2 "QA probe" → state open, target label status/in-progress; export_cards → 2 card(s) exported.

Tests: test/qa-defaults.test.mjs.

Fixed in `281eade` (PR #40). The formatter branches on the returned shape: `status_map` prints the contract + mapping, `convert_card` prints the converted state/label, `export_cards` prints the real count, `sync_card` the sync result. Read-only actions no longer claim “1 card(s) processed”. Live: `status_map` → contract + `todo → status/ready` …; `convert_card` → `#2 "QA probe" → state open, target label status/in-progress`; `export_cards` → `2 card(s) exported.` Tests: `test/qa-defaults.test.mjs`.
dsh closed this issue 2026-10-24 01:16:55 +00: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
dsh-plugins/dsh-gitea#35
No description provided.