aglinxinyuan opened a new issue, #8399:
URL: https://github.com/apache/texera/issues/8399

   ### Task Summary
   
   `DatasetResourceSpec.beforeAll` sets the JVM-global 
`FulltextSearchQueryUtils.usePgroonga` to `false`
   and never puts it back:
   
   ```scala
   override protected def beforeAll(): Unit = {
     initializeDBAndReplaceDSLContext()
     FulltextSearchQueryUtils.usePgroonga = false // disable pgroonga
     ...
   }
   ```
   
   The write has no effect on this suite. `usePgroonga` is read at exactly one 
place in `src/main`,
   `FulltextSearchQueryUtils.scala:52`, inside `getFullTextSearchFilter`. All 
four of this suite's tests
   reach that function — if at all — with an empty keyword list: its two search 
tests call
   `DatasetSearchQueryBuilder.constructQuery(uid, 
SearchQueryParams(resourceType = DATASET_RESOURCE_TYPE),
   includePublic = true)`, leaving `params.keywords` at its empty-`ArrayList` 
default
   (`DashboardResource.scala:72`), so `getFullTextSearchFilter` returns 
`noCondition()` at `:46` before
   the `:52` read. The other two tests only use `UserDao`.
   
   Confirmed by measurement: arming the read site with a `sys.error` leaves 
`DatasetResourceSpec` at
   4 tests / 0 failures, while `FulltextSearchQueryUtilsSpec` — which does read 
the flag — loses exactly
   its three flag-reading tests.
   
   So the write's only effect is the leak. amber has no `Test / fork` and 
serialises its suites in one
   JVM, so `false` stays set for every suite scheduled after this one, silently 
moving their full-text
   rendering onto the `to_tsvector`/`to_tsquery` arm instead of the production 
`pgroonga_condition` arm.
   An ordered probe (both suites in one sbt invocation, order pinned) observes 
`true` before
   `DatasetResourceSpec` runs and `false` after it finishes.
   
   The same block also declares `private def getKeywordsArray`, which nothing 
calls — it and the flag
   write look like copy-paste residue from `WorkflowResourceSpec`, brought over 
for search tests that
   were never written here.
   
   Proposed cleanup:
   
   - delete the `usePgroonga = false` write, leaving the flag at its production 
default (a
     capture-and-restore would still leave the value wrong during the suite and 
would depend on sbt's
     scheduling, which is not even stable across invocations of the same 
command); leave a short comment
     saying why, and what a keyword test added here would need;
   - delete the unused `getKeywordsArray` and the two imports that only these 
two members needed;
   - update the header paragraph in `DatasetSearchQueryBuilderSpec`, which 
documents this leak as fact
     while justifying a standing instruction about that spec's keyword 
assertions, so the instruction is
     justified by the flag being shared mutable state rather than by any 
particular suite's behaviour —
     and so that it states precisely what survives onto both arms of the flag 
(the concatenated
     `coalesce` expression and each individual keyword token) and what does not 
(their joining: the
     `true` arm space-joins the keyword list into one literal, the `false` arm 
emits one predicate per
     keyword and joins the words inside a keyword with ` & `).
   
   Out of scope: `WorkflowResourceSpec` sets the same flag `false` and also 
never restores it, but it
   genuinely needs the `to_tsvector` arm — it runs real keyword searches 
against the embedded Postgres,
   which has no pgroonga extension because `MockTexeraDB` strips the full-text 
index block out of the
   DDL. Fixing that one needs a scoped override, not a deletion.
   
   ### Task Type
   
   - [x] Refactor / Cleanup
   
   ### Was this issue authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


-- 
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