Skip to content

fix(platform): rank task field and comment search hits together - #4248

Merged
yannickmonney merged 1 commit into
mainfrom
fix/task-search-comment-priority
Oct 9, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/task-search-comment-priority

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

What changed

  • Always retrieve both task-field and discussion-comment candidate pages.
  • Retain the existing 25-row bound on each query and comment-level DISTINCT ON.
  • Deduplicate task IDs, rank active before archived and newest before oldest, then apply the final 25-result limit. Field snippets continue to win for dual matches.
  • Add a real-Postgres integration lane for 24/25/30 archived hits, repeated comments, dual field/comment matches, active-page recency and ordinary/blank controls; add a unit proof of both bounded queries and document automated coverage.

Verification

  • Reproduced before the fix against owned local PostgreSQL 15: controls passed; 25/30 archived hits and mixed-page assertions failed.
  • After the fix: all 7 real-Postgres assertions passed. This executes the production search service against migration-created tables, not mocked SQL; no production testing.
  • Targeted task-service/importer and integration-scope tests: 25 files, 530 tests passed, one worker (Node 24.21.0).
  • Targeted oxlint, oxfmt and scoped TypeScript checks; no whole-platform suite or whole-workspace type check.

Independent review requested through TALE-359. No merge, card move or CI rerun/cancellation.

Closes #3596

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review — TALE-579 / PR #4248

Verdict: ACCEPT at exact head 17e7c225fbc36ad33e1bdbf55e4eedd3b4de3f2c.
Reviewer: Codex #11, agent 7a7d20b9-15bf-4d0c-99bf-33e6e841a76c,
run 6333d4f4-601c-4e09-91cd-d568d57c89bd; implementation is distinct
(Codex #8, agent 579ebc6d-a30d-43a6-b3fb-a340b6a22eae, run 24de1220).

Read TALE-141 and GitHub #3596 as the acceptance contract. No blocking findings.

Evidence

  • Production diff retains LIMIT 25 on each SQL candidate query. Both queries
    now execute even when fields fill the first page. Comment DISTINCT ON
    removes repeated-comment task rows before its candidate limit. The task-ID
    set removes overlap between the two bounded pages before final active-first,
    newest-first sorting and slice(0, 25). At most 50 task candidates enter
    application ranking; no new uncapped task/comment fetch or pagination loop.
  • Two top-25 pages suffice for a top-25 union: any task below position 25 in
    either individually deduplicated, consistently ranked leg already has 25
    distinct tasks ahead of it. The merge therefore does not need an unbounded
    application scan to meet this contract. SQL LIKE matching still searches
    the eligible relation as before; this is not a claim of constant database work.
  • Owned throwaway instance TALE-579 PostgreSQL 17.5, cluster pg-data,
    loopback port 5579, user reviewer579, database postgres. Real boot
    migrations create the schema; the production search service and PR regression
    lane run without SQL/project mocks, using synthetic org/user/project IDs.
    The extracted lane differs only in its service import path, so the same test
    can execute after checking out main. Instance stopped after both runs.
  • Head: 7/7 PostgreSQL assertions pass: comment-only control; 24, 25 and
    30 archived field hits retain the active comment task first; repeated comments
    and dual field/comment matches yield 25 distinct task hits; active-page recency
    combines both legs; ordinary field and blank-query controls remain correct.
  • Main bd2275c3f8bc5f928349cc2a38f10134e666eb42: the identical real-Postgres
    lane fails 4/7 assertions, including the exact 25/30 archived-hit starvation
    and mixed-page assertions; comment-only, 24-hit and ordinary/blank controls
    pass. Exit 1 on main versus exit 0 on pinned head.
  • Targeted Vitest server suites service.board-search.test.ts, service.test.ts
    and integration-scope.guard.test.ts: 3 files / 27 tests pass, Node 24.21.0,
    one worker. SQL recording assertion proves both page limits are 25.
  • Targeted oxlint and oxfmt checks of the changed TypeScript files pass;
    formatter also receives the automation reference Markdown path.
  • Search importer suites backend/core/chat/assistant_tools.test.ts and
    backend/domains/chat/shim.test.ts: 2 files / 149 tests pass, one worker.
    Total targeted unit/importer/guard coverage: 5 files / 176 tests pass.

Not run / boundaries

No full platform suite, whole-workspace/scoped TypeScript check, full backend
HTTP/MinIO integration harness, browser/UI checks, production tests, query-plan
benchmark or CI execution/wait. This backend-only review changes no product code.
CI is intentionally left to the completion owner: no rerun or cancellation.
Disk remained above the 20 GiB floor (188 GiB initially; 183 GiB at later readback).
No push, merge, task move or native human-review decision.

Initial setup-only Vitest invocations used the wrong working directory/path;
they ran no tests. Corrected runs above are the evidence, not those failures.

Acceptance is an independent exact-head review record, not authorization to merge
with missing required CI or bypass the source task's native review guard.

@yannickmonney
yannickmonney force-pushed the fix/task-search-comment-priority branch 2 times, most recently from ff30ff6 to 4d76211 Compare October 9, 2026 04:01
@yannickmonney
yannickmonney force-pushed the fix/task-search-comment-priority branch from 4d76211 to dd39355 Compare October 9, 2026 04:27
@yannickmonney
yannickmonney force-pushed the fix/task-search-comment-priority branch from dd39355 to 3366e6c Compare October 9, 2026 04:43
@yannickmonney
yannickmonney added this pull request to the merge queue Oct 9, 2026
@yannickmonney
yannickmonney merged commit 78b7abd into main Oct 9, 2026
@yannickmonney
yannickmonney deleted the fix/task-search-comment-priority branch October 9, 2026 22:20
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.

Bug: archived title matches crowd active comment matches out of task search

1 participant