fix(cli): validate kanban current-board pointer to stop silent synth/create - #20069
Closed
konsisumer wants to merge 1 commit into
Closed
fix(cli): validate kanban current-board pointer to stop silent synth/create#20069konsisumer wants to merge 1 commit into
konsisumer wants to merge 1 commit into
Conversation
…create A stale `<root>/kanban/current` (e.g. board removed outside `boards rm`, slug typo, hand edit) was being trusted by `get_current_board()` without checking that the board existed. Read-only commands (`stats`, `list`, `boards list`, `boards show`) then resolved the active board through that slug and called `kb.connect()`, whose `path.parent.mkdir(...)` plus `sqlite3.connect()` materialized an empty board directory + DB on disk. The synthetic board then surfaced in `boards list` as if it were a real active workspace, making the user's real boards look like they had silently lost their tasks. `get_current_board()` now validates the file pointer via `board_exists()` and falls back to `default` with a stderr warning when the slug doesn't resolve. The pointer file is left in place so users can recover their selection by running `hermes kanban boards create <slug>` — the next read then honours the pointer again. The warning is deduped per process to avoid double-printing within a single CLI invocation. The `HERMES_KANBAN_BOARD` env-var path is intentionally untouched: it's written by the dispatcher on worker spawn (which already knows the board exists), so adding a runtime existence check there would only mask dispatcher bugs.
Collaborator
Collaborator
Contributor
Author
|
Closing — deferring to #20063 by @steezkelly which addresses the same. Reopen if that PR stalls. |
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.
Stop kanban from silently synthesizing/creating a board when
<root>/kanban/currentpoints at a missing slug.What changed and why
hermes_cli/kanban_db.py::get_current_board()now validates the on-disk pointer viaboard_exists()and falls back todefault(with a deduped stderr warning) when the slug doesn't resolve. Previously the slug was returned unchecked, so downstreamkb.connect()calls wouldmkdirthe board directory andsqlite3.connect()would create the DB file — making the missing slug appear inboards listas a real, active workspace and hiding the user's real boards behind a synthetic empty one.hermes kanban boards create <slug>and the next read honours the pointer again.HERMES_KANBAN_BOARDenv-var resolution is intentionally not validated: it's written by the dispatcher on worker spawn (which already knows the board exists), so a runtime existence check there would only mask dispatcher bugs.tests/hermes_cli/test_kanban_boards.py::TestStaleCurrentBoardPointercovering: fallback todefault, warning dedupe within a process, no implicit board-directory creation throughkb.connect(), recovery viaboards create, and absence fromlist_boards().How to test
default.kanban/boards/missing-board/is never created.pytest tests/hermes_cli/test_kanban_boards.py -q(54 passed locally).What platforms tested on
Fixes #20055