Skip to content

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

Merged
avrabe merged 4 commits into
mainfrom
fix/v0.9.x-has-features
May 14, 2026
Merged

fix(assertion-eval): has() matches features (v0.9.x bug closeout)#217
avrabe merged 4 commits into
mainfrom
fix/v0.9.x-has-features

Conversation

@avrabe

@avrabe avrabe commented May 13, 2026

Copy link
Copy Markdown
Contributor

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
No behavior change.

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

codecov Bot commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/spar-cli/src/assertion/mod.rs 92.85% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

# Conflicts:
#	artifacts/requirements.yaml
#	artifacts/verification.yaml
#	crates/spar-cli/src/assertion/mod.rs
@avrabe avrabe merged commit 33fad21 into main May 14, 2026
30 of 32 checks passed
@avrabe avrabe deleted the fix/v0.9.x-has-features branch May 14, 2026 10:04
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