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

Consider Flipping Attribute Plan Modifier Algorithm from Top Down to Bottom Up #225

Closed
bflad opened this issue Nov 19, 2021 · 6 comments
Closed
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. schema Issues and pull requests about the abstraction for specifying schemas. thinking

Comments

@bflad
Copy link
Member

bflad commented Nov 19, 2021

Module version

v0.4.2

Description

As mentioned in #224, there can be some reasoning to prefer running attribute plan modifiers bottom up instead of top down which is the algorithm since the attribute plan modifier functionality was introduced. There is likely also good reasoning to also keep the existing algorithm. More complex algorithms like BFT/DFT could potentially be discussed, but this use case probably does not fit well with that type of value traversal nor require that complexity.

This issue is to track some of the analysis and discussion on various use cases, either which way. Some helpful breadcrumbs as a part of this effort may be leaving some additional design or Go documentation on the chosen algorithm and rationale.

References

@bflad bflad added breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. schema Issues and pull requests about the abstraction for specifying schemas. thinking labels Nov 19, 2021
@paddycarver
Copy link
Contributor

My argument for "children first, then parent" is that the parent can then have an accurate view of the children when computing its value. As the children have no view of the parent, I'm unsure of when they would need the parent to be updated before their plan modifier runs.

@bflad
Copy link
Member Author

bflad commented Nov 19, 2021

I guess the optimization that occurs in the situation where a parent may remove children elements isn't the biggest concern. Adding elements is an interesting case because children plan modifiers may contain default values and such, I'm not sure how often that would occur in real world usage or how that would be resolved if the parent was resolved after children.

@bflad
Copy link
Member Author

bflad commented Nov 22, 2021

Another drive-by thought: what should the error handling behavior be? Currently, any failed plan modifier is able to prevent further attribute plan modifier and nested attribute plan modifiers from executing since the parent logic exits early. If the logic is flipped around, the framework would need to check that an error is a child attribute path, so as to not prevent execution of other (unrelated) attribute plan modifiers.

@paddycarver
Copy link
Contributor

Would it, though? In the event of an error, no plan will be produced anyways. So we could always say that the first error returned during plan modification will terminate all plan modification. We'd also need to be careful, in that situation, of cascading errors; e.g., an error in a child (or unrelated parent) meaning that another plan modifier wouldn't know how to handle that value as input.

@bflad
Copy link
Member Author

bflad commented Aug 29, 2022

Closing this out for now, it's unlikely to be discussed more or changed before the first major version with compatibility promises.

@bflad bflad closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change This PR introduces a breaking change or the resolution of this issue may require a breaking change. schema Issues and pull requests about the abstraction for specifying schemas. thinking
Projects
None yet
Development

No branches or pull requests

2 participants