Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

  • Add validation check in SchemaMeta.__new__ to detect schema members that are instances of pl.DataType
  • Add validation check in SchemaMeta.__new__ to detect schema members that are types (subclasses) of pl.DataType
  • Add test cases for both error scenarios (instance and type)
  • Run tests to verify the changes work correctly (259 tests passed)
  • Run code review to ensure quality and fix feedback
  • Run security scan with CodeQL (no alerts found)
  • Verify edge cases and comprehensive testing complete
  • Refactor checks into single if statement per reviewer feedback
Original prompt

This section details on the original issue you should resolve

<issue_title>Fail creating schemas with members of type pl.DataType or type[pl.DataType]</issue_title>
<issue_description>### Problem

Similarly to previously reported schema member errors (#105, #126), a related issue occurs when a user defines a schema member as an instance of pl.DataType or its type, e.g.:

class MySchema(dy.Schema):
    name = pl.String()  # user error: pl.String is a polars DataType, not a Dataframely column

When this happens, the member is silently ignored/dropped in validation, so the resulting dataframe lacks this column with no warning or error, making debugging difficult. This is likely an unintentional user mistake, similar to cases already addressed in [#105] and [#126].

Suggested improvement

Consider raising an error when a schema contains members that are instances/types of pl.DataType, to help users catch such mistakes early.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 17, 2025 13:55
- Add check for pl.DataType instances (e.g., pl.String())
- Add check for pl.DataType types (e.g., pl.String)
- Add test cases for both scenarios
- Tests pass and linting is clean

Co-authored-by: borchero <22455425+borchero@users.noreply.github.com>
Remove redundant example from error message to make it clearer

Co-authored-by: borchero <22455425+borchero@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix silent error in schema member validation Validate schema members against polars DataType usage Dec 17, 2025
Copilot AI requested a review from borchero December 17, 2025 14:00
@borchero borchero changed the title Validate schema members against polars DataType usage feat: Validate schema members against polars DataType usage Dec 17, 2025
@github-actions github-actions bot added the enhancement New feature or request label Dec 17, 2025
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b813ac9) to head (7473528).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #246   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           53        53           
  Lines         3066      3070    +4     
=========================================
+ Hits          3066      3070    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Refactor the two separate checks for pl.DataType instance and type
into a single conditional as requested by reviewer

Co-authored-by: borchero <22455425+borchero@users.noreply.github.com>
@jjurm jjurm marked this pull request as ready for review December 18, 2025 12:32
@borchero borchero merged commit 7c73ea6 into main Dec 22, 2025
33 checks passed
@borchero borchero deleted the copilot/fix-schema-member-validation branch December 22, 2025 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail creating schemas with members of type pl.DataType or type[pl.DataType]

4 participants