From 655357806efa9e3960d4832bdb51287a28767495 Mon Sep 17 00:00:00 2001 From: Eureka Date: Fri, 6 Nov 2026 12:34:46 +0000 Subject: [PATCH 01/30] testparse: read dotnet 10's "Total tests:" summary block dotnet 10 at normal verbosity ends a run with Total tests: N / Passed: N / Failed: N / Skipped: N (one count per indented line, zero counts omitted) instead of the one-line "Passed! - Failed: ..." form, so mutation-table.sh baselines read as "ran zero tests". tp_scan now parses both forms. A count the block does not account for (Total - Passed - Failed - Skipped) is counted as failed, so a cut-off block cannot read as clean; a "Total tests:" line that is not a count recognises nothing. Fixtures: dotnet10-green/red/zero.log are real dotnet 10.0.403 MSTest runs (-v n); dotnet10-all-failed/truncated.log are hand-written. Co-Authored-By: Claude Sonnet 5.5 --- tools/fixtures/logs/dotnet10-all-failed.log | 4 ++++ tools/fixtures/logs/dotnet10-green.log | 12 +++++++++++ tools/fixtures/logs/dotnet10-red.log | 22 +++++++++++++++++++++ tools/fixtures/logs/dotnet10-truncated.log | 3 +++ tools/fixtures/logs/dotnet10-zero.log | 3 +++ tools/test-tools.sh | 19 ++++++++++++++++++ tools/testparse.sh | 19 +++++++++++++++++- 7 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 tools/fixtures/logs/dotnet10-all-failed.log create mode 100644 tools/fixtures/logs/dotnet10-green.log create mode 100644 tools/fixtures/logs/dotnet10-red.log create mode 100644 tools/fixtures/logs/dotnet10-truncated.log create mode 100644 tools/fixtures/logs/dotnet10-zero.log mode change 100644 => 100755 tools/testparse.sh diff --git a/tools/fixtures/logs/dotnet10-all-failed.log b/tools/fixtures/logs/dotnet10-all-failed.log new file mode 100644 index 0000000..6f67afa --- /dev/null +++ b/tools/fixtures/logs/dotnet10-all-failed.log @@ -0,0 +1,4 @@ +Test Run Failed. +Total tests: 3 + Failed: 3 + Total time: 0.5 Seconds diff --git a/tools/fixtures/logs/dotnet10-green.log b/tools/fixtures/logs/dotnet10-green.log new file mode 100644 index 0000000..5b091a4 --- /dev/null +++ b/tools/fixtures/logs/dotnet10-green.log @@ -0,0 +1,12 @@ +Test run for /tmp/dn/proj/T/bin/Debug/net10.0/T.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +Test Parallelization enabled for /tmp/dn/proj/T/bin/Debug/net10.0/T.dll (Workers: 16, Scope: MethodLevel) + Skipped Skipped + Passed Bad [5 ms] + Passed Ok [5 ms] + +Test Run Successful. +Total tests: 3 + Passed: 2 + Skipped: 1 + Total time: 0.5415 Seconds diff --git a/tools/fixtures/logs/dotnet10-red.log b/tools/fixtures/logs/dotnet10-red.log new file mode 100644 index 0000000..72af692 --- /dev/null +++ b/tools/fixtures/logs/dotnet10-red.log @@ -0,0 +1,22 @@ +Test run for /tmp/dn/proj/T/bin/Debug/net10.0/T.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +Test Parallelization enabled for /tmp/dn/proj/T/bin/Debug/net10.0/T.dll (Workers: 16, Scope: MethodLevel) + Skipped Skipped + Passed Ok [5 ms] + Failed Bad [12 ms] + Error Message: + Assert.AreEqual failed. Expected:<1>. Actual:<2>. 'expected' expression: '1', 'actual' expression: '2'. + Stack Trace: + at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.ThrowAssertAreEqualFailed(Object expected, Object actual, String userMessage) in /_/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs:line 665 + at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual[T](T expected, T actual, IEqualityComparer`1 comparer, String message, String expectedExpression, String actualExpression) in /_/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs:line 492 + at Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual[T](T expected, T actual, String message, String expectedExpression, String actualExpression) in /_/src/TestFramework/TestFramework/Assertions/Assert.AreEqual.cs:line 405 + at T.Test1.Bad() in /tmp/dn/proj/T/Test1.cs:line 6 + at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) + at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) + +Test Run Failed. +Total tests: 3 + Passed: 1 + Failed: 1 + Skipped: 1 + Total time: 0.5395 Seconds diff --git a/tools/fixtures/logs/dotnet10-truncated.log b/tools/fixtures/logs/dotnet10-truncated.log new file mode 100644 index 0000000..7835443 --- /dev/null +++ b/tools/fixtures/logs/dotnet10-truncated.log @@ -0,0 +1,3 @@ +Test Run Failed. +Total tests: 5 + Passed: 2 diff --git a/tools/fixtures/logs/dotnet10-zero.log b/tools/fixtures/logs/dotnet10-zero.log new file mode 100644 index 0000000..ed1ae5c --- /dev/null +++ b/tools/fixtures/logs/dotnet10-zero.log @@ -0,0 +1,3 @@ +Test run for /tmp/dn/proj/T/bin/Debug/net10.0/T.dll (.NETCoreApp,Version=v10.0) +A total of 1 test files matched the specified pattern. +No test matches the given testcase filter `Name=Nope` in /tmp/dn/proj/T/bin/Debug/net10.0/T.dll diff --git a/tools/test-tools.sh b/tools/test-tools.sh index bedbf38..df37c05 100644 --- a/tools/test-tools.sh +++ b/tools/test-tools.sh @@ -40,6 +40,25 @@ check mutation-table-nonce.log 1 "caught=2 survived=1 unviable=0 timeout=0 noapp NONCE= check dotnet-red.log 1 "FRAMEWORK dotnet passed=11 failed=1 skipped=2" check dotnet-red.log 1 "FAILED MyNs.AddTests.Subtracts" +# dotnet 10 at normal verbosity prints "Total tests:" blocks, not "Passed! - Failed:". dotnet10-green/red/zero.log are +# real runs (dotnet 10.0.403, MSTest, `dotnet test -v n`, 2026-11-06, build output before "Test run for" dropped); +# dotnet10-all-failed/truncated.log are hand-written blocks (dotnet omits a zero line; a cut-off block must not read clean). +check dotnet10-green.log 0 "FRAMEWORK dotnet passed=2 failed=0 skipped=1" "RED" +check dotnet10-red.log 1 "FRAMEWORK dotnet passed=1 failed=1 skipped=1" +check dotnet10-red.log 1 "FAILED Bad" +check dotnet10-red.log 0 "MISMATCH: exit 0 but the log shows" +check dotnet10-zero.log 0 "ZERO TESTS RAN" "no test counts recognised" +check dotnet10-all-failed.log 1 "FRAMEWORK dotnet passed=0 failed=3 skipped=0" +check dotnet10-truncated.log 1 "FRAMEWORK dotnet passed=2 failed=3 skipped=0" +# both dotnet forms in one log (two projects at different verbosity) sum +cat "$L/dotnet10-red.log" "$L/dotnet-red.log" >"$T/dotnet-both.log" +check "$T/dotnet-both.log" 1 "FRAMEWORK dotnet passed=12 failed=2 skipped=3" +# a count line after the block ended (here a stray "Passed:" under other output) is not part of the block +printf 'Total tests: 2\n Passed: 2\n Total time: 1 Seconds\n Passed: 40\n' >"$T/dotnet-stray.log" +check "$T/dotnet-stray.log" 0 "FRAMEWORK dotnet passed=2 failed=0 skipped=0" +# an unparsed log is never zero failures: a "Total tests:" line that is not a count recognises nothing +printf 'Total tests: many\n Passed: 2\n' >"$T/total-garbled.log" +check "$T/total-garbled.log" 0 "no test counts recognised" check vitest-red.log 1 "FRAMEWORK vitest passed=10 failed=1 skipped=1" check vitest-red.log 1 "FAILED src/add.test.ts > add > carries" check pytest-red.log 1 "FRAMEWORK pytest passed=5 failed=1 skipped=1" diff --git a/tools/testparse.sh b/tools/testparse.sh old mode 100644 new mode 100755 index 4bae433..c4150cb --- a/tools/testparse.sh +++ b/tools/testparse.sh @@ -29,6 +29,22 @@ tp_scan() { } return s } + function dflush() { # close a dotnet 10 "Total tests:" block + if (!dblk) return + # dotnet omits a zero line, so Failed may be absent; a count the block does not account for is a + # failure, never a pass (a truncated block must not read as clean) + rem = dtot - bp - bf - bs; if (rem < 0) rem = 0 + dp += bp; df += bf + rem; ds += bs; dotnet = 1; dblk = 0 + } + /^Total tests: *[0-9]+ *$/ { # dotnet 10, normal verbosity: a block, one count per indented line + dflush(); dtot = $3 + 0; bp = bf = bs = 0; dblk = 1; next + } + dblk && /^ +(Passed|Failed|Skipped): +[0-9]+ *$/ { + v = $2 + 0 + if ($1 == "Passed:") bp += v; else if ($1 == "Failed:") bf += v; else bs += v + next + } + dblk { dflush() } # any other line ends the block, and is then scanned as usual /^test result: / { # cargo, one line per test binary line = $0; sub(/^test result: [A-Za-z]+\. /, "", line) n = split(line, parts, "; ") @@ -42,7 +58,7 @@ tp_scan() { } /^test .* \.\.\. FAILED$/ { name = $0; sub(/^test /, "", name); sub(/ \.\.\. FAILED$/, "", name); print "FAILED " name; next } /^(Passed|Failed)! - Failed: *[0-9]+, Passed: *[0-9]+, Skipped: *[0-9]+, Total:/ { # dotnet - line = $0; sub(/^[A-Za-z]+! - /, "", line) + line = $0; sub(/^[A-Za-z]+! - /, "", line) # dotnet, one-line summary (quiet verbosity) n = split(line, parts, ", ") for (i = 1; i <= n; i++) { v = parts[i]; sub(/^[A-Za-z]+: */, "", v); v += 0 @@ -108,6 +124,7 @@ tp_scan() { } /^FAILED [^ ]+::/ { print "FAILED " pyname(substr($0, 8)); next } END { + dflush() if (cargo) printf "FRAMEWORK cargo passed=%d failed=%d skipped=%d\n", cp, cf, cs if (dotnet) printf "FRAMEWORK dotnet passed=%d failed=%d skipped=%d\n", dp, df, ds if (vitest) printf "FRAMEWORK vitest passed=%d failed=%d skipped=%d\n", vp, vf, vs From bf95993e3bd1c71ea0b21c21b5cfa73c214a9cd3 Mon Sep 17 00:00:00 2001 From: Eureka Date: Sat, 7 Nov 2026 11:35:06 +0000 Subject: [PATCH 02/30] tools: dotnet-self-env.sh for Selves with a read-only HOME, and the scar in SKILL.md Co-Authored-By: Claude Sonnet 5.5 --- SKILL.md | 8 ++++++++ tools/INDEX.md | 1 + tools/dotnet-self-env.sh | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100755 tools/dotnet-self-env.sh diff --git a/SKILL.md b/SKILL.md index eb50985..733f18d 100644 --- a/SKILL.md +++ b/SKILL.md @@ -782,6 +782,14 @@ Scripts that know a project's layout stay in that project. found another Self's live tree "clean and pushed", and `git worktree remove --force` emptied it mid-build. "Clean" says nothing about who is working in a tree. +- **A Self's HOME is read-only: source `tools/dotnet-self-env.sh` before every + dotnet command.** Setting only `DOTNET_CLI_HOME` and `NUGET_PACKAGES` still + fails with an `IOException` on the NuGet-Migrations mutex, because NuGet and + MSBuild keep other state under `HOME`. The file points `HOME`, both of those + and the node-reuse and build-server switches at one writable directory under + the working directory, per command; never change `HOME` in the unit. Hit by + Nibu, Aqua and Libby on 2026-11-07. **A long job needs `run_in_background`:** + `nohup` and `&` die with the call that started them. ## Adapting the pipeline diff --git a/tools/INDEX.md b/tools/INDEX.md index b7915dc..7225070 100644 --- a/tools/INDEX.md +++ b/tools/INDEX.md @@ -12,6 +12,7 @@ gets a Soul pass before merge. | `tools/wait-on.sh` | One general waiter for anything that is not a Yggdrasil job: `pid []`, `log ` (with `WAIT_PID=` a dead process with no match is exit 98; an invalid ERE is exit 3), `file `. The `pid` form prints `GONE (no completion evidence)`: prefer `log` whenever the job writes a done line. Same contract as `ygg-verify.sh wait`: blocks at most 270 s, exit 0 done with a tail of at most 60 log lines, `RUNNING s` exit 99, exit 98 gone with no completion evidence; call it with a Bash tool `timeout` of at least 280000 ms. Replaces hand-rolled poll loops and idle `true`/`echo`/`sleep` calls. | Hands, Soul, Imagination probes | `references/briefs.md` (Hands long jobs, Soul long jobs, detached scripts) | | `tools/mutation-table.sh` | One verify job that runs a list of hand mutants (file, before, after, test) against a revision and returns a kill table: CAUGHT with the killing test, SURVIVED, UNVIABLE, TIMEOUT, NOAPPLY, ERROR. Refuses a red or zero-test baseline and a red BUILD; rows print live. Isolation is Docker's: the baselines run once in a container that holds the revision, that container is committed to a throwaway image, and every mutant runs in a fresh `--rm` container from it, so nothing a run writes (tracked, untracked or ignored, such as `target/`) reaches the next mutant; the image is removed when the job ends, killed or not. The shared registry and sccache volumes and the network are not isolated. A file-level load failure (vitest `FAIL [ ]`, jest `FAIL ` plus `Test suite failed to run`) reads UNVIABLE. Replaces per-agent runmut/mutrun/strykrun scripts. | Soul, Hands (scoped run) | `references/briefs.md` (Hands verification, Soul reruns) | | `tools/cargo-mutants.sh` | `SUMMARY= tools/cargo-mutants.sh [workdir]`: cargo-mutants on a revision range as ONE verify job, the one owner of running it. Plan container lists the range's mutants (diff taken at the workspace root); stage 1 runs each file's mutants against that file's tests only (filter derived from the path, `FILTERS` overrides), deciding only CAUGHT and UNVIABLE; stage 2 confirms every survivor, timeout, unfiltered file and zero-test file on the full suite, sharded; merge counts each name once and prints `MUTANTS` totals, `FILTER` lines and the final `MISSED`/`TIMEOUT` names. Containers = min(`SHARDS`, slots, units, 1 + free slots), leased with `flock -n` from Yggdrasil's slot pool (none while IO pressure full avg60 > 20). `NAMES=` reruns chosen survivors (no stage 1), `TEST_ARGS` skips flaky tests, `JOBS`, `MIN_TEST_TIMEOUT`, `CONFIRM_TIMEOUT_MULT`, `TIMEOUT`. Exit 0 on a green baseline whatever survives; a red baseline or a failed container is non-zero with no totals. Run once per pass. | Hands, Soul | `references/briefs.md` (Hands verification, Soul reruns), `SKILL.md` (mutation bullet) | +| `tools/dotnet-self-env.sh` | Sourced env file for dotnet in a Self whose HOME is read-only: `. tools/dotnet-self-env.sh` sets `HOME`, `DOTNET_CLI_HOME` and `NUGET_PACKAGES` to `$PWD/.dotnet-home` (created; `DOTNET_SELF_HOME` overrides) and turns off telemetry, first-run, MSBuild node reuse, shared compilation and the build server. Source it per command; the unit's HOME is not changed. | Selves and their workers running dotnet | `SKILL.md` (Git and tooling rules) | | `tools/testparse.sh` | Sourced library: failing test names and pass/fail/skip counts from cargo, dotnet, vitest, jest and pytest logs, and test files that failed to load (`LOADFAIL`). Shared by the summary and the kill table. | `tools/stopgap/ygg-verify.sh`, `tools/mutation-table.sh` | not named by a brief; it lives and dies with them | | `tools/test-tools.sh` | Local fixture check of the parsers and the summary over `tools/fixtures/logs` (real cargo and mutation logs, plus hand-written dotnet, vitest, jest, pytest, exit-0-but-failed and no-verdict logs), and of the mutation runners' host drivers and container halves (`tools/mutation-table.sh`, `tools/cargo-mutants.sh`) under a mock docker, a fake `cargo mutants` and real slot locks. Run it before merging a change to the scripts above. | whoever changes those scripts | `SKILL.md` (Shared tools) | | `tools/context-pack.py` | `py -3 tools/context-pack.py [--since ] [--only \|r[,...]] [--spec-json ] [--max-lines ]`. Carries a cut_spec's `file_changes` and `reads` anchors (read rows `r`; a read absent at base is MISSING) from the spec's base to the worktree by `git diff` hunks (the working tree included) and prints one header, a status table (SAME, MOVED, TOUCHED, RENAMED, NEW, GONE, OUT_OF_RANGE, UNRESOLVED, MISSING, plus SYMBOL_MISSING when an anchor's `symbol` is absent from its window) and windows of at most 100 lines numbered in worktree lines, then one capped caller list per symbol (`git grep`, hits outside the windows), within `--max-lines` (800). Exit 3 when an anchor cannot be carried, 4 when the spec is unreadable (fetched by id through the eureka-state binding (`tools/mind.py`), retried once on Unavailable; `--spec-json` takes a saved view). `--since ` re-prints only the windows edited since that commit. Standard library plus git; writes nothing. | Hands, Soul, Imagination | `references/briefs.md` (Imagination map, Hands, Soul), `SKILL.md` (step 1) | diff --git a/tools/dotnet-self-env.sh b/tools/dotnet-self-env.sh new file mode 100755 index 0000000..4a37a8d --- /dev/null +++ b/tools/dotnet-self-env.sh @@ -0,0 +1,17 @@ +# Source this before dotnet in a Self whose HOME is read-only: +# . tools/dotnet-self-env.sh +# Points HOME, the dotnet CLI home and the NuGet cache at one writable directory +# under the current directory and turns off the node reuse, shared compilation +# and build server that outlive the command. Sourced per command; never set +# HOME in the unit. +DOTNET_SELF_HOME="${DOTNET_SELF_HOME:-$PWD/.dotnet-home}" +mkdir -p "$DOTNET_SELF_HOME" +export HOME="$DOTNET_SELF_HOME" +export DOTNET_CLI_HOME="$DOTNET_SELF_HOME" +export NUGET_PACKAGES="$DOTNET_SELF_HOME/.nuget/packages" +export DOTNET_NOLOGO=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export MSBUILDDISABLENODEREUSE=1 +export UseSharedCompilation=false +export DOTNET_CLI_USE_MSBUILD_SERVER=0 From ad6e3108b9fb0d8faa71133580b4cca2e8ab7dfb Mon Sep 17 00:00:00 2001 From: Eureka Date: Sat, 7 Nov 2026 11:37:06 +0000 Subject: [PATCH 03/30] tools: dotnet-self wrapper, env outside the worktree, subshell warning Co-Authored-By: Claude Sonnet 5.5 --- SKILL.md | 20 ++++++++++++-------- tools/INDEX.md | 2 +- tools/dotnet-self | 8 ++++++++ tools/dotnet-self-env.sh | 19 +++++++++++-------- 4 files changed, 32 insertions(+), 17 deletions(-) create mode 100755 tools/dotnet-self diff --git a/SKILL.md b/SKILL.md index 733f18d..e90ed31 100644 --- a/SKILL.md +++ b/SKILL.md @@ -782,14 +782,18 @@ Scripts that know a project's layout stay in that project. found another Self's live tree "clean and pushed", and `git worktree remove --force` emptied it mid-build. "Clean" says nothing about who is working in a tree. -- **A Self's HOME is read-only: source `tools/dotnet-self-env.sh` before every - dotnet command.** Setting only `DOTNET_CLI_HOME` and `NUGET_PACKAGES` still - fails with an `IOException` on the NuGet-Migrations mutex, because NuGet and - MSBuild keep other state under `HOME`. The file points `HOME`, both of those - and the node-reuse and build-server switches at one writable directory under - the working directory, per command; never change `HOME` in the unit. Hit by - Nibu, Aqua and Libby on 2026-11-07. **A long job needs `run_in_background`:** - `nohup` and `&` die with the call that started them. +- **A Self's HOME is read-only: run dotnet through `tools/dotnet-self`.** + Setting only `DOTNET_CLI_HOME` and `NUGET_PACKAGES` still fails with an + `IOException` on the NuGet-Migrations mutex, because NuGet and MSBuild keep + other state under `HOME`. `tools/dotnet-self build ...` runs one dotnet command + with `HOME`, both of those and the node-reuse and build-server switches + pointed at a per-user 0700 directory outside the worktree (`DOTNET_SELF_HOME` + overrides; inside a repo it needs a `.git/info/exclude` entry). If you source + `tools/dotnet-self-env.sh` instead, do it in a subshell or per command: + an exported `HOME` moves git and gh config and credentials for the rest of + the shell. Never change `HOME` in the unit. Hit by Nibu, Aqua and Libby on + 2026-11-07. **A long job needs `run_in_background`:** `nohup` and `&` die with + the call that started them. ## Adapting the pipeline diff --git a/tools/INDEX.md b/tools/INDEX.md index 7225070..5b578ac 100644 --- a/tools/INDEX.md +++ b/tools/INDEX.md @@ -12,7 +12,7 @@ gets a Soul pass before merge. | `tools/wait-on.sh` | One general waiter for anything that is not a Yggdrasil job: `pid []`, `log ` (with `WAIT_PID=` a dead process with no match is exit 98; an invalid ERE is exit 3), `file `. The `pid` form prints `GONE (no completion evidence)`: prefer `log` whenever the job writes a done line. Same contract as `ygg-verify.sh wait`: blocks at most 270 s, exit 0 done with a tail of at most 60 log lines, `RUNNING s` exit 99, exit 98 gone with no completion evidence; call it with a Bash tool `timeout` of at least 280000 ms. Replaces hand-rolled poll loops and idle `true`/`echo`/`sleep` calls. | Hands, Soul, Imagination probes | `references/briefs.md` (Hands long jobs, Soul long jobs, detached scripts) | | `tools/mutation-table.sh` | One verify job that runs a list of hand mutants (file, before, after, test) against a revision and returns a kill table: CAUGHT with the killing test, SURVIVED, UNVIABLE, TIMEOUT, NOAPPLY, ERROR. Refuses a red or zero-test baseline and a red BUILD; rows print live. Isolation is Docker's: the baselines run once in a container that holds the revision, that container is committed to a throwaway image, and every mutant runs in a fresh `--rm` container from it, so nothing a run writes (tracked, untracked or ignored, such as `target/`) reaches the next mutant; the image is removed when the job ends, killed or not. The shared registry and sccache volumes and the network are not isolated. A file-level load failure (vitest `FAIL [ ]`, jest `FAIL ` plus `Test suite failed to run`) reads UNVIABLE. Replaces per-agent runmut/mutrun/strykrun scripts. | Soul, Hands (scoped run) | `references/briefs.md` (Hands verification, Soul reruns) | | `tools/cargo-mutants.sh` | `SUMMARY= tools/cargo-mutants.sh [workdir]`: cargo-mutants on a revision range as ONE verify job, the one owner of running it. Plan container lists the range's mutants (diff taken at the workspace root); stage 1 runs each file's mutants against that file's tests only (filter derived from the path, `FILTERS` overrides), deciding only CAUGHT and UNVIABLE; stage 2 confirms every survivor, timeout, unfiltered file and zero-test file on the full suite, sharded; merge counts each name once and prints `MUTANTS` totals, `FILTER` lines and the final `MISSED`/`TIMEOUT` names. Containers = min(`SHARDS`, slots, units, 1 + free slots), leased with `flock -n` from Yggdrasil's slot pool (none while IO pressure full avg60 > 20). `NAMES=` reruns chosen survivors (no stage 1), `TEST_ARGS` skips flaky tests, `JOBS`, `MIN_TEST_TIMEOUT`, `CONFIRM_TIMEOUT_MULT`, `TIMEOUT`. Exit 0 on a green baseline whatever survives; a red baseline or a failed container is non-zero with no totals. Run once per pass. | Hands, Soul | `references/briefs.md` (Hands verification, Soul reruns), `SKILL.md` (mutation bullet) | -| `tools/dotnet-self-env.sh` | Sourced env file for dotnet in a Self whose HOME is read-only: `. tools/dotnet-self-env.sh` sets `HOME`, `DOTNET_CLI_HOME` and `NUGET_PACKAGES` to `$PWD/.dotnet-home` (created; `DOTNET_SELF_HOME` overrides) and turns off telemetry, first-run, MSBuild node reuse, shared compilation and the build server. Source it per command; the unit's HOME is not changed. | Selves and their workers running dotnet | `SKILL.md` (Git and tooling rules) | +| `tools/dotnet-self` | `tools/dotnet-self `: runs one dotnet command for a Self whose HOME is read-only, with `HOME`, `DOTNET_CLI_HOME` and `NUGET_PACKAGES` set for that process only (default `${XDG_CACHE_HOME:-${TMPDIR:-/tmp}}/dotnet-self-home-`, 0700, `DOTNET_SELF_HOME` overrides) and telemetry, first-run, MSBuild node reuse, shared compilation and the build server off. Env defined in `tools/dotnet-self-env.sh`, which is sourced only inside a subshell: sourcing it in your shell exports `HOME` and moves git and gh credentials. | Selves and their workers running dotnet | `SKILL.md` (Git and tooling rules) | | `tools/testparse.sh` | Sourced library: failing test names and pass/fail/skip counts from cargo, dotnet, vitest, jest and pytest logs, and test files that failed to load (`LOADFAIL`). Shared by the summary and the kill table. | `tools/stopgap/ygg-verify.sh`, `tools/mutation-table.sh` | not named by a brief; it lives and dies with them | | `tools/test-tools.sh` | Local fixture check of the parsers and the summary over `tools/fixtures/logs` (real cargo and mutation logs, plus hand-written dotnet, vitest, jest, pytest, exit-0-but-failed and no-verdict logs), and of the mutation runners' host drivers and container halves (`tools/mutation-table.sh`, `tools/cargo-mutants.sh`) under a mock docker, a fake `cargo mutants` and real slot locks. Run it before merging a change to the scripts above. | whoever changes those scripts | `SKILL.md` (Shared tools) | | `tools/context-pack.py` | `py -3 tools/context-pack.py [--since ] [--only \|r[,...]] [--spec-json ] [--max-lines ]`. Carries a cut_spec's `file_changes` and `reads` anchors (read rows `r`; a read absent at base is MISSING) from the spec's base to the worktree by `git diff` hunks (the working tree included) and prints one header, a status table (SAME, MOVED, TOUCHED, RENAMED, NEW, GONE, OUT_OF_RANGE, UNRESOLVED, MISSING, plus SYMBOL_MISSING when an anchor's `symbol` is absent from its window) and windows of at most 100 lines numbered in worktree lines, then one capped caller list per symbol (`git grep`, hits outside the windows), within `--max-lines` (800). Exit 3 when an anchor cannot be carried, 4 when the spec is unreadable (fetched by id through the eureka-state binding (`tools/mind.py`), retried once on Unavailable; `--spec-json` takes a saved view). `--since ` re-prints only the windows edited since that commit. Standard library plus git; writes nothing. | Hands, Soul, Imagination | `references/briefs.md` (Imagination map, Hands, Soul), `SKILL.md` (step 1) | diff --git a/tools/dotnet-self b/tools/dotnet-self new file mode 100755 index 0000000..6b9fa84 --- /dev/null +++ b/tools/dotnet-self @@ -0,0 +1,8 @@ +#!/bin/sh +# Run ONE dotnet command with the Self env (tools/dotnet-self-env.sh) applied to +# that process only; the caller's shell keeps its HOME, git and gh config. +# tools/dotnet-self build -c Release +set -e +here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +. "$here/dotnet-self-env.sh" +exec dotnet "$@" diff --git a/tools/dotnet-self-env.sh b/tools/dotnet-self-env.sh index 4a37a8d..610dd38 100755 --- a/tools/dotnet-self-env.sh +++ b/tools/dotnet-self-env.sh @@ -1,11 +1,14 @@ -# Source this before dotnet in a Self whose HOME is read-only: -# . tools/dotnet-self-env.sh -# Points HOME, the dotnet CLI home and the NuGet cache at one writable directory -# under the current directory and turns off the node reuse, shared compilation -# and build server that outlive the command. Sourced per command; never set -# HOME in the unit. -DOTNET_SELF_HOME="${DOTNET_SELF_HOME:-$PWD/.dotnet-home}" -mkdir -p "$DOTNET_SELF_HOME" +# Env for dotnet in a Self whose HOME is read-only. Prefer tools/dotnet-self, +# which applies this to one dotnet command only. +# +# WARNING: sourcing this in your own shell exports HOME, which moves git and gh +# config and credentials for every later command in that shell. Source it in a +# subshell or per command: ( . tools/dotnet-self-env.sh; dotnet build ) +# +# DOTNET_SELF_HOME defaults to a per-user 0700 directory outside any worktree; +# set it to override. A directory inside a repo needs a .git/info/exclude entry. +DOTNET_SELF_HOME="${DOTNET_SELF_HOME:-${XDG_CACHE_HOME:-${TMPDIR:-/tmp}}/dotnet-self-home-$(id -u)}" +mkdir -p "$DOTNET_SELF_HOME" && chmod 700 "$DOTNET_SELF_HOME" export HOME="$DOTNET_SELF_HOME" export DOTNET_CLI_HOME="$DOTNET_SELF_HOME" export NUGET_PACKAGES="$DOTNET_SELF_HOME/.nuget/packages" From 0cc4f78f772411b52f514f5e4a60205e20d78de9 Mon Sep 17 00:00:00 2001 From: Eureka Date: Sat, 7 Nov 2026 13:32:48 +0100 Subject: [PATCH 04/30] tools: delete mind.py, recall.py and the fake binding; context-pack reads huginn view --raw from a file or stdin Co-Authored-By: Claude Sonnet 5.5 --- tools/INDEX.md | 4 +- tools/context-pack.py | 56 +- .../context-pack/fake-eureka-state.py | 99 -- tools/fixtures/context-pack/spec-reads.json | 8 +- tools/fixtures/context-pack/spec.json | 8 +- tools/mind.py | 145 --- tools/recall.py | 397 ------- tools/test-tools.sh | 1029 ++--------------- 8 files changed, 117 insertions(+), 1629 deletions(-) delete mode 100644 tools/fixtures/context-pack/fake-eureka-state.py delete mode 100644 tools/mind.py delete mode 100644 tools/recall.py diff --git a/tools/INDEX.md b/tools/INDEX.md index 5b578ac..4aaa236 100644 --- a/tools/INDEX.md +++ b/tools/INDEX.md @@ -15,7 +15,5 @@ gets a Soul pass before merge. | `tools/dotnet-self` | `tools/dotnet-self `: runs one dotnet command for a Self whose HOME is read-only, with `HOME`, `DOTNET_CLI_HOME` and `NUGET_PACKAGES` set for that process only (default `${XDG_CACHE_HOME:-${TMPDIR:-/tmp}}/dotnet-self-home-`, 0700, `DOTNET_SELF_HOME` overrides) and telemetry, first-run, MSBuild node reuse, shared compilation and the build server off. Env defined in `tools/dotnet-self-env.sh`, which is sourced only inside a subshell: sourcing it in your shell exports `HOME` and moves git and gh credentials. | Selves and their workers running dotnet | `SKILL.md` (Git and tooling rules) | | `tools/testparse.sh` | Sourced library: failing test names and pass/fail/skip counts from cargo, dotnet, vitest, jest and pytest logs, and test files that failed to load (`LOADFAIL`). Shared by the summary and the kill table. | `tools/stopgap/ygg-verify.sh`, `tools/mutation-table.sh` | not named by a brief; it lives and dies with them | | `tools/test-tools.sh` | Local fixture check of the parsers and the summary over `tools/fixtures/logs` (real cargo and mutation logs, plus hand-written dotnet, vitest, jest, pytest, exit-0-but-failed and no-verdict logs), and of the mutation runners' host drivers and container halves (`tools/mutation-table.sh`, `tools/cargo-mutants.sh`) under a mock docker, a fake `cargo mutants` and real slot locks. Run it before merging a change to the scripts above. | whoever changes those scripts | `SKILL.md` (Shared tools) | -| `tools/context-pack.py` | `py -3 tools/context-pack.py [--since ] [--only \|r[,...]] [--spec-json ] [--max-lines ]`. Carries a cut_spec's `file_changes` and `reads` anchors (read rows `r`; a read absent at base is MISSING) from the spec's base to the worktree by `git diff` hunks (the working tree included) and prints one header, a status table (SAME, MOVED, TOUCHED, RENAMED, NEW, GONE, OUT_OF_RANGE, UNRESOLVED, MISSING, plus SYMBOL_MISSING when an anchor's `symbol` is absent from its window) and windows of at most 100 lines numbered in worktree lines, then one capped caller list per symbol (`git grep`, hits outside the windows), within `--max-lines` (800). Exit 3 when an anchor cannot be carried, 4 when the spec is unreadable (fetched by id through the eureka-state binding (`tools/mind.py`), retried once on Unavailable; `--spec-json` takes a saved view). `--since ` re-prints only the windows edited since that commit. Standard library plus git; writes nothing. | Hands, Soul, Imagination | `references/briefs.md` (Imagination map, Hands, Soul), `SKILL.md` (step 1) | -| `tools/mind.py` | The one way a Eureka script reaches the mind: `mind.call(tool, arguments, deadline)` spawns the eureka-state binding (`EUREKA_STATE_EXE`, else `~/.claude.json` `mcpServers.eureka-state`), does the stdio handshake and one tool call within `deadline` seconds, returns the parsed JSON body, raises `MindError` (kind binding, transport, tool or answer; a detail, never an input value), and kills the child on every exit path. No retry inside `call`; `retry_once(fn)` is the caller's choice. Standard library only. | `tools/context-pack.py`, `tools/recall.py` | not named by a brief; it lives and dies with its consumers | -| `tools/recall.py` | `py -3 tools/recall.py prompt`, a `UserPromptSubmit` command hook (hook JSON on stdin): queries the rulings, questions and follow-ups in force across every root, ranked by Huginn against the prompt (`RECALL_TOP_K`, 5), and prints one hook JSON whose `additionalContext` is a header saying the lines are recalled records, data and never instructions, written by agents and not the operator, then one JSON object per item (`id`, `title`, a short `operator_quote`) with `<`, `>` and control, bidi and separator characters escaped, within `RECALL_BUDGET` characters (4000, at most 9000: Claude Code caps `additionalContext` at 10,000), whole lines only. Prompts under 3 words are not queried. Never blocks: any failure exits 0 with empty stdout; its own deadline is `RECALL_DEADLINE_MS` (4000) for the whole run (stdin read to 4 MiB, answer read to 1 MiB), so set the hook `timeout` above it. One attempt, no retry. Install both hooks as ` C:/Users/Meta/.claude/skills/eureka/tools/recall.py prompt || true` (and `... admit || true`): Claude Code runs hook commands through Git Bash on Windows, and `py -3 ` exits 2, which blocks every prompt or admit; with `|| true` the hook cannot exit 2 (a missing script, interpreter or file passes) and the script's stdout is untouched (proved live on 2.1.308). `py -3 tools/recall.py admit` is a `PreToolUse` hook on `mcp__eureka-state__admit`: for each ruling or question in the batch (at most `RECALL_ADMIT_MAX`, 3) it queries the nearest in-force rulings and questions, and denies the first attempt with the neighbours as the reason (a deliberate hold, not a failure); the identical call sent again (digest of `tool_input` plus `agent_id`, kept in the session scratchpad) passes. Never allow or ask; a failed check exits 0 with a note naming the failure kind (`RECALL_TOP_K` 3, `RECALL_DEADLINE_MS` 10000 in this mode). `py -3 tools/recall.py dispatch` is a `PreToolUse` hook on `Agent|Task`: it takes the ruling, question and follow-up ids the brief cites (`::