sergehuber opened a new pull request, #827:
URL: https://github.com/apache/unomi/pull/827

   ## Summary
   
   Fixes [UNOMI-964](https://issues.apache.org/jira/browse/UNOMI-964): 
`GraphQLListIT.testCRUD` fails intermittently (locally and in CI) because the 
GraphQL condition factories are lazy **static singletons**. The base 
`ConditionFactory` snapshots `definitionsService.getAllConditionTypes()` once 
into `conditionTypesMap` and never refreshes it.
   
   Under PaxExam `@PerSuite`, that snapshot is frozen for the whole container, 
captured at the first `get()` call. If that happens before the condition-type 
cache is warm, `getConditionType("profilePropertyCondition")` returns `null`, 
so the active-member query becomes a structural `match-none` for the rest of 
the run:
   
   ```
   TypeResolutionServiceImpl: Condition has no type ID for query builder
   ConditionESQueryBuilderDispatcher: Condition type is null for condition 
typeID=null, returning match-none query
   ```
   
   `findLists.totalCount == 1` still passes (fresh factory), while 
`active.edges` is always empty (stale singleton). This is a structural 
match-none, not an indexing delay — which is why prior timing-based fixes 
(deferred `refreshPersistence`, tripled retries) never worked.
   
   ## Changes
   
   - Remove the static singletons from `ProfileConditionFactory`, 
`EventConditionFactory`, `ProfileAliasConditionFactory`, 
`TopicConditionFactory`; return a fresh instance per `get()`.
   - Drop the `conditionTypesMap` snapshot in `ConditionFactory`; resolve types 
live via `DefinitionsService.getConditionType(id)`. Also removes the retained 
first-request `DataFetchingEnvironment`/`ServiceManager`.
   - Harden `AddProfileToListCommand`: `(send(event) & PROFILE_UPDATED) == 
PROFILE_UPDATED` instead of exact equality (latent bitmask bug on the same code 
path).
   - Revert the misleading timing workarounds and comment in 
`GraphQLListIT.testCRUD`.
   - Add unit tests: live condition-type resolution, no-snapshot constructor, 
fresh-per-`get()` factories, and `AddProfileToListCommand` bitmask handling.
   
   ## Performance
   
   Negligible. All condition-type lookups are in-memory cache reads (no ES/IO). 
Net-positive: removes a synchronized static bottleneck and per-container memory 
retention. The high-frequency ingestion path (`/context.json`, 
`/eventcollector`, rule/segment evaluation) does not use these factories and is 
unaffected.
   
   ## Test plan
   
   - [x] `mvn -pl graphql/cxs-impl test 
-Dtest=ConditionFactoryTest,AddProfileToListCommandTest` — 10/10 pass.
   - [x] `graphql/cxs-impl` compiles; `itests` test-compiles.
   - [ ] `GraphQLListIT.testCRUD` passes reliably (e.g. 20 consecutive local 
runs on the Elasticsearch profile).
   - [ ] No recurring `returning match-none query` warnings during the run.
   - [ ] Full graphql IT package is green.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to