Skip to content

fix(sdk/kanban): resolve 6 bugs from issue #28; unify event source on Board.Bus#29

Merged
lIang70 merged 1 commit into
mainfrom
fix/kanban-issue-28
Apr 22, 2026
Merged

fix(sdk/kanban): resolve 6 bugs from issue #28; unify event source on Board.Bus#29
lIang70 merged 1 commit into
mainfrom
fix/kanban-issue-28

Conversation

@lIang70

@lIang70 lIang70 commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Closes #28.

Summary

Fixes the six bugs reported in #28 across sdk/kanban and consolidates the event surface so Board.Bus() is the single source of truth.

# Sev Bug Fix
1 P0 Watcher event drop on bounded chan Unbounded queue + pump goroutine; watcherDropped only counts post-shutdown
2 P1 Cron-rule / result cards leak into Cards() & Timeline() isInternalCardType filter
3 P1 Trace span / ProducerID lost across delayed/cron submits Capture from initial ctx, re-inject at fire; cron opens scheduler-rooted span
4 P2 Stop() hangs forever on stuck executor DefaultStopTimeout = 10s; WithStopTimeout(0) opts back to legacy
5 P2 Restored CreatedAt/UpdatedAt overwritten by replay WithTimestamps + Board.restoreTimestamps
6 P3 Event coverage gaps + dual-bus drift via WithEventBus Kanban.bus removed, Kanban.Bus() aliases board.Bus(); WithEventBus is a no-op (scheduled to be removed in v0.2.0); cron events emitted on the same bus; payloads carry Version via eventEnvelope

Behaviour change (worth flagging in v0.2 release notes)

  • kanban.New(...) now defaults to WithStopTimeout(10s). Callers that relied on Stop() blocking until every executor finished must opt back in with WithStopTimeout(0).
  • WithEventBus no longer redirects events. It is retained as a source-compat no-op until v0.2.0.

Test plan

  • go test -race -cover ./sdk/kanban/ — pass, coverage 92.5%
  • Per-bug acceptance tests added (event drop, cron filter, producer-id propagation, stop-timeout default + zero, restore-timestamps, event reconstruction)
  • Kanban test suite reorganised: board_test.go / board_restore_test.go / board_concurrency_test.go / events_test.go / kanban_test.go / scheduler_test.go, with helpers_test.go for shared fixtures, t.Parallel() everywhere it's safe
  • Downstream smoke (sdkx / runtimes) — please verify CI

Made with Cursor

… on Board.Bus

Bug 1 (P0, watcher event drop): replace bounded watcher channel with an
unbounded queue + pump goroutine so live subscribers never miss state
transitions. Track watcherDropped only for notifications to already-shut-
down watchers.

Bug 2 (P1, cron rule pollution): filter internal card types (result,
cron rule) out of Board.Cards() and Board.Timeline() via
isInternalCardType.

Bug 3 (P1, trace context loss): scheduler now captures ProducerID and
trace.SpanContext from the original ctx and re-injects them when the
delayed task is finally submitted; cron fires open a fresh span rooted
in the scheduler.

Bug 4 (P2, Stop hangs forever): Kanban.Stop now bounded by stopTimeout.
DefaultStopTimeout = 10s; pass WithStopTimeout(0) to keep the legacy
unbounded wait.

Bug 5 (P2, restored timestamps drift): add WithTimestamps CardOption
honoured by Produce, plus Board.restoreTimestamps used by RestoreTask-
Board to preserve persisted CreatedAt/UpdatedAt across state replay.

Bug 6 (P3, event coverage + dual-bus drift): Board is now the single
source of truth for state events. Kanban.bus is removed; Kanban.Bus()
is a thin alias for board.Bus(); WithEventBus is a complete no-op kept
only for source compatibility (slated for removal in v0.2.0). Scheduler
publishes EventCronRuleCreated/Fired/Disabled directly on board.Bus().
All payloads carry an explicit Version field via eventEnvelope.

Tests: kanban package fully reorganised — board/restore/concurrency/
events/scheduler split, t.Parallel() everywhere, table-driven where it
helps, helpers_test.go centralises fixtures. Coverage 92.5%, race
clean.

Made-with: Cursor
@lIang70
lIang70 merged commit b79e07c into main Apr 22, 2026
8 checks passed
@lIang70
lIang70 deleted the fix/kanban-issue-28 branch April 22, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sdk/kanban: 6 bugs (event drop / cron pollution / rate-limit bypass / trace loss / stop hang / restore timestamp / bus coverage)

1 participant