Repository navigation
test(server): measure the hidden filter's allocations in a clean child process - #1099
Merged
Merged
Conversation
… goroutines' allocations (#1088) TestHiddenFilterPacketsNoExtraAllocs failed in the -race catch-all shard ("50 hidden: 28 allocs, no config: 24") while it passes on its own: by the time it runs, earlier tests have left 95 schema healers behind (healSchemaFlags, a 2 s re-probe on DBs never closed), and AllocsPerRun counts their allocations too, 5-11 per filter call under -race. The test now runs a background allocator that stands in for them, and bounds the no-config path absolutely (under one allocation per 500 packets; 23 at 30K). Red: the in-process figure carries the noise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#1088) AllocsPerRun reads the process-wide malloc count. In the -race catch-all shard, goroutines left behind by earlier tests (95 schema healers re-probing unclosed DBs every 2 s) allocated 5-11 times per filter call while it was measured, so "50 hidden" could exceed "no config" by more than the slack of 3 with no change in the filter (isolated: 23 / 23 / 24 under -race on master and on 6e49b0d). The test now re-runs itself alone in a child process, as TestNodeTxSetsRetainedHeap_534 does for its heap figure, and asserts on the figures the child prints. The product code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
Review — CS-Minimax PR#1099 — head 7d4937bDom: APPROVE med nits Evidence tags: [T] run here (darwin/arm64, Go 1.26.0, on the merged tree with Findings
No blocking findings. Answers to the review points
Invariants
Tests (merged tree)
CI per job (at review time)Pass: Go Build & Test, Go Ingestor Tests, Go Libraries & CLI, Go Server Tests 1/3, 2/3 and 3/3, JavaScript Unit Tests & Lint, Script & Container Unit Checks, Verify Go Test Assignments, Validate Docker Image. Pending: Playwright E2E 1/3, 2/3 and 3/3. Skipping: Release Artifacts. [A] Shard 3/3 passing once is weak evidence for a flake fix; the Not verified
|
adminopenclaw8-sketch
pushed a commit
that referenced
this pull request
Dec 2, 2026
Brings in #1099 (the TestHiddenFilterPacketsNoExtraAllocs flake fix) and the rest of master since the branch point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #1088 (where the failure was first seen on CI; the test is
TestHiddenFilterPacketsNoExtraAllocs)Status: ready for review — the failure is measurement noise from goroutines earlier tests leave running, not a regression in the hidden filter; the test now measures in a clean child process and is green 50/50 under
-raceand inside the full catch-all shard where master fails. Product code unchanged.Evidence tags: [T] run here (linux/amd64, Go 1.27.1, 4 vCPU), [A] read from code, git or logs, [K] reported elsewhere and not reproduced here.
Plan
-race -count=20onorigin/masterand on6e49b0d1; then in the real CI context (the catch-all shard 3/3 under-race).Investigation
origin/masterebfa4ff5,-race -count=206e49b0d1,-race -count=20-race(both commits)git diff --stat 6e49b0d1..origin/master -- cmd/serverdagi_api.go,dagi_area_stats.go,dagi_area_comparison_test.go,openapi.go,routes.go; nothing on the filter / hidden-identity path [A]6e49b0d1as well (below), so the range has no good/bad boundary to bisect. It also touches no code the test measures [T][A]origin/master,-race(same-skipselection CI uses)50 hidden: 33 allocs, no config: 29— same shape as CI's28 vs 24[T][31 30 34], prefix-none-hidden[34 29 29], prefix-50-hidden[29 28 29]; isolated values are 23 / 23 / 24, so each call carries +5…+11 foreign allocations that vary run to run [T]database/sql.(*DB).connectionOpener(unclosed DBs, idle) and 95(*DB).healSchemaFlags(db.go:291), each a 2 s ticker that runsdetectSchema(SQL queries, allocates) on a DB an earlier test never closed [T]6e49b0d1's CI shard 3 was green6e49b0d1fails too:50 hidden: 32 allocs, no config: 26, with the same 774 goroutines (677 + 95 healers) and per-trial figures off[27 27 27], prefix-none-hidden[31 28 35], prefix-50-hidden[28 28 29][T]. The flake predates this range; nothing in6e49b0d1..origin/masteradded it.Decision: an unstable measurement, not a regression.
testing.AllocsPerRunreads the process-wideruntime.MemStats.Mallocs. Leaked healers in the same test binary allocate while it counts. Under-raceone filter call over 30K packets takes ~70 ms, so several healer ticks land inside each measured call; without-race(or on a fast arm64 Mac) a call takes ~1 ms and the noise stays under the slack of 3. That is why it fails on linux-racein the catch-all shard and passes on macOS and in isolation. The filter itself allocates the same with and without hiding (+1, the predicate) on both commits.Fix
The repo already handles exactly this for heap figures:
TestNodeTxSetsRetainedHeap_534(cmd/server/bynode_txid_534_test.go) re-runs itself in a child process because "goroutines earlier tests leave running … allocate while it is read and make an in-process figure meaningless". This PR does the same:TestHiddenFilterPacketsNoExtraAllocsre-executes the test binary with-test.run=^TestHiddenFilterPacketsNoExtraAllocs$ -test.count=1andCORESCOPE_1088_ALLOCS_CHILD=1. The child measures (hidFilterAllocs, the unchanged measurement: least of 3 ×AllocsPerRun(5)per mode) and prints oneHID1088 …line; the parent parses it and asserts. The child has no other tests' goroutines.nNone == nOff,nHid < nOff). One assertion is added: with no hiding configured, fewer than one allocation per 500 packets (20 at 30K, 23 under-race). The relative checks alone pass if every mode allocated once per packet (mutant M4 below).hidAllocNoiseruns in the parent for the test's lifetime, a background allocator (1000 small allocations per ms) that stands in for the leaked healers. It keeps the test honest: an in-process measurement fails with it every time.Why not the alternatives:
-race(raceBuild, already incmd/server): every Go server shard in CI runs under-race, so the per-packet claim would no longer be enforced in CI without a new non-race workflow step.Perf: test only, no product code touched. The child rebuilds the same 30K store the test built before, and the parent does no store work, so the test takes about the same time (53 s in the
-raceshard, ~4 s without-race).Requirement —
TestHiddenFilterPacketsNoExtraAllocsstable on linux-race448655c2, red test)7d4937bb)-race,-count=5no config: 420 allocs for 30000 packets,50 hidden: 449 allocs, no config: 420[T]HID1088 off=20/30000 none=20/30000 hid=21/29700[T]-race -count=2no config: 7823 allocs/3823 allocs[T]-race -count=50, 2461 s), all 50off=23 none=23 hid=24[T]-race33 vs 29;6e49b0d1: fail32 vs 26[T]HID1088 off=23/30000 none=23/30000 hid=24/29700[T]hidFilterAllocsin the parent, no child)no config: 220 / 420 allocs for 30000 packets[T]strings.ToUpper(tx.Hash)whenhidden != nil)store.gofilterPacketsPrepared50 hidden: 22491 allocs, no config: 20[T]HID1088lineno measurement in the child's output(no silent pass) [T]store.gofilterPacketsPreparedno config: 22490 allocs for 30000 packets[T]hiddenFrom = math.MinInt)store.go20/20/21) [T]Invariants
cmd/serverread-onlymap[string]interface{}git diff origin/master..HEAD) [T]scripts/check-xss-sinks.sh --diff origin/masterno public/**/*.{js,html} changes to scan, exit 0 [T].github/untouched (0 diff lines);== 'Kpa-clawbot/CoreScope'count 9 indeploy.yml, 1 inrelease-fast-path.yml[T]node scripts/run-go-server-shard.js --validate4104 runnable entries, each in exactly one shard (15 / 15 / 4074)[T]Test runs
cd cmd/server && go test ./...(no-race)origin/masteron the test machine [T]:TestAdvertIntervalAnalytics_AggregatePerf(32 ms vs 25 ms budget; master 41 ms),TestAdvertIntervalBucket_Perf(26 / 29 ms vs 25 ms),TestDagiAreaStatsWithinBudget(378 / 328 ms vs 150 ms),TestProfileCard_Cost,TestCoverage941_PerfBudgetandTestCoverage941M2_PerfBudget(both504 terrain data timed out). Everything else passes.-race, up to and including the hidden-filter test (2708 tests)TestAreaCard_NoStoreLock(the area share waited for the store lock) andTestEstimatedPositionsInvalidStartup(must reject startup promptly: signal: killed) — slow-machine timing under-race[T]. The rest of the shard was not run locally (with-coverprofileit is ~4 h here).sh test-all.shorigin/master[T]:test-live-heard-filter.js,test-live-scope-color.js,test-issue-724-masts-hint.js,test-issue-728-ortho-base.js,test-issue-941-predicted-reach.js,test-issue-730-buildings-ui.js,test-1055-live-dagi.js,test-1055-m3-area-rule.js,test-issue-598-hop-path-inference.jsnode test-frontend-helpers.jsCI per job
Expected CI: Go Server Tests 3/3 carries the change (green locally in the same shard selection); shards 1/3, 2/3 and every other job are unaffected (test-only change in one
cmd/servertest file).Remaining
healSchemaFlagsgoroutines and 677 open*sql.DBleak from earlier tests in the catch-all shard (DBs opened throughOpenDBand never closed). This fix makes this test immune; otherAllocsPerRuntests incmd/serverthat run in-process could be hit by the same noise. Tracking which tests leak and addingt.Cleanup(db.Close)is a separate follow-up.🤖 Generated with Claude Code