feat(analytics): explicit Column.isDone flag#66
Merged
Conversation
Replaces the analytics "last column by position = done" heuristic with an explicit, user-pinnable `Column.isDone` flag. The heuristic was a soft contract that broke for boards not ending in a Done/Closed column (e.g. a "Blocked" parking-lot column at the end), silently skewing cycle time, lead time, throughput and CFD. - Schema: `Column.isDone Boolean @default(false)` + migration `20260528000000_column_is_done`. Plain server-visible boolean like `position`/`wipLimit` — no E2EE impact. - Repository + API: create/update accept `isDone`; column DTO carries it. - UI: ✓ toggle in the column header (`aria-pressed`) + a `DONE` badge. New boards seed the default "Done" column with the flag on. - Analytics: `selectDoneColumnIds` (new pure helper in `src/lib/analytics/done-columns.ts`) prefers flagged columns and only falls back to the last-column heuristic when nothing is flagged, so pre-existing boards keep working without a backfill. Tests: `done-columns` (5 cases). CLAUDE.md schema + CHANGELOG updated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Moritz Kohm <moritz.kohm@gmail.com> Signed-off-by: Musiker15 <info@musiker15.de>
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.
Summary
Replaces the analytics "last column by position = done" heuristic with an explicit, user-pinnable
Column.isDoneflag. The heuristic silently skewed cycle time / lead time / throughput / CFD on any board that didn't end in a Done/Closed column (e.g. a trailing "Blocked" parking lot).Closes the
Column.isDoneitem from the v0.2.0-beta Deferred list.Why no ADR
Column.isDoneis a plain server-visible boolean, semantically identical to the existingColumn.position/Column.wipLimitfields (neither of which has an ADR). It introduces no new threat-model surface — the server already sees column ordering and WIP limits. The behavioural change (heuristic → flag) is documented inline + in the CHANGELOG.Changes
Column.isDone Boolean @default(false)+ hand-written migration20260528000000_column_is_done(ALTER TABLE … ADD COLUMN … DEFAULT false).Columns.create+Columns.updateacceptisDone;POST /api/boards/[id]/columnsandPATCH /api/columns/[id]validate it;ColumnDtocarries it.kanban-view.tsx): a ✓ toggle in each column header (aria-pressed, descriptivetitle) plus aDONEbadge when flagged. Optimistic flip inboard-client.tsxwith revert-on-failure. New boards seed the default "Done" column with the flag on.selectDoneColumnIdsintosrc/lib/analytics/done-columns.ts(pure, dependency-free). Prefers flagged columns; falls back to the legacy last-column heuristic only when nothing is flagged — so existing boards keep working without a data backfill.Backward compatibility
Existing boards have
isDone = falseeverywhere after the migration → the fallback keeps their analytics identical to today. The moment a user flags a column, the explicit set takes over.Tests
tests/unit/done-columns.test.ts— 5 cases (empty, flagged set, flag overrides positional fallback, last-column fallback, fallback respects position not array order).pnpm typecheck+pnpm lintclean.Test plan
DONEbadge by default🤖 Generated with Claude Code