-
Notifications
You must be signed in to change notification settings - Fork 19
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
🤓 Record dependencies and result names in the definition after flow validation #551
Conversation
Codecov Report
@@ Coverage Diff @@
## master #551 +/- ##
========================================
- Coverage 75.89% 75.8% -0.1%
========================================
Files 175 175
Lines 9144 9154 +10
========================================
- Hits 6940 6939 -1
+ Misses 1805 1803 -2
- Partials 399 412 +13
Continue to review full report at Codecov.
|
// Validate validates our action is valid and has all the assets it needs | ||
func (a *TransferAirtimeAction) Validate(assets flows.SessionAssets, context *flows.ValidationContext) error { | ||
// Validate validates our action is valid | ||
func (a *TransferAirtimeAction) Validate() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actions now only do structural validation on themselves - they're not responsible for determining if their dependencies exist - we do that centrally
@@ -11,7 +11,7 @@ | |||
} | |||
] | |||
}, | |||
"validation_error": "no such group with UUID '33382939-babf-4982-9395-8793feb4e7c6'" | |||
"validation_error": "missing dependencies: group[uuid=33382939-babf-4982-9395-8793feb4e7c6,name=Climbers]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should never end up being a user facing error.. assuming we track dependencies correctly
a, err := sa.Fields().Get(ref.Key) | ||
|
||
if err != nil { | ||
// TODO for now if a field reference came from an expression (i.e. no name), we don't blow up if it's missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chatted with @nicpottier and we can look at addressing this in the old world but there are just too many flows out there that likely to have expressions referencing fields that don't exist
f.valid = true | ||
f.dependencies = deps | ||
f.resultNames = f.ExtractResultNames() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is threadsafe... it's possible that multiple threads validate this flow object at the same time, but it shouldn't matter
if r != nil && !r.Variable() && !dependenciesSeen[key] { | ||
dependencies = append(dependencies, r) | ||
dependenciesSeen[key] = true | ||
if !utils.IsNil(r) && !r.Variable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #534
flows/actions/start_session.go
Outdated
|
||
// finally check that all the groups exist | ||
return a.validateGroups(assets, a.Groups) | ||
// Validate validates our action is valid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe no-op Validate should be part of BaseAction?
No description provided.