cccc icon indicating copy to clipboard operation
cccc copied to clipboard

A task still counts as blocked after every task in its `blocked_by` is done

Open chriscoveries opened this issue 3 weeks ago • 3 comments

What happens

blocked_by is a plain id list. The daemon's blocked tests read only whether the list is non-empty:

  • crates/cccc-daemon/src/ops/task_list_query.rs blocked() (task list blocked filter and blocked count)
  • crates/cccc-daemon/src/ops/context_projection.rs is_blocked() (attention blocked count and entries)

Nothing clears the list when a blocker closes, so a task blocked by a finished task stays in the blocked filter, the blocked count and the attention list until someone edits it by hand.

How we found it (real data, counts only)

A working group's board on v0.4.49 (main fa868a363, 2026-11-06); both functions are unchanged at v0.4.50 and main (2736b359): 1158 tasks; 24 open tasks have a non-empty blocked_by whose every entry is done. All 24 show as blocked. Our orchestrator works around it by writing blocked_by minus the finished id after each close.

Proposal (bounded, no policy)

Treat a blocker as open only while its task exists and its status is not done or archived:

  1. One helper open_blockers(doc, task) in cccc-core, used by both daemon tests above.
  2. Projections add open_blocked_by (the open subset) next to the stored blocked_by; stored data is not rewritten.
  3. A missing blocker id keeps blocking (fail closed) — or should it be dropped? Your call.

Out of scope: auto-editing blocked_by, events, notifications.

Tests

Unit tests on both paths: blocker planned -> blocked; blocker done -> not blocked; blocker archived -> not blocked; missing blocker -> per the answer to 3; waiting_on unchanged.

Test environment

Proposal only; a PR follows the answer. Fork CI on GitHub-hosted runners.

chriscoveries avatar Nov 08 '26 15:11 chriscoveries

Thanks, confirmed: blocked() in crates/cccc-daemon/src/ops/task_list_query.rs and is_blocked() in crates/cccc-daemon/src/ops/context_projection.rs only test that blocked_by is non-empty, and so does the Web's task card badge (web/src/components/ContextModal/coordination/TaskCardBadges.tsx), so a finished blocker keeps the task blocked in all three places. We'd take a PR along your lines:

  1. One helper in cccc-core decides which blockers are still open.
  2. A blocker stops counting when its task is done or archived. Archiving is not the same as finishing, since a planned or active task can be archived as dropped, but a dropped blocker can no longer be waited on, so it should stop blocking too. Because the open set is derived, reopening a blocker, or restoring it to planned or active, makes it block again; restoring it to done does not.
  3. An ID that names no task keeps blocking, as it does today, so a typo or a removed task stays visible.
  4. Projections add open_blocked_by next to the stored blocked_by, and the Web badge uses it, so the list filter, the counts, the attention list and the badge agree. Stored data stays as it is, and waiting_on is unchanged.

Tests as you listed, plus the badge, and a blocker restored to an unfinished status (blocks again) and to done (does not).

ChesterRa avatar Nov 09 '26 02:11 ChesterRa

I've kept this to the derived open-blocker projection you described: #224. It covers both task-list and context responses through to the badge, including blockers outside a selected page, restored unfinished blockers, restored done blockers and unresolved IDs. Stored dependencies and waiting_on are unchanged.

chriscoveries avatar Nov 11 '26 19:11 chriscoveries

Thank you for fixing this. Since 2e680d1e7 ("Fix task blocking, headless state, connector rotation and pairing", v0.4.55), a task whose blockers are all done no longer counts as blocked. I checked this in the v0.4.58 source and have not yet re-run it on a live instance. Closing, with thanks.

chriscoveries avatar Nov 16 '26 21:11 chriscoveries