Skip to content

BACK-466 - Core fix: isTerminalStatus in statistics, handlers, milestones#635

Open
lenucksi wants to merge 7 commits into
MrLesk:mainfrom
lenucksi:fix/back-466-core-done-checks
Open

BACK-466 - Core fix: isTerminalStatus in statistics, handlers, milestones#635
lenucksi wants to merge 7 commits into
MrLesk:mainfrom
lenucksi:fix/back-466-core-done-checks

Conversation

@lenucksi
Copy link
Copy Markdown

@lenucksi lenucksi commented May 7, 2026

Hi,
thanks for creating this! I especially love that there's all the modalities from CLI, TUI, Web and MCP with a refreshingly simple well thought out UI/form selection.

I found a few issues around handling of translated status names, think 'Done' column -> different language. Thus I tasked the Claude with a bit of debugging and review from my side to fix it.

Basic point here is that instead of assuming that the last element of the column list is the terminal status, we now have a set of terminal stati that are explicitly configured. And there were a few hard coded cases of 'Done' which are now replaced by a lookup into the terminal set state list.

I might add a few other PRs for that feature range. And might ammend them later. Feel free to discard or take, just a fix I needed locally here.

Summary

  • Replaced all 5 hardcoded === 'Done' checks in statistics.ts with isTerminalStatus()
  • Removed private isDoneStatus() in handlers.ts; completeTask()/archiveTask() now load config and use isTerminalStatus() with the actual configured terminal status name in error messages
  • Extended milestones.ts isDoneStatus(), createBucket(), buildMilestoneBuckets(), buildMilestoneSummary() to thread statuses + terminalStatuses through the call chain
  • loadAllTasksForStatistics now returns terminalStatuses; wired through server/index.ts and commands/overview.ts
  • 4 new tests in statistics.test.ts for German-board scenario (terminalStatuses: ['Fertig'])

Depends on: BACK-465 (merged to main via 97353ba)

Test plan

  • bun test — 1246 pass, 4 pre-existing failures (auto-commit tests)
  • bunx tsc --noEmit — clean
  • bun run check . — clean
  • German-board statistics tests pass (status 'Fertig' counted as terminal)

🤖 Generated with Claude Code

Copy link
Copy Markdown
Owner

@MrLesk MrLesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alex's Agent: Thanks for working on this. The direction is useful, but I do not think this PR is ready to merge yet.

Main blockers I found:

  • The PR references BACK-466, but I cannot find a matching Backlog task. It also carries BACK-465 commits, while the current local BACK-465 task is an unrelated Windows MCP document-tool fix, and GitHub issues #465/#466 are unrelated to this work. The PR body says the BACK-465 dependency was merged to main, but these commits do not appear to be on main, so the branch/task history needs cleanup.
  • terminal_statuses is parsed into config.terminalStatuses, but this PR does not serialize it in saveConfig(). I reproduced this by setting another config key on a config file containing terminal_statuses; the save removed the terminal_statuses line.
  • The new config key is not exposed in backlog config get, set, or list, and there are no config-command tests for it. That makes the setting difficult to discover and easy to lose.
  • The runtime wiring is still partial. CLI cleanup and Core.getTerminalStatusTasksByAge() still call the terminal-status helpers without config.terminalStatuses, and Web milestones still use the old terminal-status behavior. So a custom terminal status can work in statistics/MCP paths while cleanup and milestone views still disagree.
  • There are no GitHub checks reported on this branch yet.

I would suggest rebasing/splitting this onto a clean, task-backed branch and making the terminal-status behavior complete end to end: config persistence, config commands, cleanup, statistics, milestones, MCP, and Web consumers should all agree. The existing tests that were added here pass locally, as do TypeScript and changed-file Biome checks, so the core helper/statistics part looks like a good starting point.

lenucksi and others added 7 commits May 11, 2026 22:02
- Add terminalStatuses?: string[] to BacklogConfig interface
- Parse terminal_statuses key in config loader (same pattern as statuses)
- Extend getTerminalStatus/isTerminalStatus with optional terminalStatuses param
  - Falls back to last-element convention when not provided (backward-compatible)
  - isTerminalStatus returns true for any entry in terminalStatuses array
  - getTerminalStatus returns terminalStatuses[0] as primary terminal status
