Skip to content

refactor: prune dead isHeartbeatEnabled branches (heartbeat always on)#53

Merged
vi70x4 merged 2 commits into
mainfrom
refactor/prune-heartbeat-dead-branches
Jul 17, 2026
Merged

refactor: prune dead isHeartbeatEnabled branches (heartbeat always on)#53
vi70x4 merged 2 commits into
mainfrom
refactor/prune-heartbeat-dead-branches

Conversation

@vi70x4

@vi70x4 vi70x4 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Heartbeat is now permanently enabled (team policy — heartbeat_enabled defaults true and is no longer toggled). Every isHeartbeatEnabled() call resolved to true, so all disabled-mode branches were dead code.
  • Removes the isHeartbeatEnabled() toggle and ~30 dead branches across heartbeat.ts, router.ts, proxy.ts, responses.ts, racing-mode.ts, health.ts.
  • Collapses the reliability scoring fork in router.ts to a single heartbeatReliability(platform, modelId) / 100 line (the Beta-posterior fallbacks were unreachable).
  • Deletes orphaned reliabilityPosteriorForModel export (model-priors.ts) and drops the now-phantom heartbeat_enabled feature toggle + its 11 parentToggle references in feature-settings.ts.
  • Cleans up tests: removes disabled-behavior assertions, drops isHeartbeatEnabled from test mocks, adds a missing getKeyStats mock export in key-affinity.test.ts.

Verification

  • grep -rn "isHeartbeatEnabled" server/src → 0 hits
  • grep -rn "reliabilityPosteriorForModel" server/src → 0 hits
  • npm run build → clean (tsc --noEmit passes)
  • npm run test -w server → 1037 passing / 77 files. The 5 remaining failures are pre-existing and unrelated (a client settings-layout.test and a fetch-bad-port ordering flake that passes in isolation).

Notes

  • Zero behavior change on the live (heartbeat-on) path — the removed branches never fired.
  • Cold keys (un-pinged) now consistently report isKeyHealthy === false, matching the existing proportionHealthyKeys docstring ("cold keys are NOT healthy").

vi70x3 added 2 commits July 16, 2026 01:49
The Reliability column tooltip described stale traffic-vs-errors
semantics. Server-side reliability is computed as heartbeat
key-health share (proportionHealthyKeys), independent of real
traffic. Rewrite the hint to match, drop the dead
reliabilityWithHeartbeat property, and update the test assertion.
…s on

Heartbeat is now permanently enabled (team policy — heartbeat_enabled
defaults true and is no longer toggled). Every isHeartbeatEnabled()
call resolved to true, so all disabled-mode branches were dead code.

- Remove the isHeartbeatEnabled() toggle and ~30 dead branches across
  heartbeat.ts, router.ts, proxy.ts, responses.ts, racing-mode.ts, health.ts
- Collapse the reliability-scoring fork in router.ts to a single
  heartbeatReliability(platform, modelId) / 100 line (Beta-posterior
  fallbacks were unreachable)
- Delete orphaned reliabilityPosteriorForModel export (model-priors.ts)
- Drop the phantom heartbeat_enabled toggle + 11 parentToggle references
  in feature-settings.ts
- Clean up tests: remove disabled-behavior assertions, drop
  isHeartbeatEnabled from test mocks, add missing getKeyStats mock
  export in key-affinity.test.ts

Zero behavior change on the live (heartbeat-on) path. Cold keys now
consistently report isKeyHealthy === false, matching the existing
proportionHealthyKeys docstring.
@vi70x4
vi70x4 merged commit 59efcf1 into main Jul 17, 2026
1 check passed
@vi70x4
vi70x4 deleted the refactor/prune-heartbeat-dead-branches branch July 17, 2026 22:39
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.

2 participants