Skip to content

UN-4628 [FEAT] Global search: split adapters into LLM, vector DB, embedding and text extractor types - #2457

Open
ritwik-g wants to merge 2 commits into
mainfrom
UN-4628-search-adapter-split
Open

ritwik-g wants to merge 2 commits into
mainfrom
UN-4628-search-adapter-split

Conversation

@ritwik-g

@ritwik-g ritwik-g commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What

  • The global search API now returns adapters as four result types, one per v1 rail destination: llm (LLMs), vector_db (Vector DBs), embedding (Embedding) and text_extractor (Text Extractor). Before, all adapters came back as a single adapter type.
  • Each type has its own limit and has_more, in rail order (80 to 83), between task pipelines and connectors.
  • OCR adapters are no longer returned.
  • All four types keep the existing adapter.detail / adapter.info route keys, with id and adapter_type as params.

Why

  • UN-4628 is a minor scope expansion of PB-T16 (UN-4402), decided for Global search (P2-T10, UN-4278, decision D-7).
  • The v1 rail and the four v1 adapter pages (P3-T01 to P3-T04) split adapters by kind. With one mixed group, the search panel's "More" link had no single list to open, and the cap of 5 was shared across all kinds.
  • OCR is being removed from v1 (decided on 5 Nov).

How

  • AdapterProvider becomes an unregistered base class that filters on its adapter_type. Four subclasses register under the new keys.
  • The route keys stay shared because the notifications inbox (backend/inbox/events.py) already uses adapter.info. adapter_type in the params tells the client which adapter page to open.
  • The contract README type table, the test builders, and the contract, visibility and budget tests are updated. The budget fixture now seeds 2,000 rows per adapter kind.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. The adapter search type key is renamed, but nothing consumes it yet: the P2-T10 panel isn't built.
  • The cloud search providers (agentic_project, review_queue) and the inbox don't reference the adapter type key, and none of the route keys change.
  • A client that sends types=adapter now gets no adapter groups, because unknown keys are ignored by contract.

Database Migrations

  • None.

Env Config

  • None.

Relevant Docs

  • backend/global_search/README.md, Types table.

Related Issues or PRs

Dependencies Versions

  • None.

Notes on Testing

  • pytest backend/global_search against Postgres 15 (pgvector) and Redis: 59 passed.
  • New test: each adapter kind is returned only under its own type, and OCR adapters under none. With the adapter_type filter removed, this test and the per-type contract and ranking tests fail.
  • Budget test: p95 is about 55 ms for both a member and an admin (budget 300 ms). The query count stays within 3 per type plus overhead.

Screenshots

  • None (API only).

Checklist

I have read and understood the Contribution Guidelines.

🤖 Generated with Claude Code

Replace the single `adapter` search type with `llm`, `vector_db`,
`embedding` and `text_extractor`, one per v1 rail destination, each with
its own limit and has_more. OCR adapters are no longer returned. All four
keep the shared adapter.detail / adapter.info route keys, which the
notifications inbox also uses; adapter_type in the params picks the page.

UN-4628

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ritwik-g ritwik-g left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard review — round 1 of the self-review loop (tip 752705e09, review-deep, INITIAL)

Review choice: review-deep. The diff changes the search endpoint's wire format (its result type keys), which is a review-shallow disqualifier. Scope: merge base 849889259 to 752705e09, 7 files and 173 lines; the count matches GitHub. Signals raised: lens 7 (type keys renamed), lens 13 (tests changed) and lens 16 (README and docstrings changed). Security deep-dive: not triggered. No endpoint, auth, parser or input boundary changed; the change only narrows an existing queryset. Boundary sweep: 0 new sinks traced, clean.

Verdict — REQUEST CHANGES

Summary — Critical: 0 · High: 1 · Medium: 0 · Low: 3 · Lenses run: 19/19

Findings — posted inline below (4).

Unanchored findings

  • [Low] [Lens 7] The UI test suite (Zipstack/unstract-ui-test-automation, playwright-typescript/src/api/search.ts:22) still lists adapter in TYPE_ORDER. Its spec checks the order of known types only and tolerates unknown ones, so nothing fails, but the four adapter groups stop being order-checked. Follow-up there: replace adapter with the four keys, and add a COMPATIBILITY note on the release boundary.

