From d6cd1585e27f4b0de9148baf3f8a912746fbcc32 Mon Sep 17 00:00:00 2001 From: Julian Noble Date: Fri, 10 Jul 2026 00:45:33 +1000 Subject: [PATCH] punk::console 0.7.2: console_fact_get/console_fact_set key -choiceprefix 0 PUNKARGS fix console_fact_get and console_fact_set documented -choices on the key argument with -choiceprefix defaulting to true (prefix matching promised), but the manual positional parser feeds key directly into a dict lookup with no prefix normalization. PUNKARGS now declares -choiceprefix 0 so documented behaviour matches the implementation (exact match required). Assisted-by: harness=opencode; primary-model=openrouter/z-ai/glm-5.2; api-location=openrouter.ai --- src/modules/punk/console-999999.0a1.0.tm | 4 ++-- src/modules/punk/console-buildversion.txt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/punk/console-999999.0a1.0.tm b/src/modules/punk/console-999999.0a1.0.tm index ce8240ba..8971d7aa 100644 --- a/src/modules/punk/console-999999.0a1.0.tm +++ b/src/modules/punk/console-999999.0a1.0.tm @@ -2336,7 +2336,7 @@ namespace eval punk::console { consolespec -type list -help\ "Console specification: {in out} channel pair, anchored opunk::console instance name, or ::opunk::Console object value." - key -type string -choices {is_vt52 tabwidth cell_size last_da1_result grapheme_cluster_support has_bug_legacysymbolwidth has_bug_zwsp} + key -type string -choices {is_vt52 tabwidth cell_size last_da1_result grapheme_cluster_support has_bug_legacysymbolwidth has_bug_zwsp} -choiceprefix 0 }] proc console_fact_get {consolespec key} { #see PUNKARGS id ::punk::console::console_fact_get @@ -2374,7 +2374,7 @@ namespace eval punk::console { consolespec -type list -help\ "Console specification: {in out} channel pair, anchored opunk::console instance name, or ::opunk::Console object value." - key -type string -choices {is_vt52 tabwidth cell_size last_da1_result grapheme_cluster_support has_bug_legacysymbolwidth has_bug_zwsp} + key -type string -choices {is_vt52 tabwidth cell_size last_da1_result grapheme_cluster_support has_bug_legacysymbolwidth has_bug_zwsp} -choiceprefix 0 value -type any }] proc console_fact_set {consolespec key value} { diff --git a/src/modules/punk/console-buildversion.txt b/src/modules/punk/console-buildversion.txt index 454dab0e..00ca3da9 100644 --- a/src/modules/punk/console-buildversion.txt +++ b/src/modules/punk/console-buildversion.txt @@ -1,6 +1,7 @@ -0.7.1 +0.7.2 #First line must be a semantic version number #all other lines are ignored. +#0.7.2 - PUNKARGS fix: console_fact_get/console_fact_set key argument now declares -choiceprefix 0 so documented behaviour matches the manual positional parser (exact key match required, no prefix matching - the proc feeds key directly into a dict lookup that has no prefix normalization) #0.7.1 - new idle-reader hostage guard in get_ansi_response_payload: on a tcl 8.6 windows console in cooked (line) mode with a readable handler armed on stdin (the idle-at-a-line-mode-prompt condition - e.g. a query fired from an after-script or worker thread while the shell waits for input), the query now fails fast with errorcode {PUNK CONSOLE QUERY HOSTAGE_COOKED_READ} and emits nothing, instead of timing out (~500ms) and having the response swallowed by the driver's parked cooked ReadConsole until Enter then leaking to the line reader as phantom input. Mid-command queries (repl reader disarmed) and raw mode are unaffected; best-effort - a parked read can outlive a removed handler, so the guard catches the systematic case only #0.7.1 - compound emit-then-query operations flush their emissions before querying: get_size_using_cursormove/get_size_using_cursorrestore (the far-corner move), test_char_width (positioning and the measured test emission) and test_string_cursor (alt-screen/move/erase). Under G-007 routing the position query may execute in the console-owning thread, whose flush acts on its own channel instance for the same OS handle - the caller's unflushed emissions then reach the terminal after the query measures, e.g. get_size returning 'columns 1' on tcl 8.6 where the -winsize shortcut is unavailable and the ANSI mechanism actually runs (pre-routing this was masked because emit and query shared one channel instance, so the query's flush pushed the emissions too). Error paths flush their cursor-restore emissions likewise. #0.7.1 - ensure_object_integration hardening: returns 0 as a graceful no-op (without latching object_integration_done) when opunk::console is not loaded, instead of erroring into the nonexistent namespace; and on wiring the lifecycle callback it retro-registers ownership for anchors created in this interp before the wiring (previously 'package require opunk::console; opunk::console::create ...' with no intervening punk::console object operation left the console without a registered owner - fact-store share qualifiers then fell back to the calling thread and other threads could not address that console's facts). Retro-registration fills empty registry entries only; existing live registrations are preserved.