Skip to content

fix(compression): one Auto-Clarity control on the caveman page, no stale saves - #15571

Merged
diegosouzapw merged 13 commits into
cheaper-inference:release/v3.8.52from
woodsonl:fix/caveman-page-single-auto-clarity
Oct 6, 2026
Merged

diegosouzapw merged 13 commits into
cheaper-inference:release/v3.8.52from
woodsonl:fix/caveman-page-single-auto-clarity

Conversation

@woodsonl

@woodsonl woodsonl commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

⚠️ base-red inherited: #15306

Summary

  • The caveman context page (CavemanContextPageClient.tsx) showed two Auto-Clarity controls in its Advanced view: its own checkbox, and a switch in the embedded compression settings tab (CompressionSettingsTab.tsx). Each kept its own copy of cavemanOutputMode, so after one changed the setting the other showed the old value until a reload. This PR deletes the tab's caveman output-mode section (heading, description, switch) and its now-unused typing, so the page checkbox is the only Auto-Clarity control. The tab renders only on that page, and the checkbox shows in both the Simple and the Advanced view.
  • The page's saves no longer write back settings it loaded earlier. The Auto-Clarity checkbox sends only { cavemanOutputMode: { autoClarity } }, which the store merges into its row inside the write transaction since fix(db): merge partial cavemanOutputMode writes with the stored row #15206. The language controls and pack toggles re-read the stored row and build languageConfig from it, because the store replaces that object whole; when the re-read fails they send nothing.
  • Turning a language pack off no longer removes English from enabledPacks. Before, "en" vanished whenever another pack was turned off, the page's English checkbox is always disabled so it could not bring English back, and with auto-detect off the caveman engine checks for "en" (open-sse/services/compression/caveman.ts:400).
  • settings.compressionSettingsCavemanOutputMode and settings.compressionSettingsAutoClarityBypass, used only by the deleted section, are removed from all 67 UI catalogs (2 lines each, nothing else).

Related Issues

Validation

  • Change type: UI, i18n
  • Focused tests and category gates from the golden path
  • npm run lint (ESLint with config/quality/eslint-suppressions.json, and Prettier, on the changed files)
  • Reconciled with the current active release base (merged release/v3.8.52 at 23a1148); focused checks rerun afterward
  • Production-code changes include new or updated automated tests in this PR
Check Result
New and changed cases against the code they replace Each fails there: the output-mode, language and pack stale-write cases and the English case on the old page code, and the single-control check with the tab at its pre-fix version (2 controls). The after-load failed-read cases fail, on their own assertion, against a page that falls back to its loaded copy: a fallback in the read's catch handler fails the thrown-read case, and a fallback after the read fails both
tests/unit/ui/compression-settings-tab-partial-save.test.tsx 14 of 14 pass
npm run test:vitest:ui 431 of 431 files and 2,849 tests pass on e30389e (the two later commits only add the after-load cases above). Vitest also reports 2 unhandled window is not defined errors from providerCardAudioBadge.test.tsx, a file this PR does not touch; the base tip's own run reports 2 from flowCanvas.test.tsx the same way
UI i18n gates check-key-completeness, check-ui-keys-coverage --threshold=65, check-translation-ratio, check-ui-value-drift, check-new-key-coverage pass
Type-check scoped to the changed files 0 errors in them (78 in files they import, none touched here)
Browser QA on a throwaway dev server 8 of 8 charters pass, no console errors. One Auto-Clarity control in both views; the checkbox's request body is exactly {"cavemanOutputMode":{"autoClarity":false}} and a panel change to on/off and level made after the page loaded survives it; a language change from another tab survives an auto-detect click; turning Spanish off keeps English; a tab Cache TTL save leaves Auto-Clarity alone

Tests Added Or Updated

  • tests/unit/ui/compression-settings-tab-partial-save.test.tsx: the caveman-page case now checks for one Auto-Clarity control after the embedded tab loads; new cases cover the output-mode save sending only autoClarity, language and pack saves keeping fields saved in another tab, English kept when a pack is turned off, and no language save when the page cannot read the settings row, both before its first load and after it, for a read that returns an error status and one that throws. The fake server merges a partial cavemanOutputMode the way the store does.

Coverage Notes

  • The changed source files are covered by the cases above. This file runs on this PR in ci.yml's "Vitest (MCP / autoCombo / UI components)" job.
  • That job is red on the base tip (run 37023786559) from unhandled errors in unrelated files while every test passes, so read its log for this file rather than the job status.

Reviewer Notes

  • Inherited reds on the base tip's push run 37023786559, besides the issue above: Lint stops at audit:deps on a critical advisory in next 16.2.0 to 16.3.5, Docs Sync (Strict) fails on translation drift in docs/architecture/QUALITY_GATES.md, and the UI Vitest job fails on 2 unhandled errors while all tests pass.
  • Language and pack saves read and then write: the store replaces languageConfig whole, so a languageConfig write that lands in the milliseconds between the page's re-read and its PUT is lost. Closing that needs a store-side merge plus an add or remove operation for the pack list.
  • After a failed re-read the page sends nothing and shows no message; the page has no save-error display today.

… page

The caveman page's Advanced view embeds CompressionSettingsTab, which
renders its own Auto-Clarity switch beside the page's Output Mode
checkbox. Each control loads its own copy of cavemanOutputMode, so a
change made in one leaves the other showing the old value until reload.