Lens checklist

  1. Spec & intent — Clean — assessed by code-reviewer
  2. Architectural fit & precedent — Clean — assessed by code-reviewer
  3. Correctness & edge cases — Clean — assessed by code-reviewer
  4. Security — Clean — assessed by orchestrator, the visibility rule is unchanged, and .filter(adapter_type=…) sits on top of for_user(), so it can only narrow results
  5. Data integrity & migrations — N/A — read-only query change, no models or migrations
  6. Concurrency — N/A — no shared state, locks or async ordering
  7. API & contract compatibility — See findings #1 — assessed by type-design-analyzer for the contract shape, the orchestrator did the cross-repo consumer search
  8. Reliability & resilience — Clean — assessed by orchestrator, each new type is its own provider, so a failure lands in failed_types per type, as before
  9. Performance & cost — Clean — assessed by code-reviewer, budget test p95 ≈ 55 ms, query bound scales per provider
  10. Observability — Clean — assessed by code-reviewer
  11. Operational safety — N/A — no flag, rollout or config surface
  12. LLM/agent-specific — N/A — no model calls or prompts
  13. Testing — Clean — assessed by pr-test-analyzer, 59 passed against real Postgres, three mutants killed
  14. Dependencies & build — N/A — no dependency changes
  15. Code quality — Clean — assessed by code-reviewer, orchestrator ran the pinned ruff v0.3.4 on the changed files. The only hits are on pre-existing lines, base.py:132 D209 and test_contract.py:26 N814, both unchanged from main.
  16. Doc & comment accuracy — See findings #2, #3, #4 — assessed by comment-analyzer
  17. Cross-document rule consistency — Clean — assessed by orchestrator, merge-result sweep of the new identifiers, hits are only the PR's own lines and unrelated adapter-ops skill docs. The out-of-repo restatement is reported under lens 7.
  18. On-prem deployment experience — N/A — no chart, values, schema or on-prem build surface
  19. Scaling & workload lifecycle — N/A — no worker, concurrency or autoscaling values

Open questions for the author — none.

Assumptions made — that no released client sends or handles adapter. This rests on the consumer search above; a client that does would need an alias, not just a note.

cost: agents=4 wall=03:53 lenses-examined=12 files=7 lines=173

Unanchored findings

  • backend/global_search/oss_providers.py:5 (outside the diff hunk): [Low] [Lens 16 — Doc accuracy] — The module docstring's list of narrowings leaves out the new adapter-kind filter
    • Location: backend/global_search/oss_providers.py:L5-L6. This line isn't in the diff; the new filter at L177 made it incomplete.
    • Failure mode: someone reading why an OCR adapter that appears in the list is missing from search won't find the reason in this docstring.
    • Suggested fix: add "adapter kind (OCR excluded)" to the parenthetical.
    • Confidence: Medium
    • Verification: VERIFIED by reading the docstring against visible_queryset.

Comment thread backend/global_search/README.md Resolved
Comment thread backend/global_search/oss_providers.py Resolved
Comment thread backend/global_search/tests/base.py Resolved
…ture comments

Round-1 self-review fixes: record in the README that the four adapter
types replace the released `adapter` type (and that OCR results are
dropped), say the inbox sends only adapter.info, drop a fixture comment
that claimed every kind opens on adapter.detail, and list the adapter-kind
narrowing in the module docstring.

UN-4628

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@ritwik-g ritwik-g left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard review — round 2 of the self-review loop (tip 6766873f1, review-deep, FOLLOWUP)

Review choice: review-deep again. The PR as a whole still changes the search response's type keys, so review-shallow doesn't apply. Round delta: 752705e09..6766873f1, covering README.md, the oss_providers.py docstrings and a tests/base.py comment.

Verdict — APPROVE

Prior context fetched — followup-fetch.sh exited 0. The "since" boundary is 752705e09 (review 5799140571).

Scope change — NO

Summary — Critical: 0 · High: 0 · Medium: 0 · Low: 0 · Lenses run: 19/19

Prior findings status

  • #1 [High] The released adapter search type was removed with no migration note → RESOLVED in 6766873. backend/global_search/README.md:133-138 now names the removed key, its four replacements, the dropped OCR results and the release boundary (v0.194.0). That claim was checked against the release tags.
  • #2 [Low] Inbox said to use both route keys → RESOLVED in 6766873 — oss_providers.py:154-157, README.md:129-131
  • #3 [Low] Fixture comment claimed every kind opens on adapter.detail → RESOLVED in 6766873 — tests/base.py:122
  • #4 [Low] Module docstring omitted the adapter-kind narrowing → RESOLVED in 6766873 — oss_providers.py:5-6

New findings — none. Two agents examined the round delta (code-reviewer and comment-analyzer); both reported clean after checking each new statement against the code and release tags. The suite was re-run: 59 passed against live Postgres and Redis.

