Fix CI test drift and SSE idle race

Refs Build and Test failures on pulse/v6-release.
This commit is contained in:
rcourtman
2026-06-11 15:48:00 +01:00
parent 58aa00c5c4
commit 55db13fc06
3 changed files with 14 additions and 7 deletions
+4 -3
View File
@@ -3477,12 +3477,13 @@ func (s *legacyAssistantSSEWriter) startHeartbeat(ctx context.Context) {
}
func (s *legacyAssistantSSEWriter) startIdleProgress(ctx context.Context) {
if chatStreamIdleProgressInterval <= 0 {
interval := chatStreamIdleProgressInterval
if interval <= 0 {
return
}
go func() {
ticker := time.NewTicker(chatStreamIdleProgressInterval)
ticker := time.NewTicker(interval)
defer ticker.Stop()
for {
select {
@@ -3500,7 +3501,7 @@ func (s *legacyAssistantSSEWriter) startIdleProgress(ctx context.Context) {
return
}
lastEventAt := time.UnixMilli(s.lastClientEventUnixMS.Load())
if time.Since(lastEventAt) < chatStreamIdleProgressInterval {
if time.Since(lastEventAt) < interval {
continue
}
progressEvent := ai.StreamEvent{
@@ -764,9 +764,9 @@ func TestSeedMockMetricsHistory_UsesCanonicalMockFixtureGraphForLegacyAndProvide
sampleInterval := time.Minute
historyRetention := boundedMockHistoryProofWindow
if raceEnabled {
seedDuration = 5 * time.Minute
seedDuration = 3 * time.Hour
sampleInterval = time.Minute
historyRetention = 10 * time.Minute
historyRetention = 3 * time.Hour
}
cfg := metrics.DefaultConfig(t.TempDir())
+8 -2
View File
@@ -707,7 +707,13 @@ test_makefile_routes_managed_runtime_through_npm() {
test_hot_dev_script_advertises_foreground_escape_hatch() {
local output
output="$(sed -n '1,40p' "${HOT_DEV}")"
output="$(
awk '
NR == 1 { print; next }
/^#/ || /^$/ { print; next }
{ exit }
' "${HOT_DEV}"
)"
assert_contains "hot-dev header identifies foreground escape hatch" "${output}" "hot-dev.sh - Foreground Pulse dev runtime escape hatch"
assert_contains "hot-dev usage points to managed runtime first" "${output}" "npm run dev # Canonical managed dev runtime"
@@ -821,7 +827,7 @@ test_hot_dev_health_monitor_probes_api_health() {
local output
output="$(cat "${HOT_DEV}")"
assert_contains "hot-dev health monitor declares a configurable unhealthy streak threshold" "${output}" 'UNHEALTHY_THRESHOLD="${HOT_DEV_BACKEND_UNHEALTHY_THRESHOLD:-2}"'
assert_contains "hot-dev health monitor declares a configurable unhealthy streak threshold" "${output}" 'UNHEALTHY_THRESHOLD="${HOT_DEV_BACKEND_UNHEALTHY_THRESHOLD:-4}"'
assert_contains "hot-dev health monitor declares backend startup grace" "${output}" 'BACKEND_HEALTH_STARTUP_GRACE_SECONDS="${HOT_DEV_BACKEND_HEALTH_STARTUP_GRACE_SECONDS:-180}"'
assert_contains "hot-dev health monitor declares missing-process grace" "${output}" 'BACKEND_PROCESS_MISSING_GRACE_SECONDS="${HOT_DEV_BACKEND_PROCESS_MISSING_GRACE_SECONDS:-10}"'
assert_contains "hot-dev health monitor tracks backend restart time through a shared marker" "${output}" 'BACKEND_STARTED_AT_FILE="${HOT_DEV_BACKEND_STARTED_AT_FILE:-${ROOT_DIR}/tmp/hot-dev.backend.started-at}"'