The test renders the page with compression on and an output mode stored,
opens Advanced, and expects one Auto-Clarity control. It fails on the
current code with two.
CompressionSettingsTab renders only inside the caveman page, and the
page's Output Mode card already carries the Auto-Clarity checkbox in
both the Simple and Advanced views. Drop the tab's caveman output-mode
section (its heading, description, and switch) so the page checkbox is
the only Auto-Clarity control.

The partial-save test case that clicked the tab's switch goes with it,
along with the helper only that case used. The aggressive case still
covers filling a nested save from the stored row.
…ping

Nothing in CompressionSettingsTab reads cavemanOutputMode.autoClarity since its
Auto-Clarity switch was removed. Drop the CavemanOutputModeConfig interface, its
override on CompressionConfig, and the autoClarity default, so cavemanOutputMode
takes the { enabled; intensity } type the token saver card reads.
…s controls

The caveman page sends the whole output-mode and language objects it loaded, so
a change saved in another tab after the page loaded is written back. Add cases
that save in another tab and then use the page's Auto-Clarity checkbox, its
auto-detect toggle, and a pack toggle, plus a case where the re-read fails.

Fold the single Auto-Clarity control check into the existing caveman-page case,
with a load anchor and a match on "clarity", and remove the standalone file it
duplicated.
Each save on the caveman page now re-reads the stored settings row and merges
its change into it, the way the settings tab builds a nested save. An output-mode
or language change saved elsewhere since the page loaded stays, and a failed
re-read sends nothing.
The settings tab's caveman output-mode section was the only user of
settings.compressionSettingsCavemanOutputMode and
settings.compressionSettingsAutoClarityBypass. Remove both keys from every UI
catalog, so each locale still carries exactly the en.json key set.
…ish pack

Since cheaper-inference#15206 the store merges a partial cavemanOutputMode into its row, so the
fake server does the same, and the Auto-Clarity case now requires the page to
send only { autoClarity }. Add a case that turns a pack off and keeps English,
and make the failed-read case a language save that starts from a failed first
read.
…nglish

The Auto-Clarity checkbox now sends { cavemanOutputMode: { autoClarity } } and
lets the store merge it into the stored row inside its write transaction, so a
panel change made between a re-read and the write is not overwritten. Language
saves still re-read the row first, because the store replaces languageConfig
whole. Turning a pack off no longer removes English, which the page cannot
turn back on.
The failed-read case starts from a failed first read, so the page never holds a
loaded copy and a save that fell back to that copy would still send nothing.
Add the case where the page loaded a row, the re-read then fails, and a
language save must send nothing.
The after-load case failed the re-read with an error status only, so the
page's catch handler ran in no case and a fallback written there would pass.
Let the fake server fail a read with a network error too, and run the
after-load case for both kinds of failure.
@woodsonl
woodsonl requested a review from diegosouzapw as a code owner October 5, 2026 16:42
Describe the single Auto-Clarity control on the caveman page, its saves that
keep changes saved elsewhere, English kept when a pack is turned off, and the
two removed translation keys.
@woodsonl

woodsonl commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

CI triage: all reds here are infra except one pre-existing flake. No code change needed.

On head a635c77, and identically on the previous head e73fc11 (the delta between them is a changelog fragment):

  • semgrep, API Route Typecheck, Merge integrity, Unit fast-path 3/4, Fast Quality Gates, and the whole CI run were cancelled mid-flight, not failed. The admission receipts record "required result is abandoned", and annotations read "job was not acquired by a hosted runner after multiple attempts". These need an admin re-run; the fork account cannot re-run them.
  • Unit fast-path 4/4 has one genuine test failure: usage-pending-sweep.test.ts "marked entries are removed first when the pending map exceeds the cap" (2 !== 3 at line 341). The test is flaky on base too: 1 failure in 6 local runs against base 23a1148, 2 in 6 against this head. The PR diff touches only compression UI and i18n, and nothing in usageHistory.ts's import graph changed. A quarantine or fix in the basereds effort fits; this PR is not the place.
  • Gate / CI and Gate / Quality are downstream admission verdicts over the above.

Verified green locally at head: check:changelog-integrity and check:agent-skills-sync (the fragment push fixed the Merge integrity failure the previous head had), and the API route typecheck (276 diagnostics, all inside the frozen baseline).

Ask: admin re-run of runs 37372281456, 37372281302, 37372281384, and 37372281292. A full re-run is the safer option since several jobs sit in cancelled state rather than failed.

@diegosouzapw
diegosouzapw merged commit 11f8c29 into cheaper-inference:release/v3.8.52 Oct 6, 2026
33 of 42 checks passed
fouadSalkini added a commit to fouadSalkini/OmniRoute that referenced this pull request Oct 20, 2026
Resolves the locale catalog conflicts with a three-way JSON merge: each
catalog keeps the release branch's content plus this PR's own keys, and
drops keys the release branch deleted on purpose (cheaper-inference#15571, cheaper-inference#15605, cheaper-inference#15386).
fouadSalkini added a commit to fouadSalkini/OmniRoute that referenced this pull request Oct 20, 2026
Resolves the locale catalog conflicts with a three-way JSON merge: each
catalog keeps the release branch's content plus this PR's own keys, and
drops keys the release branch deleted on purpose (cheaper-inference#15571, cheaper-inference#15605, cheaper-inference#15386).
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