Make public data immutable
As a part of sealing up the sandbox[0], public data needs to be made
immutable for a number of reasons:
- Manipulation of public data with python code adds a significant
risk that public data is not deterministic.
- Various plugins have been reading public data at initialization time,
in advance of the build phase where they are allowed to read it off of
dependencies, this means that currently we have plugins reading invalid
(pre-mutation) public data from dependencies and thus creating
unpredictable results.
Summary of changes:
o element.py:
- Remove the `__dynamic_public` member, and use only the `__public`
member for storing public data.
- Continue to support loading public data from the artifact for the
purpose of ArtifactElement (ability to observe public data when
loading the artifacts in `bst artifact` commands).
- Make `Element.set_public_data()` private/internal (we still need to
use it elsewhere).
o filter.py (element plugin):
- Refactor this plugin to use the new `configure_dependencies()` in order
to parse the filter element, hold on to the filter element throughout
the plugin lifetime in order to simplify the plugin.
- Change how we support the `pass-integration` configuration.
Public data is now immutable publicly but we still need to automatically
mutate the filter element's intergration commands at load time.
Instead of waiting for the build phase like before, now we do it
immediately at load time.
This is done early because reverse dependencies are allowed to read
the public data immediately at load time, so we must provide stable
public data immediately, before reverse dependencies ever get a chance
to observe it.
o tests/elements/filter.py: Removed a test which was asserting the ability
of plugins to mutate public data, this is no longer allowed and the API
is now removed.
[0]: https://lists.apache.org/thread.html/r3eb2dce3561cb46ac80c859b14aafb2471aaf3e319a39f70475fe22a%40%3Cdev.buildstream.apache.org%3E
5 files changed