Skip to content

Fix from_chemeleon=True throwing error#544

Merged
dwwest merged 2 commits into
mainfrom
from_foundation_error
May 6, 2026
Merged

Fix from_chemeleon=True throwing error#544
dwwest merged 2 commits into
mainfrom
from_foundation_error

Conversation

@dwwest
Copy link
Copy Markdown
Contributor

@dwwest dwwest commented May 6, 2026

Description

Fix error where if you just set from_chemeleon=True, you hit error.

Quality Assurance & AI Policy

To maintain project quality and respect maintainer bandwidth, please confirm the following:

  • [ x] Manual Verification: I have manually reviewed and tested the code in this PR.
  • [ x] AI-Assisted Content: If AI tools were used (e.g., Copilot, ChatGPT), I have personally verified the logic, edge cases, and compliance with the existing codebase. I confirm the code is not a "blind" AI generation.
  • [ x] Minimal Review: I believe this PR is in a state that requires minimal intervention or correction from maintainers.
  • [ x] Scoped Change: This PR addresses a single, well-scoped issue rather than multiple unrelated changes.

Status

  • [ x] Ready to go (Checking this signals to maintainers that the PR is ready for final review)

Developers Certificate of Origin


Note to Contributors: We reserve the right to close PRs without review if they appear to lack human validation or do not meet the quality standards described in our CONTRIBUTING.md.

dwwest and others added 2 commits May 6, 2026 10:24
Move backwards-compatibility logic for from_chemeleon → from_foundation
from __init__ into a @model_validator(mode='before') classmethod, which
is the idiomatic Pydantic v2 pattern for pre-processing input data before
fields are assigned.

- Add handle_from_chemeleon_compat pre-validator that emits a
  DeprecationWarning and translates from_chemeleon=True to
  from_foundation='chemeleon' before field assignment
- Remove compat if-blocks from __init__, which now only tracks
  _explicit_init_fields
- Mark from_chemeleon as deprecated in the docstring
- Add test for happy-path compat (from_chemeleon=True → from_foundation)
- Add test asserting DeprecationWarning is emitted

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@smcolby smcolby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge it!

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dwwest dwwest merged commit 5dcac1d into main May 6, 2026
5 checks passed
@dwwest dwwest deleted the from_foundation_error branch May 6, 2026 09:33
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.

3 participants