Skip to content

rules analyze: detect unreachable assertions inside quantifiers and when: leaves - #96

Merged
james-d12 merged 1 commit into
mainfrom
feature/nested-unreachable-assertions-44
Oct 13, 2026
Merged

james-d12 merged 1 commit into
mainfrom
feature/nested-unreachable-assertions-44

Conversation

@james-d12

Copy link
Copy Markdown
Owner

Closes #44

Summary

  • RuleSetAnalyzer now checks assertions nested in must_all_match / must_any_match / must_none_match against that quantifier's selector: Produces, recursing for quantifiers nested in quantifiers.
  • when: leaves (through and / or / not) are checked against the rule's target selector.
  • Nested and when: checks walk the raw source document, since only IAssertion.Kind survives parsing; kinds missing from the catalog are skipped silently.
  • UnreachableAssertionIssue gains a Location path (e.g. assertions[0].assertions[1], when.and[1]), printed by rules analyze. Top-level findings are unchanged apart from the added location.
  • The fuzz test NestedMismatch_IsNotFlaggedByAnalyzer... is flipped to NestedMismatch_IsFlaggedByAnalyzer_AndNeverCrashesEvaluation. The generator no longer falls back to a non-guaranteed mismatch, so the assertion is sound.
  • Docs: HIGH_LEVEL_AI_ASSISTING.md §14 known-limitation text and IMPLEMENTATION_STATUS.md updated.

Verification

  • dotnet build: 0 warnings, 0 errors
  • dotnet test: all pass (Analyzers.Repository 1, Configuration 231, Analyzers.Roslyn 49, Evaluation 460, RuleFuzzing 7, Cli 117, Core 54, IntegrationTests 24)
  • dotnet format --verify-no-changes: clean
  • rules test --rules-source examples/rules: 251/251
  • rules analyze --rules-source examples/rules: 0 unreachable assertions (no new findings)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xouw37Lmze9pVQhpCJZKix

…hen: leaves

RuleSetAnalyzer only checked top-level assertions against the target selector's
Produces, so a mismatched kind inside must_all_match/must_any_match/must_none_match
(checked against the nested selector) or inside a when: tree silently failed every
candidate. The parsed model keeps only assertion Kind, so these are now checked
against the raw source document, using CapabilityDescriptor Produces/AppliesTo.

UnreachableAssertionIssue gains a Location path (e.g. assertions[0].assertions[1],
when.and[1]) that the CLI report prints. Top-level behaviour is unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xouw37Lmze9pVQhpCJZKix
@sonarqubecloud

Copy link
Copy Markdown

@james-d12
james-d12 merged commit 983ac56 into main Oct 13, 2026
5 checks passed
@james-d12
james-d12 deleted the feature/nested-unreachable-assertions-44 branch October 13, 2026 19:26
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.

rules analyze: detect unreachable assertions inside quantifiers and when: leaves

1 participant