From 781b0f7ef0a492568b80e32d75e0e5838cd6b5c0 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 17 Jul 2026 14:49:25 +0000 Subject: [PATCH] chore: update OpenWolf session state + cerebrum learning (Unity test-harness fix) Records the controller_unit_test nested UNITY_BEGIN/UNITY_END fix (commit a81f2a2) in cerebrum.md for future sessions, plus routine anatomy/memory/token-ledger session bookkeeping. --- .wolf/anatomy.md | 5 +- .wolf/cerebrum.md | 3 + .wolf/hooks/_session.json | 26 ++- .wolf/memory.md | 6 + .wolf/token-ledger.json | 377 +++++++++++++++++++++++++++++++++++++- 5 files changed, 404 insertions(+), 13 deletions(-) diff --git a/.wolf/anatomy.md b/.wolf/anatomy.md index 22feaf9..2a0ba97 100644 --- a/.wolf/anatomy.md +++ b/.wolf/anatomy.md @@ -1,7 +1,7 @@ # anatomy.md -> Auto-maintained by OpenWolf. Last scanned: 2026-07-17T14:12:29.159Z -> Files: 681 tracked | Anatomy hits: 0 | Misses: 0 +> Auto-maintained by OpenWolf. Last scanned: 2026-07-17T14:29:03.853Z +> Files: 682 tracked | Anatomy hits: 0 | Misses: 0 ## ../../../../../../tmp/claude-1000/ @@ -1032,6 +1032,7 @@ - `test_persist_recovery.c` — define _GNU_SOURCE (~3778 tok) - `test_persist_snapshot_entities.c` — unsigned: queue (~14897 tok) - `test_persist_truncate.c` — define _GNU_SOURCE (~5031 tok) +- `test_repl_unit.c` — include (~6230 tok) - `test_replay_apply_seam.c` — Declares through (~3707 tok) - `test_snapdiff.c` — define _GNU_SOURCE (~1033 tok) - `test_snapverify.c` — define _GNU_SOURCE (~2008 tok) diff --git a/.wolf/cerebrum.md b/.wolf/cerebrum.md index f98da00..ec4ec44 100644 --- a/.wolf/cerebrum.md +++ b/.wolf/cerebrum.md @@ -470,3 +470,6 @@ During bug-1445's post-fix regression pass, `nix develop ./src --command bash sr ## Key Learning (2026-07-17) — `/tmp/xce_*` WAL test-fixture dirs accumulate fast across repeated ASAN cycles; same root pattern as bug-924 Found 2089 leftover `/tmp/xce_*` directories (~89GB) during the bug-1445 regression pass, left behind by C testsuite fixtures that `mkdtemp("/tmp/xce_*_XXXXXX")` a workdir and don't always clean it up on every exit path (crash, ASAN abort, or a test killed mid-run). This is disk-pressure buildup of the same shape as bug-924 (overlayfs fdatasync wedge under accumulated pressure), not a new bug — just a maintenance reminder. **Key learning**: periodically `rm -rf /tmp/xce_*` between heavy test cycles in a long-lived sandbox session, especially after any run that included ASAN aborts/kills (which skip the test's own cleanup code) — cheap to do, and left unchecked it can eventually degrade or destabilize unrelated test runs sharing `/tmp`. + +## Fixed (2026-07-17) — `controller_unit_test`'s nested `UNITY_BEGIN()`/`UNITY_END()` calls masked most of the suite's exit code; fixed suite-wide via `UnitySetTestFile` +Root cause of the 2026-06-11 Unity-quirk note (file misattribution) turned out to be worse than cosmetic: only 21 of 86 `test_*.c` group-function files called their own nested `UNITY_BEGIN()`/`UNITY_END()` (each call resets `Unity.NumberOfTests`/`TestFailures` globally); the other 65 correctly relied on the single outer `UNITY_BEGIN()`/`return UNITY_END();` pair in `controller_test.c:main()`. Net effect: `controller_test.c`'s final `return UNITY_END();` — the value `meson test` actually gates on — only ever reflected whichever small window of tests ran since the LAST nested reset (empirically 16 of 972 total tests in one observed run), silently discarding pass/fail evidence for the other ~956. **Fix**: replaced every nested `UNITY_BEGIN();` with `UnitySetTestFile(__FILE__);` (sets the file-attribution pointer only, no counter reset — `unity_internals.h:546`, already visible via the existing `#include `) and deleted the corresponding `UNITY_END();`; added the same `UnitySetTestFile(__FILE__);` as the first statement to the other 65 group functions that had neither. Left the 2 genuinely-standalone binaries (`test_job_array_sched_push.c`, `test_job_array_apiserver_push.c` — each has its own `int main()`, not registered via `controller_test.c`'s `TEST()` macro) untouched. Verified both effects: (1) file attribution — every `PASS`/`FAIL` banner now names its own true source file; (2) exit-code integrity — the single final summary now reads `972 Tests 0 Failures 0 Ignored OK`, exactly matching the ground-truth `grep -c RUN_TEST(` across all 83 registered group files (976 total RUN_TEST call sites minus 4 belonging to the 2 standalone binaries = 972). Full rebuild + `xce-build.sh all` regression pass clean. **Key learning**: `UnitySetTestFile()` (distinct from `UnityBegin()`, which calls it internally AND resets counters) is the correct primitive when a codebase wants per-file test-source attribution inside a single shared Unity counter/exit-code scope spanning multiple group functions in one binary — never call `UNITY_BEGIN()`/`UNITY_END()` from more than one place per test binary. diff --git a/.wolf/hooks/_session.json b/.wolf/hooks/_session.json index d6b0ca3..a305d12 100644 --- a/.wolf/hooks/_session.json +++ b/.wolf/hooks/_session.json @@ -181,6 +181,11 @@ "count": 1, "tokens": 140, "first_read": "2026-07-17T10:52:40.905Z" + }, + "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_repl_unit.c": { + "count": 2, + "tokens": 6234, + "first_read": "2026-07-17T14:28:33.396Z" } }, "files_written": [ @@ -339,6 +344,18 @@ "action": "edit", "tokens": 301, "at": "2026-07-17T14:12:29.174Z" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_repl_unit.c", + "action": "edit", + "tokens": 31, + "at": "2026-07-17T14:28:43.500Z" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_repl_unit.c", + "action": "edit", + "tokens": 14, + "at": "2026-07-17T14:29:03.861Z" } ], "edit_counts": { @@ -351,11 +368,12 @@ ".kiro/specs/ha-term-safety/spec.json": 1, "../../../../../../tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/ctrlstatus_delta_check.sh": 1, ".kiro/specs/controller-status/spec.json": 2, - "../../../../../../tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/fix_unity_testfile.py": 2 + "../../../../../../tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/fix_unity_testfile.py": 2, + "src/controller/testsuite/test_repl_unit.c": 2 }, "anatomy_hits": 29, - "anatomy_misses": 7, - "repeated_reads_warned": 35, + "anatomy_misses": 8, + "repeated_reads_warned": 36, "cerebrum_warnings": 0, - "stop_count": 23 + "stop_count": 24 } \ No newline at end of file diff --git a/.wolf/memory.md b/.wolf/memory.md index 34cab62..2930e75 100644 --- a/.wolf/memory.md +++ b/.wolf/memory.md @@ -5028,3 +5028,9 @@ | 06:26 | Session end: 24 writes across 7 files (handler.c, test_job_array_expand.c, tasks.md, spec.json, test_job_array_replay_fence.c) | 36 reads | ~387614 tok | | 07:12 | Created ../../../../../../tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/fix_unity_testfile.py | — | ~1438 | | 07:12 | Edited ../../../../../../tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/fix_unity_testfile.py | modified name() | ~301 | +| 07:17 | Session end: 26 writes across 8 files (handler.c, test_job_array_expand.c, tasks.md, spec.json, test_job_array_replay_fence.c) | 36 reads | ~389353 tok | +| 07:28 | Edited src/controller/testsuite/test_repl_unit.c | UNITY_BEGIN() → UnitySetTestFile() | ~29 | +| 07:29 | Edited src/controller/testsuite/test_repl_unit.c | 3→2 lines | ~14 | +| 07:35 | Scripted fix across 83 controller/testsuite/*.c group functions | UnitySetTestFile(__FILE__) added; 19 files' nested UNITY_BEGIN/UNITY_END removed | ~2100 | +| 07:36 | Verified: controller test suite 972 Tests 0 Failures 0 Ignored OK (single consolidated summary, matches ground-truth RUN_TEST count) | testlog.txt | ~50 | +| 07:37 | Updated .wolf/cerebrum.md | added Unity nested-BEGIN/END masking fix entry | ~450 | diff --git a/.wolf/token-ledger.json b/.wolf/token-ledger.json index dd5cadf..8d8ba26 100644 --- a/.wolf/token-ledger.json +++ b/.wolf/token-ledger.json @@ -2,14 +2,14 @@ "version": 1, "created_at": "2026-05-21T04:35:43.577Z", "lifetime": { - "total_tokens_estimated": 208468916, - "total_reads": 26579, - "total_writes": 42544, + "total_tokens_estimated": 208858269, + "total_reads": 26615, + "total_writes": 42570, "total_sessions": 226, - "anatomy_hits": 16875, - "anatomy_misses": 9011, - "repeated_reads_blocked": 81803, - "estimated_savings_vs_bare_cli": 1975823578 + "anatomy_hits": 16904, + "anatomy_misses": 9018, + "repeated_reads_blocked": 81838, + "estimated_savings_vs_bare_cli": 1976722694 }, "sessions": [ { @@ -391444,6 +391444,369 @@ "repeated_reads_blocked": 35, "anatomy_lookups": 29 } + }, + { + "id": "session-2026-07-17-2354", + "started": "2026-07-17T06:54:07.397Z", + "ended": "2026-07-17T14:17:02.900Z", + "reads": [ + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/src/handler.c", + "tokens_estimated": 4838, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/lib/request.c", + "tokens_estimated": 17093, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/xce.build/lib/controller.capnp.c", + "tokens_estimated": 0, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/frontend/apiserver/backend/wire_dispatch_support.go", + "tokens_estimated": 2254, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/sched_job_array_test.log", + "tokens_estimated": 0, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/test_job_array_expand.c", + "tokens_estimated": 3664, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/meson.build", + "tokens_estimated": 1057, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/tasks.md", + "tokens_estimated": 15579, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/lib/testsuite/test.c", + "tokens_estimated": 1186, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/requirements.md", + "tokens_estimated": 5216, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/design.md", + "tokens_estimated": 14117, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/steering/testing.md", + "tokens_estimated": 741, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/frontend/Makefile", + "tokens_estimated": 0, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/frontend/apiserver/meson.build", + "tokens_estimated": 0, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/spec.json", + "tokens_estimated": 444, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/ha.c", + "tokens_estimated": 111605, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/persist.c", + "tokens_estimated": 72815, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_job_array_replay_fence.c", + "tokens_estimated": 8045, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_job_array_fence.c", + "tokens_estimated": 6110, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/build_output.log", + "tokens_estimated": 0, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/ha-term-safety/requirements.md", + "tokens_estimated": 4240, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/ha-term-safety/design.md", + "tokens_estimated": 11209, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/ha-term-safety/tasks.md", + "tokens_estimated": 14377, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/controller-status/spec.json", + "tokens_estimated": 608, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/controller-status/tasks.md", + "tokens_estimated": 5073, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/controller-status/requirements.md", + "tokens_estimated": 3158, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/controller-status/design.md", + "tokens_estimated": 7961, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/clean_failover_preservation.sh", + "tokens_estimated": 0, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.claude/skills/xce-build/SKILL.md", + "tokens_estimated": 985, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.claude/skills/xce-test-ha/SKILL.md", + "tokens_estimated": 6845, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/tools/xce-build.sh", + "tokens_estimated": 1400, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/cluster.c", + "tokens_estimated": 18669, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test.c", + "tokens_estimated": 30294, + "was_repeated": true, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/schema/controller.capnp", + "tokens_estimated": 9735, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/go-frontend-test.log", + "tokens_estimated": 0, + "was_repeated": false, + "anatomy_had_description": false + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/ha-term-safety/spec.json", + "tokens_estimated": 140, + "was_repeated": false, + "anatomy_had_description": false + } + ], + "writes": [ + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/src/handler.c", + "tokens_estimated": 214, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/test_job_array_expand.c", + "tokens_estimated": 338, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/test_job_array_expand.c", + "tokens_estimated": 180, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/test_job_array_expand.c", + "tokens_estimated": 486, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/test_job_array_expand.c", + "tokens_estimated": 127, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/scheduler/testsuite/test_job_array_expand.c", + "tokens_estimated": 146, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/tasks.md", + "tokens_estimated": 30, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/tasks.md", + "tokens_estimated": 22, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/tasks.md", + "tokens_estimated": 458, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/tasks.md", + "tokens_estimated": 374, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/spec.json", + "tokens_estimated": 28, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/spec.json", + "tokens_estimated": 353, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/tasks.md", + "tokens_estimated": 370, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/spec.json", + "tokens_estimated": 122, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_job_array_replay_fence.c", + "tokens_estimated": 244, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_job_array_replay_fence.c", + "tokens_estimated": 2134, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/testsuite/test_job_array_replay_fence.c", + "tokens_estimated": 50, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/src/controller/ha.c", + "tokens_estimated": 760, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/spec.json", + "tokens_estimated": 28, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/job-array-single-wal-record/spec.json", + "tokens_estimated": 102, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/ha-term-safety/spec.json", + "tokens_estimated": 644, + "action": "edit" + }, + { + "file": "/tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/ctrlstatus_delta_check.sh", + "tokens_estimated": 403, + "action": "create" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/controller-status/spec.json", + "tokens_estimated": 28, + "action": "edit" + }, + { + "file": "/home/rshen/projects/xce/worktrees/raft_tla/.kiro/specs/controller-status/spec.json", + "tokens_estimated": 515, + "action": "edit" + }, + { + "file": "/tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/fix_unity_testfile.py", + "tokens_estimated": 1438, + "action": "create" + }, + { + "file": "/tmp/claude-1000/-home-rshen-projects-xce-worktrees-raft-tla/1c68567a-5bf5-4a4d-980c-beb4c42e613d/scratchpad/fix_unity_testfile.py", + "tokens_estimated": 301, + "action": "edit" + } + ], + "totals": { + "input_tokens_estimated": 379458, + "output_tokens_estimated": 9895, + "reads_count": 36, + "writes_count": 26, + "repeated_reads_blocked": 35, + "anatomy_lookups": 29 + } } ], "daemon_usage": [],