Skip to content

chore(ci): fix flaky live-updates E2E test (heartbeat check thundering-herd) - #106

Merged
fclairamb merged 1 commit into
mainfrom
chore/ci-fix-2026-07-06
Jul 6, 2026
Merged

fclairamb merged 1 commit into
mainfrom
chore/ci-fix-2026-07-06

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

Summary

  • Root-caused the flaky live-updates.spec.ts E2E test (a new check's first result appears live on the detail page without the hot poll), which failed 3/3 attempts in CI run 28757925762.
  • The actual bug was in the backend, not the frontend polling logic the test names: executeJob dispatched passive (heartbeat/email) checks to executePassiveJob before the pre-schedule sleep that active checks already honor. A passive job claimed ahead of its scheduled_at (D3's bounded claim-ahead window) therefore fired immediately on every release instead of waiting out the window — thundering-herding the whole worker pool (reproduced locally: ~1000 executions of a single check in ~5s) and broadcasting a live-update hint on every one of those spurious executions, which is what the E2E test's fetch-count assertion was catching.
  • Fix: move the sleep-until-scheduled_at step in executeJob so it runs for both active and passive jobs, before dispatching to either path. Pure reorder of existing code — no behavior change for active checks, and passive checks now correctly wait out the claim-ahead window like every other check type.
  • Added a regression test (TestExecuteJobPassiveJobHonorsScheduledAtSleep) that fails on the old code and passes with the fix.

Test plan

  • go build ./... and go vet ./... clean
  • make lint clean (backend + dash)
  • make test — full backend suite passes
  • New regression test verified to fail without the fix and pass with it
  • live-updates.spec.ts "without the hot poll" test run 15x in a row against a side-car server — 0 failures (was failing ~1/10-15 runs before the fix)
  • Full live-updates.spec.ts file run 3x — 0 failures
  • Full E2E suite run once end-to-end — passes

🤖 Generated with Claude Code

@fclairamb
fclairamb merged commit 5ab256a into main Jul 6, 2026
11 checks passed
@fclairamb
fclairamb deleted the chore/ci-fix-2026-07-06 branch July 6, 2026 01:28
fclairamb added a commit that referenced this pull request Nov 23, 2026
…on diagnostics (#990)

## What changed

- **Checks search** (solidping-business#105): every word of a multi-word
query must now match the name or the slug (`ts- ssh` finds `ts-ssh-…`);
`%` and `_` typed in a search are matched literally.
- **Escalation policy editor** (#107, finding 1): the step target Select
stays controlled, no more React "uncontrolled to controlled" warning.
- **Webhook deliveries** (#106): the HTTP status is classified. 4xx (and
3xx) are permanent failures, logged at WARN instead of ERROR; 5xx, 429
and 408 are retried up to `MaxRetryCount`, honouring `Retry-After`
(seconds or date, capped at 15 min). The `Job failed` log line carries
`status_code`. A notification webhook keeps the same `webhook-id` (the
root job UID) across its retries, so receivers can deduplicate.
- **iOS Safari session loss** (#107, finding 2): not reproduced under
Playwright WebKit iPhone emulation, so only diagnostics ship: PostHog
events `session_missing_on_load` (booleans only, never token values),
`session_cleared` (with the reason, plus a `solidping_session_cleared`
localStorage marker read on the next load) and `session_persist_failed`;
events fired before PostHog loads are queued (max 10). The fix comes
once production events point at the cause.

Breaking (internal): `jobsvc.Service.RetryJob` takes an `after
time.Duration`; `clearToken(reason)` now requires a reason.

## Decided by autopilot

- webhook-status-retry-classification, "same `webhook-id` across
retries?": yes, the root job UID.
- webhook-status-retry-classification, "surface repeated failures as
integration health?": out of scope.
- ios-safari-session-lost, "ship the instrumentation first if not
reproduced?": yes, instrumentation only.
- ios-safari-session-lost, "drop stackless `Script error.` events?": not
yet, only once the events show they don't precede the sign-out.

Closes fclairamb/solidping-business#105
Closes fclairamb/solidping-business#106
Closes fclairamb/solidping-business#107

🤖 Generated with [Claude Code](https://claude.com/claude-code)
- CodeQL js/clear-text-storage-of-sensitive-data,
web/dash0/src/api/client.ts:126/131/135 (alerts #136-#138): dismissed as
false positive, tokens live in localStorage by design until the
HttpOnly-cookie spec (2026-09-15-05 B1), as for #1-#3/#129.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant