Repository navigation
fix(api): accept enableRenderers in RTK compression config schema (#6703) #6757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
diegosouzapw
merged 1 commit into
cheaper-inference:release/v3.8.47
from
alltomatos:fix/6703-rtk-enablerenderers
Jul 10, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { describe, it } from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
|
|
||
| import { | ||
| rtkConfigSchema, | ||
| compressionSettingsUpdateSchema, | ||
| } from "../../src/shared/validation/compressionConfigSchemas.ts"; | ||
| import { DEFAULT_RTK_CONFIG } from "../../open-sse/services/compression/types.ts"; | ||
|
|
||
| // Regression for #6703: rtkConfigSchema uses Zod .strict() but was missing the | ||
| // `enableRenderers` field that DEFAULT_RTK_CONFIG (and the RTK engine's own | ||
| // configSchema) already define. The frontend reads DEFAULT_RTK_CONFIG (which | ||
| // carries enableRenderers), sends the full object back on save, and .strict() | ||
| // rejects the unknown key → HTTP 400 "Unrecognized key: enableRenderers". | ||
| // This broke PUT /api/settings/compression, POST /api/context/rtk/test, and | ||
| // PUT /api/context/rtk/config. | ||
|
|
||
| describe("RTK config schema — enableRenderers (#6703)", () => { | ||
| it("accepts enableRenderers on the strict rtkConfigSchema", () => { | ||
| assert.equal(rtkConfigSchema.safeParse({ enableRenderers: false }).success, true); | ||
| assert.equal(rtkConfigSchema.safeParse({ enableRenderers: true }).success, true); | ||
| }); | ||
|
|
||
| it("accepts the full DEFAULT_RTK_CONFIG without stripping fields", () => { | ||
| const result = rtkConfigSchema.safeParse(DEFAULT_RTK_CONFIG); | ||
| assert.equal(result.success, true, JSON.stringify(result.error?.issues)); | ||
| assert.equal(result.data.enableRenderers, false); | ||
| }); | ||
|
|
||
| it("rejects a genuinely unknown key (strict mode still enforced)", () => { | ||
| assert.equal(rtkConfigSchema.safeParse({ totallyBogusKey: true }).success, false); | ||
| }); | ||
|
|
||
| it("accepts rtkConfig with enableRenderers through the settings-update schema", () => { | ||
| // Mirrors the PUT /api/settings/compression payload from the bug report. | ||
| const result = compressionSettingsUpdateSchema.safeParse({ | ||
| rtkConfig: { ...DEFAULT_RTK_CONFIG, enableRenderers: false }, | ||
| }); | ||
| assert.equal(result.success, true, JSON.stringify(result.error?.issues)); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
RtkConfiginterface inopen-sse/services/compression/types.tsalso defines an optionalrenderersfield (renderers?: string[];). SincertkConfigSchemais defined with.strict(), any incoming configuration payload containing therenderersfield will trigger a validation failure (HTTP 400), similar to the issue withenableRenderers.To prevent this, we should also accept
renderersin the schema.