Skip to content

refactor(search): name storage search DTOs honestly - #1565

Merged
Sinity merged 1 commit into
masterfrom
feature/refactor/search-storage-hit-dtos
May 25, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/refactor/search-storage-hit-dtos

Conversation

@Sinity

@Sinity Sinity commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

This narrows a #873 source of confusion by renaming storage-only search DTOs so they no longer masquerade as the public ranked-hit contract.

Problem

#873 still listed “split search hit models” as a residual. Reading the code showed the split is legitimate at the data-shape level: storage query helpers return lightweight SQL/id rows before repository hydration, while archive/query returns the public summary-plus-evidence ConversationSearchHit. The problem was the storage names, ConversationSearchHit and ConversationSearchEvidenceHit, which implied a second public ranked-hit model and made future drift more likely.

Solution

Renamed the storage-only id DTO to ConversationSearchIdHit and the pre-hydration evidence DTO to ConversationSearchEvidenceRow. Repository search still maps those rows into the public archive ConversationSearchHit before surfaces see them. No compatibility aliases were added.

Verification

  • pytest -q tests/unit/storage/test_archive_search_contracts.py tests/unit/storage/test_search_explanation_wiring.py --tb=short — 20 passed.
  • ruff format --check on touched files — passed.
  • ruff check on touched files — passed.
  • mypy on touched files — passed.
  • devtools verify --json — exit 0; 630 pytest-testmon selected tests passed; total 195.14s.
  • pre-push devtools verify --quick — exit 0; total 34.88s.

Ref #873

Problem: #873 calls out split ranked-hit models. The storage layer did need lightweight SQL/id DTOs, but naming them ConversationSearchHit and ConversationSearchEvidenceHit made them look like the public archive ranked-hit contract and invited future surface drift.\n\nWhat changed: renamed the storage-only id hit to ConversationSearchIdHit and the pre-hydration evidence DTO to ConversationSearchEvidenceRow. The repository still hydrates those rows into the public archive ConversationSearchHit before returning search-summary evidence to surfaces.\n\nVerification: pytest -q tests/unit/storage/test_archive_search_contracts.py tests/unit/storage/test_search_explanation_wiring.py --tb=short; ruff format --check on touched files; ruff check on touched files; mypy on touched files; devtools verify --json (630 selected tests passed).\n\nRef #873
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've used your available PR reviews for now.

Your plan includes 1 review of capacity. Refill in 48 minutes and 4 seconds.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 00d3031d-b88f-4855-9fd8-4452984780d9

📥 Commits

Reviewing files that changed from the base of the PR and between cbe6d90 and ea0b288.

📒 Files selected for processing (6)
  • polylogue/storage/repository/archive/search.py
  • polylogue/storage/search/models.py
  • polylogue/storage/sqlite/queries/attachment_records.py
  • polylogue/storage/sqlite/queries/conversations_search.py
  • polylogue/storage/sqlite/query_store_archive.py
  • tests/unit/storage/test_archive_search_contracts.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/search-storage-hit-dtos

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 and usage tips.

@Sinity
Sinity merged commit b07bf69 into master May 25, 2026
6 checks passed
@Sinity
Sinity deleted the feature/refactor/search-storage-hit-dtos branch May 25, 2026 09:43
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