Skip to content

feat: allow nested condition tree - #2029

Merged
arnaud-moncel merged 2 commits into
mainfrom
feat/nested-condition-tree
Nov 6, 2026
Merged

arnaud-moncel merged 2 commits into
mainfrom
feat/nested-condition-tree

Conversation

@arnaud-moncel

@arnaud-moncel arnaud-moncel commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Definition of Done

Fixes PRD-1171

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

Note

Support nested condition trees and advertise canUseNestedConditionTree capability

  • ConditionTreeParser.fromPlainObject now uses a recursive parse method so nested groups stay nested instead of being flattened. Empty root groups remain valid, but empty nested groups are rejected with a validation error.
  • The parser's isLeaf and isBranch guards no longer treat null input or non-array conditions as valid shapes; these now hit the invalid-tree error path.
  • FilterGenerator.computeMatch in filter.ts handles empty branches: an empty Or produces a match-none expression, and an empty And produces no restriction.
  • The capabilities route reports canUseNestedConditionTree: true so clients can detect the new behavior.
  • Adds unit tests for the parser and integration tests for MongoDB and Sequelize list filtering with nested and empty branches.
  • Behavioral Change: filters that previously flattened or accepted empty nested groups now either throw a ValidationError (see parse in condition-tree-parser.ts) or match differently for empty Or/And branches.

Changes since #2029 opened

  • Wrapped the ConditionTreeParser.fromPlainObject call in AuthorizationService.getScope in a try/catch block that throws an UnprocessableError when scope parsing fails. [e7d2070]

Macroscope summarized fcaa8a3.

@qltysh

qltysh Bot commented Oct 22, 2026

Copy link
Copy Markdown

2 new issues

Tool Category Rule Count
qlty Structure Function with many returns (count = 4): fetchCapabilities 2

@qltysh

qltysh Bot commented Oct 22, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent/src/utils/condition-tree-parser.ts100.0%
Coverage rating: A Coverage rating: A
packages/datasource-mongoose/src/utils/pipeline/filter.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@arnaud-moncel
arnaud-moncel force-pushed the feat/nested-condition-tree branch from a8321f0 to fcaa8a3 Compare November 2, 2026 10:32
@christophebrun-forest christophebrun-forest self-assigned this Nov 4, 2026

@christophebrun-forest christophebrun-forest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK for me
Manual tests ok with server and front

@arnaud-moncel
arnaud-moncel merged commit 1417b5b into main Nov 6, 2026
34 checks passed
@arnaud-moncel
arnaud-moncel deleted the feat/nested-condition-tree branch November 6, 2026 08:19
forest-bot added a commit that referenced this pull request Nov 6, 2026
forest-bot added a commit that referenced this pull request Nov 6, 2026
forest-bot added a commit that referenced this pull request Nov 6, 2026
@linear-code

linear-code Bot commented Nov 6, 2026

Copy link
Copy Markdown

PRD-1171

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.

2 participants