Materialise optional KR workflow outputs - #298
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the represented KR materialisation workflows so that optional initialiser outputs are always materialised into workflow context (as null) when writes_context_keys enforcement is enabled, preventing metadata validation from failing due to missing keys. It also propagates the resulting authority/seed updates into the spreadsheet programme workflow seed bundle and adds a targeted regression test around workflow_control.context_set + post-action metadata validation.
Changes:
- Materialise previously-omitted optional KR initialiser outputs by removing
skip_if_unresolvedso unresolved values are written asnull. - Bump KR workflow seed version to
"2"and propagate updated dependency SHA/fingerprint and seed version"15"in the spreadsheet programme seed bundle. - Add a regression test that executes the represented
context_setassignments and validates enforcedwrites_context_keyspost-action metadata.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/backend/test_kr_materialisation_workflow_vontology_service.py | Adds regression test coverage ensuring optional initialiser fields satisfy enforced writes_context_keys via context_set + post-action validation. |
| src/backend/workflows/repo_seed_bundles/kr_materialisation_workflow_seed_bundle.json | Removes skip_if_unresolved from optional initialiser assignments so inactive optional outputs are written as null; bumps seed version to "2". |
| src/backend/workflows/repo_seed_bundles/spreadsheet_programme_representation_workflow_seed_bundle.json | Updates KR dependency payload SHA/seed version and regenerates authority fingerprint; bumps spreadsheet seed version to "15". |
| scripts/generate_spreadsheet_programme_workflow_seed.py | Updates generator seed version to "15" to match the regenerated spreadsheet seed bundle. |
Comment on lines
+69
to
+81
| workflow = next( | ||
| row | ||
| for row in bundle.get("workflows") or [] | ||
| if isinstance(row, Mapping) and row.get("workflow_id") == workflow_id | ||
| ) | ||
| publication_spec = workflow.get("publication_spec") | ||
| assert isinstance(publication_spec, Mapping) | ||
| return next( | ||
| row | ||
| for row in publication_spec.get("steps") or [] | ||
| if isinstance(row, Mapping) and row.get("state_id") == state_id | ||
| ) | ||
|
|
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.
Outcome
Make the generic KR concept and relationship initialisers compatible with enforced
writes_context_keysmetadata by materialising inactive optional outputs asnullrather than omitting them.Root cause
The guarded plan produced valid
reuse_existingconcept specs, but every concept-item child failed immediately afterworkflow_control.context_set: optional create/blocker fields usedskip_if_unresolvedwhile also being declared as mandatory writes. Metadata enforcement rejected the absent keys before routing or any Vontology tool call.Authority propagation
Safety
Null-aware route predicates remain unchanged: inactive branch values exist as
null, andcontext_is_nullcontinues to prevent the wrong branch.Validation
context_setassignments and enforced post-action metadata validation for reuse, create, and relationship paths.Jira: JVNAUTOSCI-2592