Skip to content

feat(admin-console): search run comments and annotation text (CHE-1478) [squash] - #353

Draft
congvc-bot-x99[bot] wants to merge 1 commit into
mainfrom
agent/tofu/che-1478-1c6fb1baac9c
Draft

congvc-bot-x99[bot] wants to merge 1 commit into
mainfrom
agent/tofu/che-1478-1c6fb1baac9c

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Closes the backend part of CHE-1478 (stage 6 of CHE-1364): run search now finds comment and annotation text.

Base: stacked on PR #341 (CHE-9324, snippets after the visibility join), because #341 had not merged. Retarget to main when it does.

What changed

  1. runs_fts gets a third column notes (catalog FTS revision 2, WAL-aware backup via schema_revisions).
  2. run_catalog.migrate_notes (module run_catalog_notes, revision 1) runs from notes.migrate once both notes tables exist: it installs triggers on run_comments and run_annotations (insert, UPDATE OF body, delete) and rebuilds the index with group_concat of the bodies. Comment and annotation routes are untouched (PR feat(smartqa): add run comment edit and delete routes [squash] #352 keeps working).
  3. Run delete and tombstone already remove the FTS row, so its note text goes with it.
  4. Ranking: goal matches first (goal_miss, unchanged), notes weighted like metadata.
  5. Snippet for a note-only match is built after the visibility join from the visible runs' own notes (note_snippet, field comment or annotation), redacted for read-only runs.

Known limits

  • Substring fallback (no FTS5) does not search note text. Everything else in the fallback is unchanged.
  • Two existing schema-diff tests now allow the run_catalog_* triggers to change when notes are indexed.

Test command

uv run pytest tests/unit/data_engine tests/unit/admin_console/test_run_catalog_api.py tests/unit/admin_console/test_run_list_filters.py tests/unit/admin_console/test_run_comments.py tests/unit/admin_console/test_run_comments_api.py tests/unit/admin_console/test_run_annotations.py tests/unit/admin_console/test_run_annotations_api.py tests/unit/admin_console/test_run_notes_search.py

Output (X99): first run 402 passed, 1 skipped, 2 failed (the two schema-diff tests below); after updating them, test_run_comments.py + test_run_annotations.py re-run: 36 passed. The new file alone: 12 passed. ruff check . and ruff format --check clean.

New file tests/unit/admin_console/test_run_notes_search.py covers: comment-only and annotation-only hits with snippets, goal-before-note ranking, hidden run and removed run never leak, read-only redaction, edit/delete keep the index current, run delete and tombstone drop notes, upgrade once with backup and idempotent re-run, migration no-op before notes tables exist, substring fallback.

Index comment and annotation bodies in runs_fts (new notes column, catalog
revision 2) and keep them current with triggers on the notes tables. Note
matches rank after goal matches. Snippets for note-only matches are built
after the visibility join and redacted for read-only runs.
Base automatically changed from agent/x99-claude-sonnet/che-9324-2b1ec5ad4321 to main November 27, 2026 04:58
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.

0 participants