Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain id and other top-level attributes in merge_property_trees #364

Merged
merged 6 commits into from
Nov 21, 2024

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Nov 18, 2024

This PR updates merge_property_trees to retain the schema id (and other "top level" items/attributes). This fixes the issue where model.schema["id"] does not match the "id" of the schema (see #308).

This PR also drops the use of OrderedDict fixing #40.

Finally the CI goblins revealed that shuffling order of tests can cause test_defined_models_up_to_date to fail:
https://github.com/spacetelescope/stdatamodels/actions/runs/11901768169/job/33165405951
if executed after test_model_with_nonstandard_primary_array which defines a test model class that isn't prefixed with _. This PR adds a _ prefix to the test class to avoid this intermittent issue.

Fixes: https://jira.stsci.edu/browse/JP-2137
Closes #308
Closes #40

Regression tests: https://github.com/spacetelescope/RegressionTests/actions/runs/11914331392
produce 5 "failures" which look like improvements to me. The failures are in the niriss ami tests:

        Headers contain differences:
         Keyword          has different values:
            a> AMI OIFITS analysis data model
            b> OIFITS required meta data (not otherwise defined in core.schema)

Since this PR retains the top level schema items this is keeping the title from the datamodel schema:


which in the truth file ends up being overwritten by the referenced oifits schema:
title: OIFITS required meta data (not otherwise defined in core.schema)

Keeping the datamodel schema title seems preferable.

Tasks

  • update or add relevant tests
  • update relevant docstrings and / or docs/ page
  • Does this PR change any API used downstream? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • run jwst regression tests with this branch installed ("git+https://github.com/<fork>/stdatamodels@<branch>")
news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.misc.rst: infrastructure or miscellaneous change

@braingram braingram changed the title Schema Retain id and other top-level attributes in merge_property_trees Nov 18, 2024
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.56%. Comparing base (1e16207) to head (3aad51e).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #364      +/-   ##
==========================================
+ Coverage   67.52%   67.56%   +0.03%     
==========================================
  Files         114      114              
  Lines        5916     5919       +3     
==========================================
+ Hits         3995     3999       +4     
+ Misses       1921     1920       -1     

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


🚨 Try these New Features:

@braingram braingram marked this pull request as ready for review November 19, 2024 13:09
@braingram braingram requested a review from a team as a code owner November 19, 2024 13:09
@braingram braingram marked this pull request as draft November 19, 2024 13:09
@braingram braingram marked this pull request as ready for review November 19, 2024 15:05
@braingram braingram requested a review from emolter November 19, 2024 15:07
Copy link
Contributor

@emolter emolter left a comment

Choose a reason for hiding this comment

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

Looks good, just two small comments

changes/364.bugfix.rst Outdated Show resolved Hide resolved
src/stdatamodels/schema.py Show resolved Hide resolved
@braingram
Copy link
Collaborator Author

I'm going to wait to merge and okify this until tomorrow.

@braingram
Copy link
Collaborator Author

@braingram braingram merged commit 4ea7d91 into spacetelescope:main Nov 21, 2024
22 checks passed
@braingram braingram deleted the schema_id branch November 21, 2024 14:42
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.

top-level in-memory schema has wrong id merge_property_trees should use dict instead of OrderedDict
2 participants