From a83f0cb381f2b4c61be7d40ad728694e8799e744 Mon Sep 17 00:00:00 2001 From: Mathias Date: Mon, 5 Oct 2026 07:19:27 +0200 Subject: [PATCH] test(search): name the in-brain swap-race tests after what they sample Review of #172 (rule 9): "LeaksNothing" claims more than a 1.5s sampled race can prove -- the same overclaim this PR removes from the "Never" names. Renamed to DoesNotReturn...DuringASampledSwapRace, and the brainfstest doc now says the target may be inside the brain (#171) and that observation is over a sampled window. Co-Authored-By: Claude Opus 5.5 --- .../internal/brainfs/brainfstest/brainfstest.go | 12 +++++++----- ingestion/internal/search/brainroot_test.go | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ingestion/internal/brainfs/brainfstest/brainfstest.go b/ingestion/internal/brainfs/brainfstest/brainfstest.go index fd9ef0d..582925f 100644 --- a/ingestion/internal/brainfs/brainfstest/brainfstest.go +++ b/ingestion/internal/brainfs/brainfstest/brainfstest.go @@ -1,8 +1,10 @@ // Package brainfstest is the shared harness for hyperguild#157's swap-race -// tests: it keeps swapping a regular note, a symlink to an outside file, or a -// FIFO (with a writer held open) into a path while a reader under test loops. -// It observes two things: no sentinel byte from the outside file reaches the -// reader's output, and the reader returns within a timeout. It does not cover +// tests: it keeps swapping a regular note, a symlink to a sentinel target file +// (outside the brain, or inside it for hyperguild#171), or a FIFO (with a +// writer held open) into a path while a reader under test loops. +// It observes two things, over a sampled window only: no sentinel byte from +// the target reaches the reader's output, and the reader returns within a +// timeout. It does not cover // hard links, other paths into the reader, or races it does not generate. package brainfstest @@ -18,7 +20,7 @@ import ( "time" ) -// Sentinel marks the outside file's contents. +// Sentinel marks the target file's contents. const Sentinel = "zqbrainfssentinelonefiftyseven" // outsideContent carries Sentinel in every field a reader might extract: the diff --git a/ingestion/internal/search/brainroot_test.go b/ingestion/internal/search/brainroot_test.go index ea5f5d2..9ea2cb9 100644 --- a/ingestion/internal/search/brainroot_test.go +++ b/ingestion/internal/search/brainroot_test.go @@ -184,7 +184,7 @@ func inBrainTarget(t *testing.T, brain string) string { return brainfstest.WriteSentinelAt(t, filepath.Join(brain, "raw", "s.md")) } -func TestQueryLeaksNothingFromAnInBrainTargetUnderASymlinkSwapRace(t *testing.T) { +func TestQueryDoesNotReturnAnInBrainSymlinkTargetDuringASampledSwapRace(t *testing.T) { brain, facts, _ := searchBrain(t) target := inBrainTarget(t, brain) read := func() string { @@ -200,7 +200,7 @@ func TestQueryLeaksNothingFromAnInBrainTargetUnderASymlinkSwapRace(t *testing.T) assert.NotContains(t, read(), brainfstest.Sentinel, "static in-brain link") } -func TestHydrateRefusesAnInBrainSymlinkAndLeaksNothingUnderASwapRace(t *testing.T) { +func TestHydrateRefusesAnInBrainSymlinkAndDoesNotReturnItsTargetDuringASampledSwapRace(t *testing.T) { brain, facts, _ := searchBrain(t) target := inBrainTarget(t, brain) require.NoError(t, os.Symlink(filepath.Join("..", "..", "..", "raw", "s.md"), filepath.Join(facts, "inlink.md")))