mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-30 01:32:00 +01:00
**Fix monitoring test logger data race and rebalance CI backend shards**
1. Eliminate the recurring main Build and Test Backend tests (rest-1)
DATA RACE observed in runs 46191313678 (job 141127584174) and
46197384546 (job 141144000959), where
TestPollPBSConfigLoggingDoesNotBlockConfigEditOrPeerPoll overwrote
the unsynchronized global zerolog/log.Logger struct while background
alerts.NewManager().periodicSaveAlerts() goroutines leaked by earlier
tests called log.Debug():
- Install a single atomic io.Writer router (monitoringTestLogSink) on
log.Logger once in internal/monitoring/main_test.go TestMain and
route all 10 internal/monitoring/*_test.go log-capture and
log-suppression sites through setPackageTestLogOutput /
disablePackageTestLogs (atomic sink swap + atomic zerolog global
level) and syncTestLogBuffer, plus a -race regression test.
- Add t.Cleanup(m.alertManager.Stop) to all six
TestMaybePollPhysicalDisksAsync_* tests in
monitor_pve_disk_alert_settle_test.go and
monitor_pve_disk_fallback_test.go.
2. Rebalance .github/scripts/go-package-test-seconds.txt from ten
complete post-#5428 hosted Build and Test runs (seven 3-way PR runs
and three 2-way main push runs, runner-speed normalized) to address
PR checks (Pulse) — the #1 slowest stage in output-constraints.json
(19.1m median / 44.8m p90):
- Set REST_SHARD_FIXED_SECONDS 165.028 0.000 and
REST_SHARD_FIXED_SECONDS_3 32.619 236.856 0.000 (replacing the
inverted pre-#5428 309.230 / 191.908 / 0.000 offsets).
- Leave-one-out holdout cross-validation cuts runner-normalized peak
shard task-seconds on 7/7 3-way holdouts (-86.8s to -214.8s) and
3/3 2-way holdouts (-58.9s to -117.6s).
3. Add disposable per-suite NODE_COMPILE_CACHE bytecode caching to
frontend-modern/scripts/__tests__/check-bundle-size.test.mjs and
build-embed-assets.test.mjs, matching sync-embed-dist.test.mjs,
to avoid recompiling jsdom across 107 test child processes.
Contract-Neutral: Test-harness logger synchronization, CI shard
scheduling weights, and test-only Node bytecode caching; no production
code, runtime behavior, or subsystem contracts changed.
**Revert NODE_COMPILE_CACHE experiment in frontend script tests**
Offline source proof (source-deagws44) showed cold first-child V8
bytecode cache writes pushing the first test in both
check-bundle-size.test.mjs and build-embed-assets.test.mjs past
Vitest's 5000ms default timeout without meaningfully improving
steady-state
per-test duration. Restore both test files byte-for-byte to e372097c0e.
Contract-Neutral: Test-only revert restoring frontend script tests to
base main; no production code or subsystem contracts changed.
**Fix shard rejection test under fixed-slice skew and stop leaked
monitor**
Ensure run_go_package_slice_test.py exercises reversed-order rejection
on every multi-package shard even when REST_SHARD_FIXED_SECONDS leaves
shard 0 with one synthetic fixture package, and register
t.Cleanup(monitor.Stop) in TestNewMonitorReusesGuestFilesystemReplies so
its alert manager goroutine does not leak across monitoring tests.
**Isolate alert data dirs in physical disk monitoring tests**
Use alerts.NewManagerWithDataDir(t.TempDir()) across the six
TestMaybePollPhysicalDisksAsync_* tests so
t.Cleanup(m.alertManager.Stop) does not persist alerts into a shared
default directory read by subsequent tests.
**Preserve logging broadcaster in monitoring TestMain atomic sink**
PR #5467 replaced log.Logger's output in
internal/monitoring/main_test.go with
an atomic sink defaulting only to os.Stderr, disconnecting
internal/logging's
LogBroadcaster fan-out. Every internal/monitoring test using
newMonitoringLogCapture (VMware, TrueNAS, and container SSH notice tests
in CI
shards rest-0 and rest-2) stopped receiving log lines.
Initialize monitoringTestLogSink with io.MultiWriter(os.Stderr,
logging.GetBroadcaster()) to preserve the default broadcaster wiring,
and
assert broadcaster delivery after
setPackageTestLogOutput/disablePackageTestLogs
restoration in TestPackageTestLogOutputSwapIsRaceFree.
Contract-Neutral: test-only harness fix in
internal/monitoring/main_test.go restoring default LogBroadcaster wiring
for monitoring unit tests
---
Fleet candidate `20261129T034336Z-delivery-trust` from the
`delivery-trust` lane. Reviewed tip
`67819721145b32896ec74b62eefc41b135e3fe4e` on `main`.
[How Pulse handles
triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)