enhancement
major
minor
major
minor
major
#29634
TL Views: the configuration editor builds a text field for a property whose format is parse-only, so selecting a derived attribute in the model editor fails with "There is no normative way to serialize a locator configuration"
Problem
Selecting an attribute of a class in the model editor (admin/model/model-editor.view.xml, React admin hub) reports the error
There is no normative way to serialize a locator configuration.
when the attribute is a derived one whose storage algorithm is an ExpressionEvaluationAlgorithm. The attribute detail form cannot be shown for such an attribute, whichever selector writes it to the selectedPart channel (the class diagram, the class's attribute table).
Stack (excerpt):
java.lang.UnsupportedOperationException: There is no normative way to serialize a locator configuration. at com.top_logic.element.meta.expr.ExpressionEvaluationAlgorithm$Config$LocatorFormat.getSpecificationNonNull(ExpressionEvaluationAlgorithm.java:99) at com.top_logic.basic.config.AbstractConfigurationValueProvider.getSpecification(AbstractConfigurationValueProvider.java:69) at com.top_logic.layout.configedit.ConfigFormatFieldModel.format(ConfigFormatFieldModel.java:146) at com.top_logic.layout.configedit.ConfigFormatFieldModel.<init>(ConfigFormatFieldModel.java:57) at com.top_logic.layout.configedit.ConfigControlService.createModel(ConfigControlService.java:330) at com.top_logic.layout.configedit.ConfigEditorControl.<init>(ConfigEditorControl.java:249) ... at com.top_logic.layout.configedit.ConfigListEditorControl.<init>(ConfigListEditorControl.java:234) at com.top_logic.layout.view.form.AnnotationsFieldControlProvider.buildEditor(AnnotationsFieldControlProvider.java:197) ... at com.top_logic.layout.view.channel.DerivedViewChannel.recompute(DerivedViewChannel.java:241)
Analysis
The annotations field of the attribute form opens the React configuration editor (com.top_logic.layout.configedit) on the attribute's annotations. For the DerivedStorage annotation it descends into the storage algorithm, ExpressionEvaluationAlgorithm.Config, whose property expr (a PolymorphicConfiguration<? extends AttributeValueLocator>) is annotated with the compact LocatorFormat. That format only parses: getSpecificationNonNull() throws, and isLegalValue() answers false for every value.
ConfigControlService.createModel() chooses a ConfigFormatFieldModel - a text field showing the value through its format - as soon as the property has a value provider, without asking whether the provider can serialize the current value. The framework's own writer decides differently: ConfigurationWriter calls isLegalValue(value) first and writes the value in its structured form when the format cannot express it. The editor lacks that fallback, so a parse-only format (or any value the format cannot express) fails while constructing the field model.
Solution
ConfigControlService.createModel() uses the format field model only when the property's value provider answers isLegalValue() for the property's current value, and falls back to the structured ConfigFieldModel (the item editor) otherwise - the same decision ConfigurationWriter makes. A unit test in com.top_logic.layout.configedit covers a property with a parse-only format. The attribute detail form of the model editor for a derived attribute is the test bed.