Skip to content

Report a Behavior Annex property reference that has no value 🤖 - #3214

Merged
lwrage merged 2 commits into
3208_reject_nonconstant_array_sizefrom
3211_reject_valueless_property_reference
Sep 11, 2026
Merged

Report a Behavior Annex property reference that has no value 🤖#3214
lwrage merged 2 commits into
3208_reject_nonconstant_array_sizefrom
3211_reject_valueless_property_reference

Conversation

@lwrage

@lwrage lwrage commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #3211

Cause and correction

The first AS5506/3 Rev A D.7 property_reference alternative writes a property value name after # with nothing before it, so the reference names a property definition without naming anything that holds a value for it. The only value it can denote is the default value of the property.

DeclarativeToStrictTranslator.toPropertyReference substitutes Property.getDefaultValue() into the first property name holder when the property has one, and leaves the Property itself there when it does not. No strict checker constrains that state, so such a reference was accepted and the translated model carried a reference with nothing behind it.

BehaviorAnnexValidator.checkPropertyReferenceValues walks the strict annex for PropertySetPropertyReference, the translation of that alternative, and reports each one whose first property name holder still holds a Property — which is exactly the case where there was no default value to substitute. A reference that names a property type is untouched, since an enumeration literal is a value of its own, so #Ps::enum_type.enabled keeps validating clean.

The check does not gate the strict checkers. The strict model does carry the reference, unlike the constructs the neighboring checks reject, so gating would have suppressed unrelated diagnostics; while the rule was gating, aadlBaTest007 lost two pre-existing "resolved behavior annex holder has no element" errors. They are retained.

The removed ANTLR resolver rejected part of this case: AadlBaNameResolver.propertyDeclarationResolver returned false as soon as getDefaultValue() was null, which failed resolution when a record field was selected. A bare name with no field, and a range bound on a range property, were accepted then as they were before this change.

Regression model and assertion

ba/org.osate.ba.tests/models/issue3211/Issue3211.aadl reads two properties through that alternative, in an assignment rather than an array size, since the rule is about property references and not about array dimensions:

  • value := # Thread_Properties::Priorityinherit aadlinteger with no default value, so the reference denotes nothing.
  • value := # Communication_Properties::Queue_Size — has a default value, which is what its reference denotes.

Issue3211Test requires exactly one issue, so it pins both the error on the first reference (severity, the source range # Thread_Properties::Priority, and the message naming the property) and that the defaulted reference stays legal. Before the fix it failed with [] expected:<1> but was:<0>; the regression commit records that same behavior in the corpus goldens as an empty validated diagnostics projection, so the fix shows up as the diagnostic appearing.

Two corpus models already wrote references of this shape and now report it, both reviewed as genuine:

  • models/covering_syntax/aadlBaTest007.aadl — ten references in the section the model itself marks -- with default value not defined.
  • models/characterization/HolderCoverage.aadl#Issue2445_Holder_Properties::record_property.omitted, a record property with no default value. Its holder coverage is unaffected: the resolved-model golden is unchanged and the characterization test still instantiates the same holder classes.

Validation

Clean root reactor, run outside the sandbox:

mvn -s releng/osate.releng/settings.xml -Plocal -T5 \
  -Dtycho.localArtifacts=ignore -Dpr.build=true -Dsign=false \
  -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false \
  -DfailIfNoTests=false clean install

BUILD SUCCESS, 143 modules, no failures or errors. org.osate.ba.tests: 120 tests, 0 failures, 5 pre-existing conformance skips, including Issue3211Test (1) and Issue3210Test (4). Goldens verified with regeneration off after regenerating.

Dependencies and merge order

Based on 3208_reject_nonconstant_array_size (PR #3213), not on master, and targeted at that branch so the diff shows only the two commits here. The dependency is the new corpus model: its resolved-model golden records the BehaviorArraySize shape that PR #3213 introduces, so basing this on master would leave a stale golden as soon as #3213 merges.

Merge #3213 first, then retarget this PR to master.

Residual risk

  • The rule fires on eleven references across two existing corpus models. They are defects by the rule's own reasoning, but they are also the models that cover this syntax, so a future change to those models has to keep the coverage while satisfying the rule.
  • The condition reads the first property name holder rather than resolving the property independently, so it depends on toPropertyReference continuing to substitute the default value there. A change to that substitution would silently change this rule.

🤖 Generated with Claude Code

@lwrage
lwrage added this pull request to stack #3215 September 11, 2026 14:50
@lwrage
lwrage force-pushed the 3211_reject_valueless_property_reference branch from eeb7d7f to 7f41cfc Compare September 11, 2026 16:35
sei-lwrage and others added 2 commits September 11, 2026 12:52
The model reads two properties through the AS5506/3 Rev A D.7 property
reference alternative that names no element. Thread_Properties::Priority
has no default value, so that reference denotes nothing; the assertion
requires one error on it, naming the property and the reference as
written. Communication_Properties::Queue_Size has a default value, which
is the value its reference denotes, so requiring exactly one issue also
pins that the defaulted reference stays legal.

The reference is read in an assignment rather than an array size, since the
rule is about property references and not about array dimensions.

The regression fails today with no issue reported at all. The corpus
goldens record that same current behavior, with an empty validated
diagnostics projection, so the fix shows as the diagnostic appearing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The AS5506/3 Rev A D.7 property reference alternative that names no
element can only denote the default value of the property it names.
Translation puts that default in the first property name holder, and
leaves the property definition there when the property has none, which
denotes no value at all. No strict checker constrains that, so such a
reference was accepted and the translated model carried a reference with
nothing behind it.

Report each one on the reference as written, naming the property. A
reference that names a property type is untouched, since an enumeration
literal is a value of its own. The check does not gate the strict
checkers: the strict model does carry the reference, unlike the constructs
the neighboring checks reject, so the checkers keep their model and
whatever else they have to say about it.

Two corpus models already wrote references of this shape and now report
it: covering_syntax/aadlBaTest007.aadl in the section it marks as having no
default value defined, and characterization/HolderCoverage.aadl for a
record property with no default value. Neither model loses translation
coverage; HolderCoverage still instantiates the same holder classes.

Fixes #3211

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lwrage
lwrage force-pushed the 3211_reject_valueless_property_reference branch from 7f41cfc to a23d79c Compare September 11, 2026 16:52
@lwrage
lwrage merged commit 817cb70 into master Sep 11, 2026
1 check passed
@lwrage
lwrage deleted the 3211_reject_valueless_property_reference branch September 11, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behavior Annex accepts a property reference to a property that has no value 🤖

2 participants