Repository navigation
refactor(db): drop unreachable aggressiveEnabled fallback in engines-map derivation - #15601
Merged
diegosouzapw merged 3 commits intoOct 6, 2026
Conversation
…map derivation normalizeAggressiveConfig never emits an enabled key and the strict aggressive config schema has none either, so the helper always returned false. Keep the case branch as an explicit no-op so aggressive derives to off and still picks up the defaultMode fallback below.
The header listed aggressive among engines read from dedicated config blocks and the case comment did not note the deliberate split from the default-combo structural path; both now state the surviving invariant.
diegosouzapw
merged commit Oct 6, 2026
38a2660
into
diegosouzapw:release/v3.8.52
42 of 51 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the unreachable
aggressiveEnabledfallback from the engines-map derivation insrc/lib/db/compression.tsand pins the derived behavior with a unit test.deriveEnginesMap()calledaggressiveEnabled(config.aggressive), which readtoRecord(value).enabled === true. Nothing can put anenabledkey there:config.aggressiveis assigned only fromnormalizeAggressiveConfig(), an explicit-pick normalizer that never emits the key;AggressiveConfigandDEFAULT_AGGRESSIVE_CONFIGhave noenabledfield; the strictaggressiveConfigSchemahas none. The helper always returnedfalse, so the derivation behaved identically with it removed. The only scenario it nominally covered (a storedaggressive.enabled=true, reachable only through an outside write) keeps its existing behavior: Aggressive shows as off unlessdefaultModeis "aggressive".The change keeps
case "aggressive": break;with a comment so aggressive derives to off instead of falling into the default-combo branch, and leaves thedefaultModefallback below it untouched. A legacy install withdefaultMode: "aggressive"still derives aggressive as on.Commits:
4d4b3c793crefactor(db): drop unreachable aggressiveEnabled fallback in engines-map derivation200ef74584docs(db): align deriveEnginesMap comments with the aggressive derivationTest Coverage
Tests: 6782 → 6783 (+1 new)
Coverage: 100% value-weighted (100% including 0 weakly covered paths)
Test value: 1 test written, 0 rejected by the authoring gate, 0 existing tests extended, 0 paths weakly covered.
The new test,
tests/unit/compression/compression-engines-map-derived-defaults.test.ts, pins the derived engines map through the realgetCompressionSettings()+ SQLite boundary (tempDATA_DIR, no test-only seam):defaultMode: "aggressive": aggressive on (the fallback this PR keeps).aggressive.enabled=true, reachable only through an outside write: ignored.Base control: the test also passes against the base version of
compression.ts, which proves the removal is behavior-preserving and the test pins the derived value, not the implementation.Pre-Landing Review
No issues found. Ship pass: 3 specialists (testing, maintainability, performance), 0 defects; one maintainability note at confidence 3 (pre-existing comment enumeration outside the diff) held to the appendix as low confidence.
Outside review: Codex adversarial unavailable (local preflight reports
model_unusable; the model-resolver script is missing). The native Claude adversarial pass ran instead and found no defects in the diff.Follow-ups from the adversarial pass, all pre-existing and outside this diff, recorded here rather than fixed in this PR:
engineswrite flips dispatch authority. PUT/api/settings/compressionaccepts a subset engine map;sanitizeEnginesForWrite()persists only the present keys, and the next read treats the partial map as explicit (enginesExplicit=true), defaulting every unlisted engine to off. A legacy install runningdefaultMode: "aggressive"could lose aggressive compression on one partial panel save, with no warning. Suggested fix: merge partial writes onto the stored row, or derive unlisted engines from the legacy fields before marking the map explicit.defaultModeinstall keeps aggressive on) would guard the migration story end to end.aggressive.preserveSystemPromptandultra.preserveSystemPromptpass the Zod schemas but their normalizers silently drop them;planFromHeader()'sengine:<id>branch andresolveStackSteps()readconfig.engineswithout theenginesExplicitgate (the main dispatch path is gated); the PUT schema accepts and persists a junkenginesExplicitrow.Exploratory QA
Functional smoke on the changed read path (node:test, isolated temp
DATA_DIR, no server, no external mutation):defaultMode=aggressive/ rogue storedenabledignored): 3 pass, 0 fail.Evidence ledger label
tests-unit-compression: exit 0, 13 tests total, receipt FRESH at ship time. Full unit shards, Vitest, the coverage gate and the build run in CI per CONTRIBUTING.md.Design Review
No frontend files changed; design review skipped.
Eval Results
No prompt-related files changed; evals skipped.
Scope Drift
Scope Check: CLEAN
Intent: remove the dead
aggressiveEnabledfallback, keep the derived engines map identical, pin it with a test.Delivered: exactly that, plus comment corrections the review pass requested.
Plan Completion
Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). Fix: add "Plan: " to the PR body, or run /autoplan.
Verification Results
No plan-specific verification obligations (no plan bound). Gate results on the shipped tree: focused unit lanes 13/13 PASS; lint (suppression-aware) PASS;
typecheck:corePASS; Prettier PASS; coverage gate PASS (100% value-weighted); QA verdict PASS (materialized, no open items).Documentation
Status: current - no documentation changes required; docs already match what shipped.
Audited scope: branch
fix/remove-aggressive-enabled-fallbackvsorigin/release/v3.8.52(2 commits, 2 files). The diff removes the module-private dead helperaggressiveEnabled()fromderiveEnginesMap()insrc/lib/db/compression.ts(the aggressive case now leaves the derived legacy toggle off, with explanatory comments) and addstests/unit/compression/compression-engines-map-derived-defaults.test.ts(3 tests locking the derived-map behavior). No exported API, endpoint, flag, or user-facing behavior changed. Working tree clean (no staged, unstaged, or untracked content). The repo has no authored.tmpldoc templates.Documentation health:
README.md - Current (Aggressive engine row, pipeline alt-text and profile mentions unchanged by the diff; still accurate)
CLAUDE.md - Current (no derived-engines-map or aggressive enabled-flag claims)
docs/compression/COMPRESSION_ENGINES.md - Current (read in full; modes table still accurate; validation globs
tests/unit/compression/*.test.tsalready cover the new test)docs/compression/COMPRESSION_GUIDE.md - Current (mode selection, per-combo and per-request override sections match post-diff code)
docs/compression/EXTENDING_COMPRESSION.md - Current (mode table and defaultMode selection match; the new test locks exactly the documented defaultMode semantics)
CHANGELOG.md - Not applicable (untouched by branch; metadata owned by the parent)
Verification of the stale-doc question: repo-wide search found no doc naming
aggressiveEnabledorderiveEnginesMap; targeted sweeps (aggressive, engines map, defaultMode, backfill, migration 102) across docs/, README.md, CLAUDE.md, AGENTS.md, llm.txt, CONTRIBUTING.md, docs/reference/API_REFERENCE.md and docs/openapi.yaml found no claim the diff makes stale. Theaggressivementions in docs/i18n/*/CHANGELOG.md mirrors are historical release records, not current-behavior docs.Coverage debt: none attributable to this diff. The removed helper was module-private; no public surface changed. The aggressive engine retains reference coverage (README pipeline table, COMPRESSION_GUIDE.md, COMPRESSION_ENGINES.md modes table).
Diagram drift: none -
docs/diagrams/compression-pipeline.svglists the Aggressive engine, which still exists.Test plan
node --import tsx/esm --test tests/unit/compression/compression-engines-map-derived-defaults.test.ts: 3 pass / 0 fail (also green against the base source)node --import tsx/esm --test tests/unit/compression/compression-engines-map-migration.test.ts: 2 pass / 0 failnode --import tsx/esm --test tests/unit/compression-settings-cache.test.ts: 5 pass / 0 failnode --import tsx/esm --test tests/unit/chatcore-compression-settings.test.ts: 3 pass / 0 failnpm run lintandnpm run typecheck:core: clean