-
Notifications
You must be signed in to change notification settings - Fork 30
fix: refactor switch action to fix #1927 #1931
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
Conversation
Configuration & Behavioral Changes: - Remove `scope` from the switch action. `property` now references the full context. Scopes should be included in the property, eg `request.jobParams` or `datasets[*].datasetlifecycle`. - Add `phase` configuration to control whether the switch applies during validate, performJob, or all phases. - Fall through to the default case if the property doesn't match anything - Datasets can be accessed in create jobs during the performJob phase Implementation Changes: - Remove SwitchCreateJobAction. SwitchJobAction is used for both update and create operations. - Type checks for SwitchJobActionOptions is more rigorous - Update unit tests
Importantly, this makes dataset properties available to update jobs in the validate phase. It does have the downside of potential confusion where `job.statusCode` (and other updatable fields) could change values between the validate and perform phases, but actions should then use `request.statusCode`, which will have a stable value.
I am working on updating docs. |
For the naming of the phases, I would still vote for validate / perform (or performJob if you would prefer to keep it as it currently is). |
I like @despadam's suggestion of validate/perform phases. I've updated to use those. SciCatProject/documentation#73 corresponds to #1914, which has already merged. I need to incorporate your changes and merge that. Afterwards I will add documentation of the #1931 changes. |
<!-- Follow semantic-release guidelines for the PR title, which is used in the changelog. Title should follow the format `<type>(<scope>): <subject>`, where - Type is one of: build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|BREAKING CHANGE - Scope (optional) describes the place of the change (eg a particular milestone) and is usually omitted - subject should be a non-capitalized one-line description in present imperative tense and not ending with a period See https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines for more details. --> ## Description <!-- Short description of the pull request --> - #1954 - #1913 - #1931 - #1934 ## Motivation <!-- Background on use case, changes needed --> - #1937 - #1776 (topic 2) - #1927 ## Fixes <!-- Please provide a list of the issues fixed by this PR --> ## Changes: <!-- Please provide a list of the changes implemented by this PR --> ## Tests included - [ ] Included for each change/fix? - [ ] Passing? <!-- Merge will not be approved unless tests pass --> ## Documentation - [ ] swagger documentation updated (required for API changes) - [ ] official documentation updated ### official documentation info <!-- If you have updated the official documentation, please provide PR # and URL of the updated pages -->
Description
This refactors the switch action considerably to support dataset and job properties in more circumstances, fixing #1927.
Configuration Changes:
scope
from the switch action.property
now references the full context. Scopes should be included in the property, egrequest.jobParams
ordatasets[*].datasetlifecycle
(note the wildcard json path, required for arrays).phase
configuration to control whether the switch applies during validate, perform, or all phases.performJob
toperform
in thelog
action to match the switch phaseBehavioral Changes:
Motivation
Previously the switch property always applied to both phases, and threw an error if the property was not found. The validate phase only was able to switch over request properties. This was particularly limiting for update operations, since the request DTO doesn't overlap much with the job, so it wasn't possible to access most properties (eg any datasets). This provides significantly more flexibility.
Fixes
switch
action to work with more properties (Support switching on dataset properties in update actions #1927)Changes:
switch
andlog
actions have different options.Tests included
Documentation
official documentation info
SciCatProject/documentation#75