Skip to content

chore(frontend): kill-switch toggle and global-save retry paths have no tests #573

Closed

Description

@cristim

Summary

Test gaps around the Settings global save and the laddering kill-switch toggle. Found in the independent review of #570 (merged). Related: #539, #570.

Gaps (main at f7405b9)

  1. frontend/src/ladder.ts:323-350 (wireKillSwitchToggle) sends { laddering_enabled: toggle.checked } on change, but frontend/src/__tests__/ladder.test.ts never fires the toggle's change event and has no laddering_enabled assertion (the only matches are element ids). Dropping or renaming the field would pass the suite.
  2. frontend/src/settings.ts:3553-3560: after await api.updateConfig(changedGlobal) the snapshot is advanced for each sent key. No test fails the global PUT and checks that a retry re-sends the field; the existing failure test (settings.test.ts:622) only covers the error toast. A mutant that advances the snapshot before the PUT survives.
  3. Same block: the advance calls getFieldValue(id) after the PUT resolves, while changedGlobal was built from earlier values. A field edited while the PUT is in flight is recorded as saved without having been sent (same shape as snapshotAllFields, settings.ts:370). The test for item 2 should cover this case; fixing it means capturing the sent values before the await.

Acceptance

Tests: the toggle change sends exactly { laddering_enabled: <checked> }; a rejected global PUT followed by Save re-sends the field; an edit made during an in-flight PUT stays dirty afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions