Skip to content

feat(system): add typed show_components columns#160

Open
pesap wants to merge 1 commit into
mainfrom
work/159-add-typed-column-support
Open

feat(system): add typed show_components columns#160
pesap wants to merge 1 commit into
mainfrom
work/159-add-typed-column-support

Conversation

@pesap

@pesap pesap commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #159

Summary

  • Draft PR: not ready to merge until validation and review are complete.
  • Adds public ComponentColumn[T] support for computed System.show_components() columns.
  • Allows show_components() to render selected component fields from a bare string, tuple, or list.
  • Adds filter_func support and clear ISInvalidParameter errors for invalid fields and failed computed-column extractors.
  • Keeps display/table-rendering support in system_info.py, with System.show_components() as a thin public API wrapper.

Acceptance criteria

  • Existing supported calls continue to work: show_components(ComponentType), show_components(ComponentType, show_uuid=True), show_components(ComponentType, show_time_series=True), and show_components(ComponentType, show_supplemental=True).
    • Evidence: test_system_show_components covers the existing call shapes.
  • show_components(ComponentType, "field_name") renders that component field as one additional column.
    • Evidence: test_system_show_components_with_component_fields covers bare string input.
  • show_components(ComponentType, ("field_a", "field_b")) renders multiple additional columns.
    • Evidence: test_system_show_components_with_component_fields covers tuple input.
  • show_components(ComponentType, ["field_a", "field_b"]) renders multiple additional columns.
    • Evidence: test_system_show_components_with_component_fields covers list input.
  • A typed ComponentColumn[T] or equivalent supports computed columns with callable extractors.
    • Evidence: test_system_show_components_with_computed_column covers ComponentColumn[SimpleBus].
  • filter_func is accepted and applied to the same selected component subtype as component_type.
    • Evidence: test_system_show_components_with_filter_func filters SimpleBus rows.
  • Invalid field names raise a clear infrasys exception that identifies the missing column and component involved.
    • Evidence: test_system_show_components_invalid_field_name asserts ISInvalidParameter mentions the field and SimpleBus.
  • Failing computed-column extractors raise a clear infrasys exception that identifies the failing column and component involved.
    • Evidence: test_system_show_components_computed_column_failure asserts ISInvalidParameter mentions the column and component label.
  • Bare strings are treated as one column name, not as an iterable of characters.
    • Evidence: bare string "voltage" renders successfully as a field column.
  • Legacy keyword metadata toggles remain keyword-compatible.
    • Evidence: metadata keyword toggles are preserved and covered with/without selected columns.

Deviations from the original plan

  • uv run mypy src tests still reports unrelated pre-existing errors in supplemental attribute code/tests; touched files pass uv run mypy src/infrasys/system.py src/infrasys/system_info.py tests/test_system.py.

Testing Strategy

uv run pytest tests/test_system.py -k 'show_components or system_info'
uv run ruff check src tests
uv run ruff format src tests --check
uv run mypy src/infrasys/system.py src/infrasys/system_info.py tests/test_system.py
uv run mypy src tests

References

@github-actions github-actions Bot added the tests label Jun 11, 2026
@pesap pesap force-pushed the work/159-add-typed-column-support branch from 3fbac54 to 6e5d1b8 Compare June 11, 2026 16:54
@codecov-commenter

codecov-commenter commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.94%. Comparing base (e3979f2) to head (cba3bc1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
+ Coverage   94.82%   94.94%   +0.11%     
==========================================
  Files          61       62       +1     
  Lines        6072     6176     +104     
==========================================
+ Hits         5758     5864     +106     
+ Misses        314      312       -2     

☔ View full report in Codecov by Harness.
📢 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.

Comment thread src/infrasys/system.py Outdated
Comment thread src/infrasys/system.py Outdated
Comment thread src/infrasys/system.py Outdated
Comment thread src/infrasys/system.py Outdated
Comment thread src/infrasys/system.py Outdated
Comment thread src/infrasys/system.py Outdated
@pesap pesap force-pushed the work/159-add-typed-column-support branch from 6e5d1b8 to fe24cfd Compare June 11, 2026 17:52
@pesap pesap requested a review from daniel-thom June 11, 2026 20:56
@pesap pesap force-pushed the work/159-add-typed-column-support branch from fe24cfd to 54545e2 Compare June 11, 2026 21:04
@pesap pesap marked this pull request as ready for review June 11, 2026 22:28
Comment thread src/infrasys/system_info.py Outdated
@pesap pesap force-pushed the work/159-add-typed-column-support branch from 54545e2 to cba3bc1 Compare June 11, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add typed column support to System.show_components

2 participants