Drop file-only systemProperties from the investigator node - #36
Open
eastagiletracker wants to merge 1 commit into
Open
Drop file-only systemProperties from the investigator node#36eastagiletracker wants to merge 1 commit into
eastagiletracker wants to merge 1 commit into
Conversation
investigator is an administrative node, but it listed file_state and error_type as systemProperties without defining either under properties, so resolving its system properties against its schema raised KeyError: 'file_state'. Only data_file/index_file nodes carry those two, and they define them via _definitions.yaml#/data_file_properties. Adds test_system_properties_are_defined to cover every node, and switches the two yaml.load() calls in schema_test.py to yaml.safe_load() so the module can still be imported under PyYAML 6, where load() requires an explicit Loader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes dropping the two file-only
systemPropertiesthat theinvestigatornode declares but never defines. We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/399. You can sign in with your GitHub ID to claim ownership of the project.What is wrong and what changed
gdcdictionary/schemas/investigator.yamlis anadministrativenode, but itssystemPropertieslist carriesfile_stateanderror_type— the two fields that onlydata_file/index_filenodes have, and that those nodes define by pulling in_definitions.yaml#/data_file_properties.investigatordefines neither, so the node advertises system fields that do not exist in its schema. It also setsadditionalProperties: false, so aninvestigatorrecord could never carry either value in the first place.Reproduced on
masterat918dcd1with the dictionary as it is loaded bygdcdictionary/__init__.py:Any consumer that walks a node's system properties and looks them up in its schema hits that —
dictionaryutils' ownschema_test.add_system_propsdoes exactly this lookup, so it raisesKeyErrorfor anyinvestigatorentity rather than validating it.investigatoris the only one of the 51 nodes with this mismatch; every otheradministrativenode lists exactlyid,project_id,created_datetime,updated_datetime,state.The change removes those two entries from
investigator.yamland addstest_system_properties_are_definedtogdcdictionary/schema_test.py, which asserts across every node that each entry insystemPropertiesis defined underproperties. On the unmodified schema that test fails withEntity 'investigator' has 'file_state' as a system property but not property; with the fix, all four tests in the module pass. Nothing behavioural is removed: the two fields were unusable on this node.One thing was needed to make that test runnable at all — the two
yaml.load()calls inschema_test.pyraiseTypeError: load() missing 1 required positional argument: 'Loader'under PyYAML 6, so the module cannot even be imported there; they are nowyaml.safe_load(), which behaves the same for these schema files.Verification, run before and after on the same tree:
The
uc-cdis/dictionaryutilschecks your CI runs against this dictionary are unchanged at 18 passed before and after (tests/test_schema_rules.py,tests/test_required_fields.py,tests/test_required_links.py,tests/test_required_properties.py), andbin/dump_schema.pystill emits the same 52-entryartifacts/schema.json, withinvestigator.systemPropertiesnow listing only the five fields the node actually defines.How this was managed
This work was tracked as a single story, https://eastagiletracker.com/projects/399/stories/330482, on a board imported from this repository's own issues and pull requests (35 stories) and used to manage the change end to end: https://eastagiletracker.com/projects/399
If you'd rather not receive contributions like this, reply
no-more-prson this pull request and we won't open any further ones on your repositories.Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com