Skip to content

improvement(search): overlap live search stages and report every unsearched source - #9514

Merged
waleedlatif1 merged 2 commits into
stagingfrom
improvement/live-search-latency
Oct 31, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
improvement/live-search-latency

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Live search ran each account's stages one after another, and its fixed 8-account cap left a second wave of accounts with less time. Accounts that never started reported "Provider search timed out", and accounts past the 20-account limit were dropped silently. This removes serial waits without adding a single provider request.
  • Google service sessions: the member identity and admin Directory lookups run concurrently, and configured subjects resolve concurrently. Results keep the configured order, and the first failure in that order still fails the session. Drive verification stays one subject at a time, exactly as before.
  • Previews:
    • A result's preview read now starts as soon as its own verification permits it, instead of after every candidate is verified.
    • It still covers only the top verified results, so it reads nothing staging didn't.
    • Denied or unverified candidates are never read, and stray reads are cancelled down to the request through the new per-call signal on NativeClient.text/bytes.
  • Scheduling:
    • Every selected account starts at once. Only credential resolution and session open are bounded, at 6 at a time, which keeps the database pool safe.
    • Each account's 12s starts when it gets its slot and is capped by the search's 20s.
    • An account with under 1.5s left is reported "Not searched before the search deadline" instead of timing out.
    • Accounts past the 20-account limit each get an explicit unavailable status.
    • A native query whose only account was cut by the limit is no longer reported as "No connection configured".
  • No contract or status-enum change.

Type of Change

  • Bug fix

Testing

  • New tests, each failing on staging:
    • Google session lookups and subjects overlap.
    • A permitted result's preview starts while others still verify, and a denied candidate is never read.
    • 20 accounts × 3s searches finish in about 3s with at most 6 concurrent resolves.
    • 21 eligible accounts produce 21 statuses.
    • A second wave of accounts keeps its full time, and an account reached too late is reported not searched.
  • Guards: denied preview text never appears; identity errors beat admin errors; a throttle beats unavailable when no subject allows; the first allow wins and a throttled first subject fails before a later one is asked.
  • lib/sim-search/live and lib/core/utils pass (601 tests). bun run lint, block registry check and type-check pass, as does check:audits except check:unused-exports, which flags an apps/docs generated import that isn't built locally. CI runs the full suite.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 31, 2026 8:43am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Live search overlaps independent work and reports accounts that were not searched.

  • Live searches start every selected account without waiting for earlier searches.
  • Permitted results get their previews while other results are still checked.
  • Google service sessions resolve independent identity and source-user checks together.

The previous unnumbered preview-budget finding is fixed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Select eligible accounts] --> B[Open up to six accounts at once]
  A --> C[Report accounts beyond the limit]
  B --> D[Search opened accounts concurrently]
  D --> E[Verify candidates]
  E --> F{Verification shares preview budget?}
  F -->|Yes| G[Start previews after verification]
  F -->|No| H[Start previews as candidates pass]
  G --> I[Attach previews and merge results]
  H --> I
  C --> J[Return results and every account status]
  I --> J
Loading

Reviews (3) · Last reviewed commit: "fix(search): defer previews when verific..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 force-pushed the improvement/live-search-latency branch from e1dca43 to bbca625 Compare October 31, 2026 08:30
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 force-pushed the improvement/live-search-latency branch from bbca625 to f3afc1d Compare October 31, 2026 08:43
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 10 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

This branch was previously deployed

1 inactive deployment
Preview — f3afc1dd Deployed Oct 31, 2026 by vercel[bot]
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