- Add 5 new test cases covering multi-terminal, fallback, empty-array, and
  non-last-element override scenarios

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…atistics, milestones, handlers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uences and board filters

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…x serializeConfig

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Added 4 tests to src/web/lib/lanes.test.ts covering the sortTasksForStatus
refactoring from BACK-467: custom terminal status gets done-sort even when
not last in statuses array, empty terminalStatuses falls back to last-element
convention, and active statuses are unaffected when terminalStatuses is set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nalStatuses wiring

- config list now outputs terminalStatuses even when unset
- CLI cleanup command passes config.terminalStatuses to getTerminalStatus/isTerminalStatus
- Core.getTerminalStatusTasksByAge passes config.terminalStatuses to isTerminalStatus
- TUI: enhanced-views, simple-unified-view, unified-view all pass config.terminalStatuses to renderBoardTui
- Web Board.tsx: cleanup affordance uses isTerminalStatus(status, statuses, terminalStatuses) for all configured terminal statuses
- Web TaskList.tsx: isFilteringTerminalStatus wired through terminalStatuses prop
- Web App.tsx: passes config.terminalStatuses to TaskList
- Tests: getTerminalStatusTasksByAge + config list coverage added (RED-GREEN verified)
- package.json: fix tab indentation (upstream uses spaces, biome requires tabs)
…lated to English

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lenucksi lenucksi force-pushed the fix/back-466-core-done-checks branch from e155687 to a23cd3f Compare May 11, 2026 20:34
@lenucksi
Copy link
Copy Markdown
Author

Thanks for the thorough review — all five blockers you raised are addressed in this force-push. Here's the rundown:

1. Missing Backlog task / BACK-465 commit pollution
The branch has been rebased onto origin/main (upstream-master) from scratch. BACK-465 commits are now cherry-picked as the intentional foundation commit (they add terminalStatuses to the config schema and parser, which this feature depends on). The task files for BACK-466, BACK-467, BACK-469, and BACK-470 are now committed on this branch under backlog/tasks/.

2. saveConfig() does not serialize terminal_statuses — data loss on save
Fixed in commit 4c8cd07. serializeConfig() now writes terminal_statuses: [...] back to YAML. saveConfig() also normalizes []undefined so an empty array doesn't persist as a literal empty list. Round-trip test added: set terminal_statuses, save an unrelated key, reload — value survives.

3. config get / config set / config list not wired
Fixed in commit 4c8cd07. config get terminalStatuses reads the value; config set terminalStatuses Done,Closed parses and persists a string array; config list now shows the terminalStatuses line even when unset (so it's discoverable). Tests added for all three paths.

4. Partial runtime wiring — cleanup, getTerminalStatusTasksByAge, TUI views, Web cleanup affordance
Fixed in commit e686730:

  • CLI cleanup command now passes config.terminalStatuses to both getTerminalStatus and isTerminalStatus
  • Core.getTerminalStatusTasksByAge() receives and uses config.terminalStatuses
  • TUI: enhanced-views.ts, simple-unified-view.ts, unified-view.ts all pass config?.terminalStatuses to renderBoardTui
  • Web Board.tsx: cleanup affordance changed from getTerminalStatus(statuses) (one value) to isTerminalStatus(status, statuses, terminalStatuses) per column — shows cleanup for all configured terminal statuses
  • Web TaskList.tsx + App.tsx: terminalStatuses prop threaded through

5. No GitHub checks
CI should now run on the force-pushed commits. The branch passes bun test (1261 pass, 3 pre-existing auto-commit failures unrelated to this feature), bunx tsc --noEmit, and bun run check . locally.

PR #636 (which covered BACK-467/469/470 as a follow-on) has been closed — it's fully absorbed here.

@lenucksi lenucksi requested a review from MrLesk May 11, 2026 20:42
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.

2 participants