fix(sdk/kanban): resolve 6 bugs from issue #28; unify event source on Board.Bus#29
Merged
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28.
Summary
Fixes the six bugs reported in #28 across
sdk/kanbanand consolidates the event surface soBoard.Bus()is the single source of truth.watcherDroppedonly counts post-shutdownCards()&Timeline()isInternalCardTypefilterProducerIDlost across delayed/cron submitsStop()hangs forever on stuck executorDefaultStopTimeout = 10s;WithStopTimeout(0)opts back to legacyCreatedAt/UpdatedAtoverwritten by replayWithTimestamps+Board.restoreTimestampsWithEventBusKanban.busremoved,Kanban.Bus()aliasesboard.Bus();WithEventBusis a no-op (scheduled to be removed in v0.2.0); cron events emitted on the same bus; payloads carryVersionviaeventEnvelopeBehaviour change (worth flagging in v0.2 release notes)
kanban.New(...)now defaults toWithStopTimeout(10s). Callers that relied onStop()blocking until every executor finished must opt back in withWithStopTimeout(0).WithEventBusno 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%board_test.go/board_restore_test.go/board_concurrency_test.go/events_test.go/kanban_test.go/scheduler_test.go, withhelpers_test.gofor shared fixtures,t.Parallel()everywhere it's safeMade with Cursor