Skip to content

[Lean Squad] feat(fv): Task 2 — informal spec for TreeNodeFilter.MatchFilterPattern#7934

Merged
Evangelink merged 4 commits intomainfrom
lean-squad/task2-treenodefilter-2026-04-27-937a4dc0191e83e2
Apr 30, 2026
Merged

[Lean Squad] feat(fv): Task 2 — informal spec for TreeNodeFilter.MatchFilterPattern#7934
Evangelink merged 4 commits intomainfrom
lean-squad/task2-treenodefilter-2026-04-27-937a4dc0191e83e2

Conversation

@Evangelink
Copy link
Copy Markdown
Member

Extract precise informal specification for MatchFilterPattern, the core Boolean evaluator of the TreeNodeFilter subsystem.

The spec covers:

  • FilterExpression taxonomy (leaf/nop/and/or/not/withProps)
  • Boolean algebra invariants (12 properties: double negation, De Morgan, commutativity, vacuous cases, Nop identity/absorption)
  • Regex semantics for value tokens (* → .*, ** sentinel, escaping)
  • MatchesFilter public entry point postcondition
  • Edge cases (empty bag, URL-encoded slashes, case-insensitive matching)
  • 6 open questions for maintainer review

Advances Target 7 from phase 1 to phase 2.

🔬 Lean Squad — automated FV agent

Fixes #7875

Extract precise informal specification for MatchFilterPattern, the core
Boolean evaluator of the TreeNodeFilter subsystem.

The spec covers:
- FilterExpression taxonomy (leaf/nop/and/or/not/withProps)
- Boolean algebra invariants (12 properties: double negation, De Morgan,
  commutativity, vacuous cases, Nop identity/absorption)
- Regex semantics for value tokens (* → .*, ** sentinel, escaping)
- MatchesFilter public entry point postcondition
- Edge cases (empty bag, URL-encoded slashes, case-insensitive matching)
- 6 open questions for maintainer review

Advances Target 7 from phase 1 to phase 2.

🔬 Lean Squad — automated FV agent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 16:16
@Evangelink
Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

…nodefilter-2026-04-27-937a4dc0191e83e2

# Conflicts:
#	formal-verification/TARGETS.md

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 558f754. The only conflict was in formal-verification/TARGETS.md for target 6 (ResponseFileHelper.SplitCommandLine), where main had advanced it to phase 2 with a PR link — accepted that version.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a formal-verification (FV) Phase 2 informal specification for TreeNodeFilter.MatchFilterPattern, and updates the FV target tracker to reflect the new phase for Target 7.

Changes:

  • Added an informal spec document describing MatchFilterPattern / MatchesFilter semantics, boolean-algebra invariants, and token/regex behavior.
  • Updated formal-verification/TARGETS.md to advance Target 7 from phase 1 → phase 2.
Show a summary per file
File Description
formal-verification/specs/treenodefilter_matchfilterpattern_informal.md New Phase 2 informal specification for the TreeNodeFilter evaluator and related semantics.
formal-verification/TARGETS.md Updates Target 7 status to “Informal spec extracted” (phase 2).

Copilot's findings

Comments suppressed due to low confidence (1)

formal-verification/specs/treenodefilter_matchfilterpattern_informal.md:168

  • This claims NopExpression is "used internally" as a match-anything sentinel, but there are currently no call sites constructing NopExpression in the TreeNodeFilter parser (and a repo-wide search doesn't find new NopExpression(...)). Consider rephrasing this as an observed evaluator case / legacy hook, or explicitly noting that it is currently not constructed by ParseFilter.

3. **NopExpression as always-true sentinel**: Used internally to represent a "match anything" node in the filter tree. Its `evalFilter(nop, ·) = true` property makes it the identity element for `And` and the absorbing element for `Or`.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

@Evangelink
Copy link
Copy Markdown
Member Author

@copilot address review comments

…ter postcondition

Agent-Logs-Url: https://github.com/microsoft/testfx/sessions/00b2d656-9287-4083-8237-bd8df9f9099c

Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

@copilot address review comments

Addressed in cd3b027:

  1. Section 4 taxonomy (lines 41-53): Replaced "five concrete variants" with a clear distinction — 5 concrete C# subclasses (ValueExpression, NopExpression, OperatorExpression, ValueAndPropertyExpression, PropertyExpression) producing 6 semantic evaluation forms (since OperatorExpression covers And/Or/Not). Added an explicit note that PropertyExpression is only valid inside ValueAndPropertyExpression's property sub-tree and is dispatched by MatchProperties, not by the top-level MatchFilterPattern switch.

  2. Section 10 postcondition (lines 150-157): Corrected the postcondition from |segments(path)| ≥ |_filters| to prefix-match semantics — the path may have fewer segments than filters (remaining filters are simply not consulted). The new postcondition uses let n = min(|segments(path)|, |_filters|) and the extra-segments guard is |segments(path)| ≤ |_filters| ∨ last filter is ".*.*". Updated the behavior steps accordingly.

…er postcondition

The MatchesFilter implementation unwraps ValueAndPropertyExpression to
inspect the inner Value when checking for the multi-level wildcard (.*.*).
Update §10 behaviour step 4 and the formal postcondition to reflect this
with an explicit unwrapValue helper.
Copilot AI review requested due to automatic review settings April 30, 2026 09:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

@Evangelink Evangelink merged commit 221e7e4 into main Apr 30, 2026
22 checks passed
@Evangelink Evangelink deleted the lean-squad/task2-treenodefilter-2026-04-27-937a4dc0191e83e2 branch April 30, 2026 14:15
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.

[Lean Squad] feat(fv): Task 2 — informal spec for TreeNodeFilter.MatchFilterPattern

3 participants