Replies: 1 comment
-
|
When going through the various alternatives considered here and arriving at the final solution, it was also decided that serializer_idsAre transient and meant ONLY for serialization/de-serialization identifikation. unique_namesAre persistent but are NOT serialized. Is meant to be used for runtime references or identification. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ADR proposal: Dependency Serialization for Parameters
Context
In the corelib library,
Parameterobjects can have dependencies on other parameters through dependency expressions and maps. When serializing these parameters to dictionaries or JSON for persistence, it's crucial to preserve these dependency relationships so they can be accurately reconstructed during deserialization.Requirements
Decision
Implement dependency serialization using a transient
serializer_idattribute onParameterandDescriptorNumberobjects. This attribute serves as a stable identifier during serialization/deserialization cycles and is automatically generated and assigned when aParameter/DescriptorNumbergets used in a dependency.Implementation Details
__serializer_idattribute to variables when they get used in a dependency.__serializer_idvalues instead of object references orunique_namesin the serialized object.__serializer_idas lookup key during deserialization to recreate dependency.__serializer_id, after dependency resolution, using the
_attach_observermethod of the observer_pattern described in Dependent Parameters #121.Alternatives Considered
1. Rely Solely on
unique_nameDescription: Continue using the existing
unique_nameattribute for dependency resolution.Pros:
Cons:
unique_nameconflicts or is modified when using auto-generatedunique_names.Why Not Chosen: Fails requirement for reliable deserialization.
2. Store Full Parameter Objects in Dependencies
Description: Serialize complete parameter objects within dependency maps instead of references.
Pros:
Cons:
Why Not Chosen: Violates JSON compatibility and performance requirements.
3. Use Persistent UUIDs
Description: Assign permanent UUIDs to parameters for identification.
Pros:
Cons:
Why Not Chosen: Fails transient requirement and adds unnecessary persistence overhead.
4. Combining
unique_namewith UUIDsDescription: Append shortened UUIDs to
unique_namesinstead of increasing integer when assigning defaultunique_names.Pros:
Cons:
unique_namesbecomes harder to read, against ADR Suggestion, replace UUIDS with string names in BORG #16unique_namescannot be set by the user if used as serialization idWhy Not Chosen: We want
unique_namesto be easily readable and to be possible to be set by the user: #16.Rationale for Chosen Solution
The transient
__serializer_idapproach provides the best balance of all requirements:Consequences
Positive
Negative
Risks
__serializer_idcollisions if not properly managed (mitigated by UUID generation)Implementation Notes
serializer_idis generated using UUID4 for uniqueness__serializer_idto avoid conflicts with user attributesserializer_idto deserialize.Beta Was this translation helpful? Give feedback.
All reactions