Skip to content

fix(assertion-eval): has() matches features (v0.9.x bug closeout)#217

Open
avrabe wants to merge 2 commits into
mainfrom
fix/v0.9.x-has-features
Open

fix(assertion-eval): has() matches features (v0.9.x bug closeout)#217
avrabe wants to merge 2 commits into
mainfrom
fix/v0.9.x-has-features

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 13, 2026

Summary

  • has('name') in the assertion DSL only matched component properties; it now also matches features (ports, bus access, parameters, etc.) by name.
  • Bare names (no ::) are checked against both the property namespace and the component's feature list; qualified names (set::name) still resolve against properties only.
  • Three new unit tests added: has_matches_feature_by_name, has_feature_name_absent_returns_false, has_feature_all_fails_when_partial.
  • Artifacts: REQ-HAS-FEATURES (requirement) + TEST-HAS-FEATURES (verification) added; rivet validate passes.

Minimal working example

Before fix — assertion always returned false even though sensor_out exists:

components.where(category == 'thread').any(has('sensor_out'))
# → Bool(false)  ← wrong

After fix:

components.where(category == 'thread').any(has('sensor_out'))
# → Bool(true)   ← correct

Test plan

  • cargo test -p spar --bin spar -- assertion::tests — 46 tests pass (3 new)
  • cargo test -p spar — full suite green
  • cargo clippy -p spar — no warnings
  • rivet validate — PASS (99 pre-existing warnings, no errors)

Closes v0.9.x bug: has() operator did not match features.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

The has() predicate in the assertion DSL previously only checked component
properties. It now also checks feature names (ports, bus access, etc.),
so has('sensor_out') correctly returns true when the component owns a
feature by that name. Bare names (no '::' separator) are matched against
both the property namespace and the feature namespace; qualified names
(set::name) continue to resolve against properties only.

Three new unit tests cover: feature found, feature absent, all() partial match.
Artifacts updated: REQ-HAS-FEATURES + TEST-HAS-FEATURES.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@avrabe avrabe enabled auto-merge (squash) May 13, 2026 16:34
# Conflicts:
#	artifacts/requirements.yaml
#	artifacts/verification.yaml
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.

1 participant