Skip to content

[upstream #16433] 16433: apply per-key record refinements when validating config overrides #168

Description

@berry-13

Raised on LibreChat-AI#16433: LibreChat-AI#16433 (comment)

getConfigOverrideIssues (packages/data-provider/src/overrides.ts) validates principal config overrides field by field, so a partial section is accepted and absent fields are left to the base. To do that it unwraps ZodEffects, which also drops the refinements attached to the unwrapped schema. Object-level refinements are skipped deliberately because they judge the merged section, not the patch, but record-level refinements such as the superRefine on addParamsSchema judge each key on its own and could be enforced.

What happens: a field patch such as endpoints.azureOpenAI.groups.0.addParams.web_search = "yes" passes validation and is stored, although addParamsSchema rejects a non-boolean web_search. A whole-array write of groups is already rejected, because arrays that replace the base are validated in full.

Expected: refinements that can judge the provided keys alone (record refinements keyed per entry) are applied on write and at merge, both for whole-document writes and for field paths that end inside a refined record, without rejecting valid partial patches of refined objects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: packagesreviewctl followups stateenhancementNew feature or requestfixedreviewctl followups state

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions