Skip to content

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

Merged
congvc-dev merged 3 commits into
mainfrom
agent/tofu/che-1478-1c6fb1baac9c
Dec 3, 2026
Merged

congvc-dev merged 3 commits 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

Status

Draft PR for CHE-1478 (stage 6 of 6 of CHE-1364) at head 61680f45ccef975016143f812efb47840fe01c36 on base main. Run search indexes comment and annotation text in FTS5 (runs_fts.notes). Read-only search filters matches against redacted prompt and note text across both FTS5 and substring fallback modes before counting, ranking or paging.

Conditions

  • Comment and annotation HTTP routes stay untouched. SQLite triggers keep runs_fts.notes in sync on insert, UPDATE OF body and delete.
  • Substring fallback (when SQLite lacks FTS5) does not search note text and filters read-only prompt hits against redacted prompts.
  • Remaining parent scope: CHE-1471, CHE-1474 and CHE-1476 remain in backlog under CHE-1364. CHE-1364 resolves once those stages land.
  • State machines: none touched — adds an FTS5 column, SQLite triggers and read-only search filtering with no new status column or lifecycle state.
  • Four lenses: not applicable — backend catalog search change, not a template, workflow or CI/CD change.
  • Lessons checked: 324c9699-f2a3-4a34-99af-52a2b76ab43a, 11942989-c420-4c9a-bd82-1acf8640bb66.

Change

  1. Add notes as the third column of runs_fts (run_catalog_fts revision 2, WAL-aware backup via schema_revisions).
  2. Add run_catalog.migrate_notes (run_catalog_notes revision 1), called from notes.migrate once both run_comments and run_annotations exist. migrate_notes installs insert, UPDATE OF body and delete triggers. migrate_notes rebuilds runs_fts with group_concat of each run's note bodies.
  3. Rank goal matches ahead of note matches (goal_miss unchanged, bm25(runs_fts, 10.0, 1.0, 1.0)).
  4. Build note-only snippets after the visibility join (run_catalog_repo.note_texts and run_catalog.note_snippet), redacted for read-only runs. Skip synthetic [REDACTED] markers when matching literal redacted.
  5. Fix review findings F1 (01a22d4c-9ad8-78f9-9850-4a03546e19c7) and F2 (01a2377b-dc52-752e-b3b9-2a53f6076d57) inside RunCatalogRepository.list_runs's read snapshot. Unify prompt and note redaction predicates with _present's read_only rule (scope=everyone and non-owner scope=available). Mask secrets with internal Unicode noncharacters (\ufdd0). Verify FTS5 hits in :memory: (including goal-rank demotion when a prompt matches only through redacted text). Verify substring fallback hits via SQLite LIKE ... ESCAPE '\' before computing total, runs, next_cursor or cursor validity.

Blast Radius

  • Proof level: 3 (integration — FastAPI ASGI routes, SQLite FTS5 and substring fallback queries, triggers/migrations and redaction pipeline tested together on X99).
  • What can break: /api/runs search results, counts, ranking, cursors and snippets, plus notes.migrate and run_catalog.migrate upgrades on SQLite databases.
  • How CI and local pytest detect a break: tests/unit/admin_console/test_run_notes_search.py, test_run_catalog_api.py, test_run_list_filters.py, test_run_ownership.py and tests/unit/data_engine/test_run_catalog_schema.py fail.

Cost delta

  • C1 Cost delta: 0 model tokens, 0 agent runs, 0 external API calls and USD 0 per search request. Standard PR CI workflows run once per push (~5 Actions minutes on self-hosted cheese-x99). Read-only search adds one in-memory SQLite FTS5 or LIKE check over matched candidate rows (<1 ms locally).
  • C2 Optimality check: We rejected redacting prompts or notes at SQLite trigger time via a Python UDF. Plain sqlite3.connect writers (CLI, migrations and repository callers) lack registered Python functions and would fail with OperationalError, and index-time redaction would break owner search in scope=mine. Query-time verification on read-only hits keeps triggers pure SQL and leaves scope=mine untouched.
  • C3 Watch: Monitor Admin Console /api/runs latency and error logs plus the daily usage report (CHE-4324). Roll back by reverting the PR if /api/runs?q= p95 latency regresses above 200 ms or any SQLite migration error appears.

Evidence

  • Red-then-green on X99 for F1 (tests/unit/admin_console/test_run_notes_search.py): 4 failed, 13 passed on b442fb72e7fe15e2ea2164228826aa75c75aad13, then 17 passed on f6db06aa3bfcebae6a992ff826300029993a2e88.
  • Red-then-green on X99 for F2 (tests/unit/admin_console/test_run_notes_search.py and test_run_ownership.py): 7 failed, 19 passed on f6db06aa3bfcebae6a992ff826300029993a2e88, then 25 passed in test_run_notes_search.py and 777 passed across all 21 run/spaces/chat/redaction admin-console suites on 61680f45ccef975016143f812efb47840fe01c36.
  • Data engine and logging redaction suites:
    .venv/bin/pytest tests/unit/data_engine tests/unit/test_logging_redaction.py -q
    Output: 222 passed, 1 skipped in 10.77s
  • Lint, format, quality ratchet and pyright:
    .venv/bin/ruff format --check . && .venv/bin/ruff check . && .venv/bin/python scripts/quality_ratchet.py && .venv/bin/pyright --project pyright-core.json
    Output: 1050 files already formatted, All checks passed!, quality ratchet passed, 0 errors, 0 warnings, 0 informations

Part of CHE-1364
Closes CHE-1478

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
congvc-bot[bot] added 2 commits December 2, 2026 20:10
…ch (CHE-1478)

Filter read-only FTS hits against non-word-masked note and prompt text inside the catalog read snapshot so redacted credentials never affect search membership, total counts, cursors or snippets.
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review December 2, 2026 19:18
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as draft December 3, 2026 00:14
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review December 3, 2026 06:15
@congvc-bot-x99
congvc-bot-x99 Bot requested a review from congvc-dev December 3, 2026 08:55
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as draft December 3, 2026 08:56
@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review December 3, 2026 10:51
@congvc-dev
congvc-dev added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit c84692c Dec 3, 2026
8 checks passed
@congvc-dev
congvc-dev deleted the agent/tofu/che-1478-1c6fb1baac9c branch December 3, 2026 15:19
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.

1 participant