Lens checklist

  1. Spec & intent — Clean — assessed by code-reviewer
  2. Architectural fit & precedent — Clean — assessed by code-reviewer
  3. Correctness & edge cases — Clean — assessed by code-reviewer
  4. Security — N/A — this round changes only comments, docstrings and README text
  5. Data integrity & migrations — N/A — no models or migrations
  6. Concurrency — N/A — no runtime change this round
  7. API & contract compatibility — Clean — assessed by orchestrator, finding 1 is resolved by the README migration note and the wire format is unchanged this round
  8. Reliability & resilience — N/A — no runtime change this round
  9. Performance & cost — Clean — assessed by code-reviewer
  10. Observability — Clean — assessed by code-reviewer
  11. Operational safety — N/A — no flag, rollout or config surface
  12. LLM/agent-specific — N/A — no model calls or prompts
  13. Testing — Clean — assessed by code-reviewer as test runner, 59 passed, and only a test comment changed
  14. Dependencies & build — N/A — no dependency changes
  15. Code quality — Clean — assessed by code-reviewer, orchestrator ran the pinned ruff v0.3.4 format check on the changed Python files, clean
  16. Doc & comment accuracy — Clean — assessed by comment-analyzer
  17. Cross-document rule consistency — Clean — assessed by orchestrator, the inbox route-key statement now matches backend/inbox/events.py and inbox/ReadMe.md
  18. On-prem deployment experience — N/A — no on-prem surface
  19. Scaling & workload lifecycle — N/A — no worker or scaling values

Open questions / assumptions — this assumes no released client outside the repos searched in round 1 sends or handles adapter.

cost: agents=2 wall=02:26 lenses-examined=10 files=3 lines=25

@ritwik-g ritwik-g added the main-only Stays on main: not backported to a release line label Nov 6, 2026
@ritwik-g
ritwik-g marked this pull request as ready for review November 6, 2026 15:38
@greptile-apps

greptile-apps Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

via Greptile

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Splits adapter search results into llm, vector_db, embedding, and text_extractor, each with its own result cap.

  • Global search shows each adapter kind in its own group.

Reviews (1) · Last reviewed commit: "docs(global_search): note the removed ad..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Unstract test results

Per-group results

Status Group Tier Passed Failed Errors Skipped Duration (s)
⚪ e2e-agent-kv e2e 0 0 0 1 0.1
✅ e2e-api-deployment e2e 3 0 0 0 14.9
✅ e2e-coowners e2e 1 0 0 0 1.4
✅ e2e-etl e2e 1 0 0 0 18.7
✅ e2e-login e2e 2 0 0 0 1.2
✅ e2e-prompt-studio e2e 1 0 0 0 6.1
✅ e2e-smoke e2e 2 0 0 0 2.6
✅ e2e-workflow e2e 1 0 0 0 22.4
✅ frontend unit 664 0 0 0 17.1
✅ frontend-v1-unit unit 284 0 0 0 6.4
✅ integration-backend integration 1570 0 0 26 70.1
✅ integration-connectors integration 1 0 0 7 7.3
✅ integration-workers integration 181 0 0 1 46.3
❌ ui e2e 0 1 0 0 0.0
✅ unit-agent-kv-schema unit 143 0 0 0 1.7
✅ unit-backend unit 2159 0 0 1 62.2
✅ unit-connectors unit 82 0 0 0 11.3
✅ unit-core unit 289 0 0 0 3.3
✅ unit-filesystem unit 1 0 0 0 4.6
✅ unit-platform-service unit 22 0 0 0 2.7
✅ unit-rig unit 139 0 0 0 5.3
✅ unit-runner unit 12 0 0 0 3.0
✅ unit-sdk1 unit 1356 0 0 0 44.4
✅ unit-tool-sidecar unit 8 0 0 0 1.8
✅ unit-workers unit 1675 0 0 2 131.0
✅ unit-x2text-service unit 116 0 0 0 3.8
TOTAL 8713 1 0 38 489.7

Critical paths

⚠️ Critical paths not yet covered

  • workflow-execution-fan-out — Multi-file workflow execution fans out to file-processing workers and rejoins. (declared coverage: no groups declared)
✅ Covered critical paths
  • auth-login — covered by e2e-login
  • adapter-register-llm — covered by integration-backend
  • workflow-author — covered by integration-backend
  • co-owner-manage — covered by integration-backend, e2e-coowners
  • workflow-create-execute — covered by e2e-workflow
  • api-deployment-provision — covered by integration-backend
  • api-deployment-auth — covered by integration-backend
  • api-deployment-run — covered by e2e-api-deployment
  • mcp-server-auth — covered by integration-backend
  • mcp-platform-auth — covered by integration-backend
  • platform-key-whoami — covered by integration-backend
  • prompt-studio-author — covered by integration-backend
  • prompt-studio-fetch-response — covered by e2e-prompt-studio
  • connector-register-test — covered by integration-backend
  • pipeline-etl-execute — covered by e2e-etl
  • usage-aggregate-read — covered by integration-backend
  • usage-token-tracking — covered by e2e-api-deployment
  • callback-result-delivery — covered by e2e-api-deployment

@ritwik-g
ritwik-g requested a review from athul-rs November 7, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

main-only Stays on main: not backported to a release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant