Repository navigation
fix(search): document search_text tool-body coverage gap - #2740
Conversation
Problem: blocks.search_text (the generated column FTS5 indexes) only concatenates text, tool_name, and tool_input.$.command/$.file_path/$.path. It excludes tool_input.$.content (Write file bodies) and $.old_string/ $.new_string (Edit bodies), so a distinctive string an agent wrote or edited into a file returns zero FTS hits with no diagnostic explaining why. docs/search.md never stated this boundary. Solution: adds a "Searchable Content Coverage" matrix to docs/search.md enumerating exactly which block/tool_input fields feed search_text, plus a raw-SQL json_extract/LIKE workaround for the excluded Write/Edit bodies, and a pointer from the Empty Result Diagnostics checklist. Chose documentation (option B from the bead design) over extending the generated column (option A): extending search_text needs a live-archive FTS index size probe plus a derived-tier index rebuild (polylogue ops reset --index && polylogued run), which is out of scope for an isolated doc-boundary fix and shouldn't be done as a silent schema bump per the derived-tier schema regime. tests/unit/storage/test_search_text_write_tool_coverage.py pins three things: the live search_text DDL expression matches the documented matrix (drift check), a Write/Edit tool body token is genuinely unreachable via FTS MATCH, and the documented raw-SQL workaround finds it. Verification: - devtools test tests/unit/storage/test_search_text_write_tool_coverage.py -> 4 passed - mypy --strict tests/unit/storage/test_search_text_write_tool_coverage.py -> Success: no issues found - ruff check / ruff format --check on the touched .py file -> clean - python3 devtools/verify_docs_drift.py -> zero unhandled drift Ref polylogue-013x Co-Authored-By: Claude <[email protected]>
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 34761467 | Triggered | Generic High Entropy Secret | 98a8114 | tests/unit/storage/test_search_text_write_tool_coverage.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98a81141d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
## Summary Correct the search-text coverage guide after adversarial review: Write/Edit bodies remain excluded from FTS, but the documented action-evidence query route searches raw tool input without a direct-SQL detour. ## Problem Merged PR #2740 incorrectly stated that no query-DSL field could search Write/Edit bodies. Its claimed DDL-to-doc and workaround tests checked independent fragments rather than the documented matrix and fenced SQL themselves. ## Solution - Document action text predicates as the unindexed, portable route for Write/Edit body lookup; retain the JSON SQL probe for direct index inspection. - Clarify the FTS versus action-evidence boundary and fully qualify the Edit input keys. - Add a documentation-derived contract test that compares every matrix entry with the live generated column, compiles and executes the documented action predicates against real Write/Edit blocks, and executes the fenced SQL from the docs. ## Verification - env POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/pipeline/test_search_text_coverage_contract.py — 2 passed. - nix develop --command devtools verify --quick — passed all format, lint, mypy, render, topology, layering, schema, and policy checks. - Pre-push quick gate — passed; its mypy phase was delayed by concurrent fanout load but completed successfully. ## Anti-vacuity The new test invokes the production query compiler and ArchiveStore lowering path against stored Write/Edit tool_input. Removing tool_input from action text lowering makes the DSL assertion fail. It also parses and executes the SQL fence from docs, and derives every documented Yes/No matrix value from the live search_text DDL, so changes to either contract artifact fail the test. ## Adversarial review notes Iteration 1 found two real gaps in the already-merged #2740 closure: the hidden DSL route and a vacuous docs-to-DDL/workaround test. This PR fixes both; no prior review comments apply to this branch. ## Acceptance criteria - Satisfied: searchable-content matrix matches live DDL through a documentation-derived test. - Satisfied: Option B is explicit: Write/Edit bodies stay out of FTS and have an action-evidence route plus a direct SQL inspection path. - Not applicable: Option A size probe and index rebuild, because this PR retains Option B. Ref polylogue-013x --------- Co-authored-by: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Documents the FTS
search_textcoverage boundary discovered in polylogue-013x:blocks.search_textexcludestool_input.$.content(Write file bodies) and$.old_string/$.new_string(Edit bodies), so a distinctive string an agent wrote or edited into a file is invisible to FTS with no diagnostic explaining why.Problem
blocks.search_text(polylogue/storage/sqlite/archive_tiers/index.py) is a generated column that concatenatestext,tool_name, andtool_input.$.command/$.file_path/$.path. It does not includetool_input.$.contentor$.old_string/$.new_string. An operator searching for a string they know an agent authored into a file gets zero hits with no explanation, anddocs/search.mdnever stated this boundary — the two defects the bead was filed for.Solution
Chose option B (document + workaround) from the bead's design over option A (extend the generated column):
search_textto cover$.contentis a derived-tier schema change (polylogue/storage/sqlite/archive_tiers/index.pyDDL +polylogue ops reset --index && polylogued run). The bead's own design explicitly requires a live-archive FTS index size probe as decision evidence before doing that (Write bodies can be large enough to meaningfully bloat the index), which isn't available from an isolated worktree, and the repo's derived-tier schema regime says such bumps should be batched, not done as an isolated silent schema change.docs/search.mdgains a new "Searchable Content Coverage" section: a table enumerating exactly which block/tool_input fields feedsearch_text(including confirmingthinking/reasoningblock content andtool_resultoutput are searchable today), what's excluded (Write's$.content,Edit's$.old_string/$.new_string, and any other unindexedtool_inputkey), and a raw-SQLjson_extract/LIKEworkaround query.tests/unit/storage/test_search_text_write_tool_coverage.pypins three things:search_textDDL expression (extracted via regex fromindex.py) matches the documented matrix — a drift check that fails if a future change adds/removes ajson_extractpath without updating the docs.messages_fts MATCH(proves the gap is real, not just documented).Verification
devtools test tests/unit/storage/test_search_text_write_tool_coverage.py→4 passed in 5.34smypy --strict tests/unit/storage/test_search_text_write_tool_coverage.py→Success: no issues found in 1 source fileruff check/ruff format --checkon the touched.pyfile → cleanpython3 devtools/verify_docs_drift.py→zero unhandled drift across the reference-docs sweepgit pushpre-push gate (devtools verify --quick: ruff format/check, mypy, render all, topology/layering/closure-matrix, schema roundtrip, manifests, ci-workflows, doc-commands, test-infra-currency, test-clock-hygiene, pytest-timeout-overrides, degrade-loudly) → all green,exit_code: 0Note: per operator instruction, the heavy
devtools test/devtools verify --allsuite was not run broadly — only the focused new test file plus the pre-push quick gate. GitHub CI is expected to be blocked by an unrelated account billing lock.Ref polylogue-013x