Skip to content

fix(search): expose Write/Edit body query path - #2803

Merged
Sinity merged 3 commits into
masterfrom
feature/fanout/search-coverage
Jul 12, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/fanout/search-coverage

Conversation

@Sinity

@Sinity Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner

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

Problem: the merged search-text coverage guide incorrectly said no query-DSL field could search Write/Edit bodies, despite action text predicates scanning raw tool_input. Its previous drift test also did not derive claims from the documented matrix or SQL fence.

What changed: document the unindexed action-evidence route, retain direct SQL as an inspection alternative, and add a documentation-derived contract test. The test executes both action predicates and the fenced SQL against real Write/Edit blocks, so it fails if the actual routes or documented artifacts drift.

Compatibility: Write/Edit bodies remain excluded from FTS; no schema rebuild is introduced.

Ref polylogue-013x

Co-Authored-By: Claude <[email protected]>
@gitguardian

gitguardian Bot commented Jul 12, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
34761467 Triggered Generic High Entropy Secret 99e33dc tests/unit/pipeline/test_search_text_coverage_contract.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. 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


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

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f7cd462-2815-47d9-af0c-d24baa3e32b6

📥 Commits

Reviewing files that changed from the base of the PR and between 58691ab and 0051fd9.

📒 Files selected for processing (2)
  • docs/search.md
  • tests/unit/pipeline/test_search_text_coverage_contract.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fanout/search-coverage

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 1

Findings fixed:

  1. Real gap: the merged coverage guide hid the existing action text DSL path for raw Write/Edit tool_input. The guide now documents actions where tool:write AND text:"needle" and the equivalent session predicate; direct SQL is retained only for index inspection.
  2. Real gap: the prior drift test checked unrelated DDL/docs fragments. The new contract test derives the coverage matrix and fenced SQL from docs, checks every listed input path against live search_text DDL, and executes both documented lookup routes against real Write/Edit blocks.

What survived scrutiny: Write/Edit bodies remain deliberately excluded from FTS; their supported fallback is explicitly unindexed and bounded by ordinary action/session/time filters. Focused contract test: 2 passed. Quick static/generated gate: passed.

Problem: the coverage contract test omitted the documented terminal action query and Edit old_string, so those reader-facing paths could regress unnoticed. Synthetic token shapes also produced an avoidable secret-scanner false positive.

What changed: exercise terminal action parsing/execution, both Edit body fields, and the complete indexed tool_input key set using readable fixture markers.

Ref polylogue-013x

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 2

Findings fixed:

  1. The contract test now parses and executes the documented terminal command actions where tool:write AND text:"needle", not only its session-scoped counterpart.
  2. The Edit fixture now carries distinct old_string and new_string markers; both the DSL and the documentation-derived SQL probe must find each one.
  3. GitGuardian’s generic high-entropy alert was a false positive on synthetic test literals. The fixtures now use plainly non-secret markers (write-body-needle, edit-old-body-needle, edit-body-needle), and the test also pins the complete indexed tool_input key set so the documented catch-all exclusion cannot drift.

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. Pre-push quick gate passed.

Problem: the coverage matrix overstated its indexed JSON path count and cited the legacy fragment test rather than the documentation-derived contract test.

What changed: correct the matrix wording and point readers to the test that parses the documented matrix and SQL probe. The contract test now pins both references.

Ref polylogue-013x

Co-Authored-By: Claude <[email protected]>
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 3

Findings fixed:

  1. Corrected the coverage table: exactly three JSON extraction paths feed search_text (command, file_path, path), while tool_name is a separate indexed field.
  2. Replaced the documentation pointer to the legacy fragment test with the documentation-derived contract test that actually validates the matrix and SQL fence.

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. Pre-push quick gate passed.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review — iteration 4 (converged)

No legitimate gaps found across all acceptance criteria after the independent iteration-4 review.

Review and CI triage

  • GitGuardian: the alert identifies generic high-entropy strings in commit 99e33dc. They were synthetic test markers, not credentials, and were replaced in 380dea1 with readable non-secret fixtures. The historical alert remains because the original commit is retained for PR review history; no credential rotation or history rewrite is warranted.
  • GitHub Actions: all workflow jobs failed during initialization in one to three seconds, matching the coordinator-provided account-billing incident rather than a repository test failure. Local focused and quick gates passed.
  • CodeRabbit was rate-limited; it reported no substantive findings. No inline review comments are outstanding.

Final acceptance-criteria matrix

Acceptance criterion Status Evidence
Searchable-content matrix matches live generated-column DDL through a drift test Satisfied Documentation-derived contract parses every listed Yes/No entry, asserts the exact three indexed tool_input paths, and points docs at that test.
If Option A is chosen, record size probe and rebuild plan Misframed for this PR Option B remains the deliberate contract: file bodies are excluded from FTS, so Option A’s conditional rebuild requirement does not apply.
A fixture proves the selected lookup path finds a Write body Satisfied Real Write/Edit blocks are queried through the documented terminal action DSL, session-scoped action DSL, and documentation-derived SQL probe; both Edit body fields are covered.
Focused verification and generated/doc checks Satisfied Focused contract test: 2 passed; pre-push quick gate passed, including render all, type checking, and policy checks.

Ref polylogue-013x

@Sinity
Sinity merged commit 52030cf into master Jul 12, 2026
2 of 13 checks passed
@Sinity
Sinity deleted the feature/fanout/search-coverage branch July 12, 2026 23:28
Sinity added a commit that referenced this pull request Jul 12, 2026
…803,2787,2798

013x (search-coverage, PR #2803) and g9f2 (write-model, PR #2798) fully
satisfied — closed. y8s5 (distribution, PR #2779), ttu (docs-ia, PR #2778),
kwsb (PR #2799), and n4hb/c52g/znwj (test-hardening, PR #2787) partially
satisfied — noted with disposition, left open per closure-discipline.

Co-Authored-By: Claude <[email protected]>
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