Skip to content

fix(api): accept enableRenderers in RTK compression config schema (#6703) - #6757

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.47from
alltomatos:fix/6703-rtk-enablerenderers
Jul 10, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.47from
alltomatos:fix/6703-rtk-enablerenderers

Conversation

@alltomatos

Copy link
Copy Markdown
Contributor

Problem

Saving compression settings in the Dashboard (or calling the RTK config/test APIs)
fails with an HTTP 400 validation error:

{"error":{"message":"Invalid request","details":[{"field":"rtkConfig","message":"Unrecognized key: \"enableRenderers\""}]}}

This blocks:

  • PUT /api/settings/compression (Dashboard "Save")
  • POST /api/context/rtk/test
  • PUT /api/context/rtk/config

Root cause

rtkConfigSchema in src/shared/validation/compressionConfigSchemas.ts is declared
with Zod .strict(), but it was missing the enableRenderers field — even though that
field is part of the RTK config everywhere else:

  • open-sse/services/compression/types.ts → DEFAULT_RTK_CONFIG has enableRenderers: false ✅
  • open-sse/services/compression/engines/rtk/configSchema.ts → RTK_SCHEMA has enableRenderers ✅
  • src/shared/validation/compressionConfigSchemas.ts → rtkConfigSchema missing ❌

The flow that triggers it:

  1. The frontend reads settings and gets enableRenderers: false from DEFAULT_RTK_CONFIG.
  2. The user changes any compression setting and clicks Save.
  3. The frontend echoes the full config back — including enableRenderers.
  4. .strict() sees the unknown key and rejects the whole request with 400.

Fix

Add enableRenderers: z.boolean().optional() to rtkConfigSchema, right after
preserveDocstrings — mirroring the type in DEFAULT_RTK_CONFIG / RTK_SCHEMA.
.strict() is preserved, so genuinely unknown keys are still rejected.

     stripCodeComments: z.boolean().optional(),
     preserveDocstrings: z.boolean().optional(),
+    enableRenderers: z.boolean().optional(),
   })
   .strict();

Verification

New regression test tests/unit/rtk-enable-renderers-6703.test.ts.

Before the fix (reproduces the reported error):

$ node --import tsx/esm --test tests/unit/rtk-enable-renderers-6703.test.ts
not ok 1 - accepts enableRenderers on the strict rtkConfigSchema
    [{"code":"unrecognized_keys","keys":["enableRenderers"], ... "message":"Unrecognized key: \"enableRenderers\""}]
not ok 4 - accepts rtkConfig with enableRenderers through the settings-update schema
# tests 4 | # pass 1 | # fail 3

After the fix:

$ node --import tsx/esm --test tests/unit/rtk-enable-renderers-6703.test.ts
# tests 4 | # pass 4 | # fail 0

$ npx eslint --suppressions-location config/quality/eslint-suppressions.json \
    src/shared/validation/compressionConfigSchemas.ts tests/unit/rtk-enable-renderers-6703.test.ts
# exit 0

$ npm run typecheck:core
# no new errors on the changed file (2 pre-existing `Cannot find module 'omniglyph'`
# errors in stats.ts / omniglyphAdapter.ts are an unrelated local-env issue — those
# files are untouched by this change)

The test also asserts .strict() still rejects a genuinely unknown key, so the anti-typo
guard is unchanged.

Diff summary

  • src/shared/validation/compressionConfigSchemas.ts — add enableRenderers (+1 line)
  • tests/unit/rtk-enable-renderers-6703.test.ts — new regression test (+41 lines)

Closes #6703.

Thanks for the precise root-cause report — the field-by-field comparison made this a one-line fix.

Loading
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