Skip to content

Prevent rules asset queries from retaining scope restrictions across executions - #3481

Merged
wborn merged 8 commits into
mainfrom
bugfix/assets-query-isolation
Oct 29, 2026
Merged

wborn merged 8 commits into
mainfrom
bugfix/assets-query-isolation

Conversation

@ebariaux

@ebariaux ebariaux commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #3478. Part of #2675.

AssetsFacade.getResults modified caller-owned queries when applying engine scope and storage defaults. Reusing an asset-scoped query through a realm or global engine could retain the earlier asset-path restriction. Each execution now uses an independent AssetQuery copy, preserving the caller's filters and preventing later caller edits from changing an earlier execution's query.

Add a copy constructor and copying support for nested logical groups, attribute predicates, metadata, paths and mutable values. Preserve null versus empty selections, numeric precision and predicate types. Built-in value predicates are copied explicitly; custom serializable predicates use Java serialization. The facade applies its projection to the copy, so it no longer needs to restore the caller's projection afterwards.

Regression tests cover query reuse across global, realm and asset engines, storage-added defaults, nested mutation isolation, empty selections and predicate copying. Enable manager/src/test/groovy alongside the existing test directory. Path-filter preservation remains tracked separately in #3479.

Validation: ./gradlew --offline --no-daemon :model:test :manager:test — all 393 tests passed (57 model, 336 manager). Regression tests were added and confirmed failing before the fix.

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass (model and manager unit suites)
  • 3. Changes are manually tested by you and the reviewer
  • 4. Documentation is written or updated (copying behavior documented in code)

@ebariaux ebariaux added the Bug Error or issue in the system label Oct 23, 2026
@ebariaux ebariaux self-assigned this Oct 23, 2026
@ebariaux
ebariaux requested a review from a team October 23, 2026 15:23

@wborn wborn 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.

This is an initial AI-assisted review.

The query isolation fix looks good overall. The copy constructor preserves the caller's query options and nested predicates, and the regression tests cover reuse across different rule engine scopes.

One potential compatibility edge case is worth considering: copying an ArrayPredicate can reject JSON-serializable values that don't implement Serializable. This does not appear to affect existing usages in the repository.

No blocking issues were identified.

@ebariaux
ebariaux requested a review from wborn October 28, 2026 12:48

@wborn wborn 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.

The updated implementation addresses the previously reported issue with non-Serializable array predicate payloads. The expanded regression tests also provide good coverage of query isolation, nested mutable values, and preservation of query options.

One remaining edge case is worth considering: Java serialization can silently discard JSON-visible transient state, potentially changing the database filter. This appears unlikely to affect existing usages, so it is not considered blocking.

No further blocking issues were identified.

This review was AI-assisted.

@sonarqubecloud

Copy link
Copy Markdown

@wborn
wborn added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 7b49bdf Oct 29, 2026
24 checks passed
@wborn
wborn deleted the bugfix/assets-query-isolation branch October 29, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error or issue in the system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid mutating caller queries in AssetsFacade

2 participants