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

Yet another approach to type safe step parameters #1562

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

pshapiro4broad
Copy link
Member

Yet another approach to type safe step parameters. This uses field annotations and some step wrapper code that copies map entries to/from step fields. Note that this doesn't require changing all steps, since its use of FlightMap is transparent to Stairway and the net effect is the same as if the step called put() and get() directly.

Reviving these changes from 2021 after a conversation with @nmalfroy

…notations and some step wrapper code that copies map entries to/from step fields. Note that this doesn't require changing all steps, since its use of FlightMap is transparent to Stairway and the net effect is the same as if the step called `put()` and `get()` directly.
…-map-2

# Conflicts:
#	src/main/java/bio/terra/service/filedata/flight/delete/DeleteFileAzureDirectoryStep.java
# Conflicts:
#	src/main/java/bio/terra/app/controller/DatasetsApiController.java
#	src/main/java/bio/terra/service/dataset/flight/create/CreateDatasetAssetStep.java
#	src/main/java/bio/terra/service/dataset/flight/datadelete/DataDeletionStep.java
#	src/main/java/bio/terra/service/dataset/flight/delete/DeleteDatasetAuthzResource.java
#	src/main/java/bio/terra/service/filedata/flight/delete/DeleteFileAzureDirectoryStep.java
#	src/main/java/bio/terra/service/snapshot/flight/create/CreateSnapshotMetadataStep.java
#	src/main/java/bio/terra/service/snapshot/flight/create/CreateSnapshotPrimaryDataAssetGcpStep.java
#	src/main/java/bio/terra/service/snapshot/flight/create/CreateSnapshotPrimaryDataRowIdsStep.java
#	src/main/java/bio/terra/service/snapshot/flight/delete/DeleteSnapshotMetadataStep.java
@rtitle
Copy link

rtitle commented Jan 4, 2024

I really like the type safe step parameters. Is it possible the annotations, BaseStep, StepUtils could be folded into TCL or even stairway itself?

@pshapiro4broad
Copy link
Member Author

I really like the type safe step parameters. Is it possible the annotations, BaseStep, StepUtils could be folded into TCL or even stairway itself?

@rtitle Sure, I was thinking that we'd first prove out its utility in TDR and then add it to TCL or Stairway. Since it can be used alongside existing steps it could be put in stairway without breaking compatibility.

Copy link

sonarcloud bot commented Jan 4, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

14 New issues
0 Security Hotspots
66.9% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Feb 6, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

6 New issues
0 Security Hotspots
69.3% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

statusCode = HttpStatus.OK;
}

protected FlightContext getContext() {
Copy link
Member Author

Choose a reason for hiding this comment

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

I kept this around in case it's needed but in general steps that use this API shouldn't need to access the context directly.

throw new IllegalGetException(e);
}
if (value == null) {
// An unset output can occur if an exception is thrown inside the run() operation.
Copy link
Member Author

Choose a reason for hiding this comment

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

Thinking about this again, maybe instead the code shouldn't write outputs to the map if an exception occurs. Stairway might store flight context data even on error, but that doesn't seem like something we should ever count on.

# Conflicts:
#	src/test/java/bio/terra/service/snapshot/flight/CreateSnapshotMetadataStepTest.java
#	src/test/java/bio/terra/service/snapshot/flight/authDomain/AddSnapshotAuthDomainSetResponseStepTest.java
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.

2 participants