Skip to content

Create/update superseded_by references when submitting WorkflowExecutions and their DataObjects - #1403

Merged
eecavanna merged 19 commits into
1333-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-upon-metadata-deletionfrom
1332-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-on-metadata-submission
Mar 18, 2026
Merged

eecavanna merged 19 commits into
1333-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-upon-metadata-deletionfrom
1332-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-on-metadata-submission

Conversation

@eecavanna

@eecavanna eecavanna commented Mar 12, 2026 •

Copy link
Copy Markdown
Collaborator

Note

🌳 The base branch of this pull request is NOT main. 🌳

On this branch, I updated the POST /workflows/workflow_executions API endpoint so that it creates/updates/deletes the superseded_by references when submitting WorkflowExecutions and DataObjects.

Details

I have not added tests yet—I'll add those after merging this into the other feature branch (which is about WFE deletion, as opposed to WFE submission), https://github.com/microbiomedata/nmdc-runtime/tree/1333-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-upon-metadata-deletion.

Related issue(s)

Fixes #1332

Related subsystem(s)

  • Runtime API (except the Minter)
  • Minter
  • Dagster
  • Project documentation (in the docs directory)
  • Translators (metadata ingest pipelines)
  • MongoDB migrations
  • Other

Testing

  • I tested these changes (explain below)
  • I did not test these changes

I have not tested these changes yet. I will do so on the base branch (which is not main).

Documentation

  • I have not checked for relevant documentation yet (e.g. in the docs directory)
  • I have updated all relevant documentation so it will remain accurate
  • Other (explain below)

Maintainability

  • Every Python function I defined includes a docstring (test functions are exempt from this)
  • Every Python function parameter I introduced includes a type hint (e.g. study_id: str)
  • All "to do" or "fix me" Python comments I added begin with either # TODO or # FIXME
  • I used black to format all the Python files I created/modified
  • The PR title is in the imperative mood (e.g. "Do X") and not the declarative mood (e.g. "Does X" or "Did X")

@eecavanna
eecavanna changed the base branch from main to 1333-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-upon-metadata-deletion March 12, 2026 07:33
@eecavanna
eecavanna marked this pull request as ready for review March 18, 2026 20:23
@eecavanna
eecavanna requested a review from Copilot March 18, 2026 20:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the POST /workflows/workflow_executions endpoint to automatically manage superseded_by links when submitting WorkflowExecution records and their associated DataObject outputs, aligning submission-time behavior with the schema’s supersession model.

Changes:

  • Add submission-time logic to infer predecessor/successor WFEs from versioned WFE IDs and update superseded_by on WFEs and output DataObjects.
  • Add library helpers for parsing WFE IDs, deriving predecessor/successor IDs, building regex patterns, and bulk-updating DataObject.superseded_by.
  • Expand endpoint request body schema metadata (FastAPI Body(...) title/description/examples) and add instrumentation via duration_logger.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
nmdc_runtime/api/endpoints/workflows.py Implements supersession-chain updates during WFE submission and enhances request-body schema metadata.
nmdc_runtime/api/endpoints/lib/workflow_executions.py Introduces helper utilities for WFE ID parsing/derivation and updating DataObject.superseded_by.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread nmdc_runtime/api/endpoints/workflows.py Resolved
Comment thread nmdc_runtime/api/endpoints/workflows.py Resolved
Comment thread nmdc_runtime/api/endpoints/workflows.py Resolved
Comment thread nmdc_runtime/api/endpoints/workflows.py Resolved
Comment thread nmdc_runtime/api/endpoints/workflows.py Resolved
Comment thread nmdc_runtime/api/endpoints/workflows.py Resolved
Comment on lines +288 to +295
submitted_wfe["superseded_by"] = successor_wfe_id
update_superseded_by_field_of_data_objects_having_id_in_list(
data_object_ids=submitted_wfe.get("has_output", []),
data_object_list=submitted_dobjs,
data_object_set_collection=data_object_set,
superseded_by=successor_wfe_id,
client_session=None,
)
Comment on lines +324 to +327
workflow_execution_set.update_one(
{"id": predecessor_wfe_id},
{"$set": {"superseded_by": submitted_wfe_id}},
)
@eecavanna
eecavanna merged commit 537f0fe into 1333-modify-applicable-workflowexecution-and-dataobject-records-with-superseded_by-upon-metadata-deletion Mar 18, 2026
2 checks passed
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.

Modify applicable WorkflowExecution and DataObject records with superseded_by on metadata submission

2 participants