fix(kanban): keep board-management commands independent from board override

This commit is contained in:
QuenVix
2026-05-18 20:14:21 -07:00
committed by Teknium
parent 8a64e1580b
commit afae2dd9ec
2 changed files with 18 additions and 9 deletions
+8 -9
View File
@@ -692,6 +692,14 @@ def kanban_command(args: argparse.Namespace) -> int:
)
return 0
# Board-management commands operate on board metadata and the persisted
# current-board pointer itself. They must ignore the shared `--board`
# task-routing override; otherwise `/kanban --board beta boards show`
# reports beta as the current board even when the on-disk pointer is
# alpha.
if action == "boards":
return _dispatch_boards(args)
# `--board <slug>` applies to every subcommand below by way of an
# env-var pin for the duration of this call. Using HERMES_KANBAN_BOARD
# (rather than threading `board=` through 50+ kb.connect() sites)
@@ -729,15 +737,6 @@ def kanban_command(args: argparse.Namespace) -> int:
os.environ["HERMES_KANBAN_BOARD"] = normed
restore_board_env = True
# Boards management doesn't touch the DB at all — dispatch early so
# fresh installs that haven't initialized any DB can still use
# `hermes kanban boards create …`.
if action == "boards":
try:
return _dispatch_boards(args)
finally:
_restore_board_env()
# Auto-initialize the DB before dispatching any subcommand. init_db
# is idempotent, so running it every invocation is cheap (one
# SELECT against sqlite_master when tables already exist) and
+10
View File
@@ -402,3 +402,13 @@ def test_run_slash_board_override_restores_prior_env(kanban_home, monkeypatch):
kc.run_slash("--board alpha list")
assert os.environ.get("HERMES_KANBAN_BOARD") == "beta"
def test_run_slash_board_override_does_not_change_boards_show_current(kanban_home):
kb.create_board("alpha")
kb.create_board("beta")
kb.set_current_board("alpha")
out = kc.run_slash("--board beta boards show")
assert "Current board: alpha" in out