Skip to content

fix: isolate JSON parameter containers during validation - #1022

Closed
Gareth.Y (linjiaye929) wants to merge 1 commit into
braintrustdata:mainfrom
linjiaye929:codex/isolate-json-parameter-containers
Closed

Gareth.Y (linjiaye929) wants to merge 1 commit into
braintrustdata:mainfrom
linjiaye929:codex/isolate-json-parameter-containers

Conversation

@linjiaye929

@linjiaye929 Gareth.Y (linjiaye929) commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Keep saved evaluation parameters and JSON-schema defaults independent of each validation result. Currently, mutating a returned default list or nested saved configuration changes later calls to validate_parameters. Applying nested defaults also mutates caller-owned input, even when validation ultimately raises.

Copy dict/list containers before applying defaults and when injecting each default. Preserve opaque leaf values rather than applying arbitrary __deepcopy__ methods; local Pydantic/model/prompt parameter validation remains unchanged. This does not change sharing of parameter values between rows within one evaluation run.

Regression coverage

Pure local tests through validate_parameters and RemoteEvalParameters cover:

  • Mutable defaults reused across validations.
  • Nested defaults in arrays without modifying runtime inputs.
  • Returned values without modifying saved parameter data.
  • Opaque values whose __deepcopy__ must not run.
  • Invalid input without partial default insertion into caller data.

Initial validation

Python 3.14.7, existing SDK test environment:

  • Before: test_parameters.py: 4 failed, 10 passed, 10 skipped.
  • After: 14 passed, 10 skipped. Skips require optional Pydantic, not installed in this environment.
  • All seven whole-repository pre-commit hooks passed. Because mise is unavailable, invoked the underlying pre-commit run --all-files command directly with pinned existing tools rather than claiming literal make fixup execution.
  • Production-file Pylint errors-only passed. Test-file Pylint reports eight missing-Pydantic imports; the unmodified baseline has the same eight errors.
  • Ruff check/format and git diff --check passed.

The initial validation used no live service/provider calls, new dependencies, or full-core run. Full-core, provider/version/type-check matrices are not claimed as passed.

Follow-up validation (2026-10-31)

In an isolated Python 3.14.7 environment with the repository-locked Pydantic 2.14.1 and pydantic-core 2.50.1, the complete test_parameters.py passed all 24 tests with no skips. Pylint errors-only passed for both changed files; supplemental shared-container alias and opaque-lock checks passed. This resolves the earlier optional-Pydantic skips/import errors. The tests used the existing external-network guard; no outbound attempts were observed. The full-core suite was not retried, and provider/version matrices, including real Pydantic v1, remain untested.

AI assistance

Prepared with AI assistance. Independent AI code and evidence reviews found no blocking issues in the scoped change and follow-up validation. Human review and hosted CI are still pending.

Compatibility scope: ordinary dict/list containers are isolated; opaque leaf objects remain shared, and dict/list subclasses are normalized to ordinary containers. This does not introduce general support for cyclic parameter inputs.

@linjiaye929
Gareth.Y (linjiaye929) marked this pull request as ready for review October 31, 2026 06:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T06:54:30.592854Z 7bd9d06 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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