Skip to content

fix(compression): surface failed settings loads on Hub, Combos and RTK - #15583

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.52from
woodsonl:fix/surface-failed-settings-loads
Oct 6, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.52from
woodsonl:fix/surface-failed-settings-loads

Conversation

@woodsonl

@woodsonl woodsonl commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #15306

Three dashboard surfaces load GET /api/settings/compression and swallow a failure: a non-OK reply becomes null, a thrown fetch lands in an empty catch, and each renders hard-coded defaults as if they were the stored settings. None shows an error:

  • Compression Hub fell back to { enabled: false, defaultMode: "off", contextEditing: { enabled: false } }, showed "Default (from panel)" and Context Editing off, and kept its active-profile select and context-editing toggle live. Each save sent only its own patch, so no default was written, but the user acted on a wrong view.
  • CompressionCombosPageClient fell back to activeComboId: null and compressionEnabled: false, which suppressed the master-switch warning, hid the Active badge and disabled the per-combo override selects.
  • RtkContextPageClient reads only the master flag from that GET, so a non-OK reply showed the "master switch is OFF" banner even when the stored flag was on.

Fix

Mirrors #15346 in CompressionPanel.tsx and CompressionSettingsTab.tsx. Each component keeps a loadFailed state and a loadAttempt counter in the load effect's dependencies, with an ignore flag in the cleanup so a retry drops answers from the run it replaced. A failed load renders "Prompt Compression: Failed To Load" (existing keys settings.compressionTitle, common.failedToLoad, settings.retry) with a Retry button, and every control that depends on the loaded settings stays off screen until a GET succeeds.

Tests (TDD per Hard Rule #18)

Failing-first vitest jsdom cases per component, one where the settings GET answers 500 and one where it throws. Each expects an error state with a Retry in place of the defaulted view:

  • tests/unit/ui/compressionHub.test.tsx: the default-profile select and Context Editing toggle stay off screen; Retry reloads the stored settings (the toggle reflects the stored row, the combo list fills).
  • tests/unit/ui/namedCombos-active-badge.test.tsx: the defaulted manager is replaced; Retry restores the master-switch warning and the Active badge, and a routing-combos answer from the superseded load is ignored.
  • tests/unit/ui/rtk-context-page-load-failure.test.tsx (new): the master-switch-OFF banner is replaced; Retry brings the controls back and keeps the banner hidden when the stored flag is on.

Focused runs: 14/14 across the three files, 21/21 across the seven adjacent suites (compressionHub-active-selector, compressionHub-context-editing, CompressionHub-patch-only, compression-combos-routing-mode-6760, combos-page-smoke, rtkLearnDiscoverCard, rtkTomlImportCard). ESLint clean on the six changed files; npm run typecheck:core clean.

Coordination with the two open branches

git merge-tree --write-tree HEAD <head> was checked against both before opening this PR: fix/compression-hub-overlapping-saves (edits CompressionHub's load path) and fix/exclusions-rtk-save-failures (edits RtkContextPageClient's RTK config load) both merge clean. Neither branch is modified here. If either lands first, this PR can rebase on it without conflict.

GET /api/settings/compression failures were swallowed on three dashboard
surfaces: a non-OK reply became null and a thrown fetch hit an empty catch,
so each rendered hard-coded defaults as if they were the stored settings —
the Hub showed Default (from panel) and Context Editing off with both
controls live, the combos manager suppressed the master-switch warning, hid
the Active badge and disabled the override selects, and the RTK page showed
the master-switch-OFF banner even when the stored flag was on.

Each surface now keeps a loadFailed/loadAttempt pair and re-runs its load
per attempt with an ignore flag in the effect cleanup, mirroring diegosouzapw#15346 in
CompressionPanel.tsx and CompressionSettingsTab.tsx: a failed load shows
Prompt Compression: Failed To Load with a Retry, and every control that
depends on the loaded settings stays off screen until a GET succeeds.
@woodsonl
woodsonl requested a review from diegosouzapw as a code owner October 5, 2026 20:34
@diegosouzapw
diegosouzapw merged commit a9dbbb0 into diegosouzapw:release/v3.8.52 Oct 6, 2026
34 of 42 checks passed
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