trace: add execution route visibility + debug passthrough; phase2170 canaries; docs

- Add HAKO_TRACE_EXECUTION to trace executor route
  - Rust hv1_inline: stderr [trace] executor: hv1_inline (rust)
  - Hakovm dispatcher: stdout [trace] executor: hakovm (hako)
  - test_runner: trace lines for hv1_inline/core/hakovm routes
- Add HAKO_VERIFY_SHOW_LOGS and HAKO_DEBUG=1 (enables both)
  - verify_v1_inline_file() log passthrough with numeric rc extraction
  - test_runner exports via HAKO_DEBUG
- Canary expansion under phase2170 (state spec)
  - Array: push×5/10 → size, len/length alias, per‑recv/global, flow across blocks
  - Map: set dup-key non-increment, value_state get/has
  - run_all.sh: unify, remove SKIPs; all PASS
- Docs
  - ENV_VARS.md: add Debug/Tracing toggles and examples
  - PLAN.md/CURRENT_TASK.md: mark 21.7 green, add Quickstart lines

All changes gated by env vars; default behavior unchanged.
This commit is contained in:
nyash-codex
2025-11-08 23:45:29 +09:00
parent bf185ec2b2
commit fa3091061d
49 changed files with 1334 additions and 110 deletions

View File

@ -7,6 +7,9 @@ static box GraphvizRenderBox {
render_multi(irs) {
// irs: ArrayBox of IR Map
print("digraph Hako {")
// Internal key names for node/edge key lists (avoid collisions with user names)
local NK_KEY = "__graphviz_nodes__"
local EK_KEY = "__graphviz_edges__"
// optional graph attributes (kept minimal)
// print(" rankdir=LR;")
// Node and edge sets to avoid duplicates
@ -23,7 +26,8 @@ static box GraphvizRenderBox {
// Build clusters by box: group nodes whose name looks like Box.method/arity
local groups = new MapBox()
local group_keys = new ArrayBox()
local nk = nodes.get("__keys__")
local nk = nodes.get(NK_KEY)
if nk == null { nk = new ArrayBox() }
if nk != null {
local i = 0
while i < nk.size() {
@ -60,7 +64,8 @@ static box GraphvizRenderBox {
// edges map key = from + "\t" + to
// naive iteration by trying to get keys from a stored list
// We kept an ArrayBox under edges.get("__keys__") for listing
local ks = edges.get("__keys__")
local ks = edges.get(EK_KEY)
if ks == null { ks = new ArrayBox() }
if ks != null {
local ei = 0
while ei < ks.size() {
@ -119,7 +124,7 @@ static box GraphvizRenderBox {
if name == null { return }
nodes.set(name, 1)
// also store a list of keys for emitting (since Map has no key iterator)
local arr = nodes.get("__keys__"); if arr == null { arr = new ArrayBox(); nodes.set("__keys__", arr) }
local arr = nodes.get("__graphviz_nodes__"); if arr == null { arr = new ArrayBox(); nodes.set("__graphviz_nodes__", arr) }
// avoid duplicates
local seen = 0
local i = 0; while i < arr.size() { if arr.get(i) == name { seen = 1; break } i = i + 1 }
@ -129,7 +134,7 @@ static box GraphvizRenderBox {
if src == null || dst == null { return }
local key = src + "\t" + dst
if edges.get(key) == null { edges.set(key, 1) }
local arr = edges.get("__keys__"); if arr == null { arr = new ArrayBox(); edges.set("__keys__", arr) }
local arr = edges.get("__graphviz_edges__"); if arr == null { arr = new ArrayBox(); edges.set("__graphviz_edges__", arr) }
// avoid duplicates
local seen = 0
local i = 0; while i < arr.size() { if arr.get(i) == key { seen = 1; break } i = i + 1 }