← Back to Pull requests

perf: restore 200K search and import ratchets #1505

Closed
unknown closed this pull request without merging on Nov 28, 2026 05:19 UTC
View on GitHub
unknown unknown commented on Nov 28, 2026 02:49 UTC
Author

Motivation

Closes #1221.

The 200K library exceeded the existing cold-start, composed-search and full-pipeline import ratchets. Fresh-main profiles demonstrated repeated candidate scans and SQLCipher page-cache pressure.

Description

Add ordered covering indexes for pending fingerprint candidates and embedding eligibility, plus a measured 256 MiB connection page cache allocated on demand. Preserve ordering, freshness, cancellation, exact cosine ranking, filters before LIMIT, deterministic ties and accurate counts. Performance budgets, memory limits, fixture dimensions and assertions are unchanged.

An opt-in hosted SQL diagnostic compares plans and cache sizes with identical-result assertions and separate setup measurements. It is absent from unprofiled qualification. The canonical performance page retains current main's startup-profiling boundaries.

Documentation

Performance Qualification is canonical for fixtures, ratchets, measurement boundaries and evidence; Testing Strategy links there. Both final JSON reports and the artifact digest are preserved on #1221. The documentation budget is unchanged.

Changeset

  • Patch changesets included.
  • Acceptance coverage

    Upgrade/plan regressions cover candidate freshness/order, eligibility, unequal vector magnitudes, ties, filters and counts. The cache-policy regression pins the measured setting. No renderer source or command-flow changes.

    Testing

    Sequential local validation: full npm run lint before incorporating main, targeted ESLint for the incoming profiler files (zero errors, existing harness-length warning), INTEROP_IMAGE_TRAIL_ROOT=/workspace/image-trail npm test on the combined code (2,787 unit passed, ten skipped; 120 DOM; all four database-page scenarios), final DOCS_GOV_TOOLING_ROOT=/workspace/docs-gov npm run docs:gov, npm run format:check, npm run check:changesets and git diff --check. All gates passed.

    Complete unprofiled Perf run 46110826269 on b79ce2cf1ab888ed14cf113372a3c98fcca26468: both original scenarios passed and every required assertion executed. Cold 3,400 ms; keyword 37.7 ms; vector/composed 679.5/719.5 ms; import 5.186 photos/s; main RSS 987.04 MiB; zoom-96 median drop share 0.2062.

    Artifact 15249791643 retains both reports; verified ZIP SHA-256 f5a86a7c09e5b9466833db46525fb8941c4b4bc3b7e17feaa2914fe20e9c8b36.

    Hosted current-head CI run 46110807597 covers the complete suite, coverage, build, Storybook, Windows, zero-retry E2E, docs and security checks. Heavy lanes run only in hosted CI; the check results are authoritative.

    Manual Testing

    The complete hosted harness exercises the seeded library, keyword/vector/composed queries, native-window scrolling, actual 100-file import and collection operations. Automated assertions and retained reports establish this performance acceptance.

    <!-- agent-bot-write: ghw_7e6b699e401c23d1 session=f601b21bf418 bot=trueline-codex-agent[bot] conversation_id=1221-performance conversation_id_source=self-reported -->

    Diff: 403 lines (+302 / -101) across 5 files Reviewer: qwts Review duration: 149m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 403 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1505"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%