test(ITL-10): add dataclass → DataFrame conversion test coverage#216
Conversation
…TL-10) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…-fails-to-convert-to-dataframe
There was a problem hiding this comment.
Pull request overview
This PR adds regression test coverage for ITL-10, ensuring dataclass-returning FunctionNodes produce stable, correctly-typed Polars DataFrames via .as_df(), and that plain Arrow struct schemas are inferred as dynamic TypedDicts that round-trip back to the identical Arrow struct type through the universal converter.
Changes:
- Added end-to-end pipeline tests validating dataclass output →
as_df()behavior for populated and unrun nodes (including schema stability). - Added converter-level unit tests verifying plain Arrow struct → dynamic
TypedDictinference, round-trip type mapping, and write-back table construction. - Added internal design/spec and implementation plan documentation for the ITL-10 test work.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_extension_types/test_universal_converter_struct.py | New unit tests for struct → dynamic TypedDict inference + round-trip/write-back behavior. |
| tests/test_core/nodes/test_function_node_dataclass.py | New end-to-end tests for dataclass-returning FunctionNode .as_df() output and schema stability. |
| superpowers/specs/2026-07-08-itl-10-dataclass-dataframe-conversion-tests-design.md | New design/spec documenting ITL-10 staleness assessment and success criteria for tests. |
| docs/metamorphic/plans/2026-07-08-itl-10-dataclass-dataframe-tests.md | New implementation plan documenting the steps to add/verify the new tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @pytest.fixture | ||
| def converter(): | ||
| """Fresh UniversalTypeConverter from the default DataContext.""" | ||
| return get_default_context().type_converter |
There was a problem hiding this comment.
Fixed. The docstring now accurately states that get_default_context() returns a cached singleton and that the converter may be shared across tests. Added a note that the tests are written to be order-independent under that constraint.
…n, not fresh per test
Review response (round 1)One comment addressed:
|
Summary
FunctionNodes produce correct Polars DataFramesStaleness finding
The exact reproducer from ITL-10 already runs without error.
as_table()now derives its schema fromoutput_schema()directly (FN1 fix), so the originalValueError: Unsupported Python type: typing.Anycrash no longer occurs.arrow_schema_to_python_schemacorrectly returns the original dataclass type (notAny) when the extension type wrapper is present. When a plain Arrow struct (no extension metadata) is passed toarrow_schema_to_python_schema, the converter creates a dynamic TypedDict that round-trips back to the original struct type.Files added
tests/test_core/nodes/test_function_node_dataclass.py— 3 end-to-end pipeline teststests/test_extension_types/test_universal_converter_struct.py— 3 converter-level unit testsFixes ITL-10