Repository navigation
perf(plugins): prepare catalog source references once per filter - #138312
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
This keeps the optimisation at the right snapshot boundary: one filter invocation owns one prepared source-reference set, but nothing survives into a later call, so configuration mutations remain observable. The mixed-source regression is the key one because caching only a manifest or first candidate would incorrectly admit partially unknown entries. Good that empty batches stay lazy too. No blocking issue from this diff.
|
@clawsweeper re-review The current head is |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 11:54 AM ET / 15:54 UTC. ClawSweeper reviewWhat this changesThis PR prepares configured catalog source references once for each catalog-entry filtering call and expands regression coverage for mixed and refreshed source configurations. Merge readiness✅ Ready for maintainer review Keep this maintainer PR open: current main and the latest stable release retain the old per-entry construction, while the introduced change preserves the source-validation predicate without adding a cross-call cache. No actionable regression was found. Priority: P3 Review scores
Verification
How this fits togetherOfficial external plugin catalogs feed plugin listing and package lookup in the management service. The filter validates each feed entry’s declared installation sources before those entries are exposed to catalog consumers. flowchart LR
A[Hosted catalog feed] --> B[Catalog loader]
C[Configured source profiles] --> D[Source reference snapshot]
B --> E[Entry source validation]
D --> E
E --> F[Filtered catalog entries]
F --> G[Plugin listing and lookup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -14, Tests +35. Total +21 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain one lazy source-reference snapshot per filter invocation, preserving complete candidate validation and fresh configuration evaluation on later catalog loads. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is an internal performance refactor rather than a report of broken user-facing behavior. Is this the best way to solve the issue? Yes. A lazy per-call snapshot removes repeated preparation without an eager empty-batch read or a stale cross-load cache. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d58c93f334ce. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Official plugin listing, package lookup and distribution classification repeatedly reconstruct the same source-reference sets while validating one catalog batch. This adds avoidable work to catalog-backed management operations.
Why This Change Was Made
Prepare the allowed source references once at the synchronous filter boundary, then validate every candidate against that snapshot. Remove the unused private error-array builder. The public validation helper retains its existing result and ordering, and empty batches remain lazy. Nothing is cached across calls: later configuration mutations are still observed.
Production: 24 additions / 38 deletions, net −14 lines. Tests: 42 additions / 7 deletions, net +35. No schema, configuration, network, persistent-store or public API change.
User Impact
Catalog-backed operations do less repeated preparation without changing which entries are accepted, their order, identity or validation errors. This is a focused local improvement; it does not establish faster Gateway startup or model turns.
Evidence
6ceb2020; the existing dependency update is separately acknowledged, not treated as a whole-tree equivalence claim.Whole-export source measurement on Node 26.8.1: one fixed before/candidate/candidate/before cohort, eight rows, 846,088 calls and 512 measured batch means. It uses the normal repository source loader and actual exported operations, with full boundary/control readback. No copied implementation or private-helper-only timing.
The tradeoffs remain in the evidence. All 34 adverse entries are retained: 27 blank-path observations, three first-call observations and four RSS observations. Listing p95 batch means improve only about 4.1%; blank-path p95 rises 73.2–93.4% (9.7–11.9 ns). Known lookup has one +22 μs first observation; explicit metadata has +9.0/+7.4 μs first observations. Kernel RSS rises 0.85–1.40%, and sampled process-tree peak rises 1.38–1.98%; no memory reduction is claimed.
These are fixed-order local batch measurements, not confidence intervals. With 16 means, p95 is the largest batch mean, not individual-call p95. Row-first observations follow controls and exclude cold imports. Setup, hosted catalogs, persistence, built distribution, Linux, Gateway startup and whole turns are outside the measured claim. All four processes exited successfully and their recorded process groups were verified closed. No aggregate threshold was invented after observing the results.
Retained measurement report SHA-256:
b031ce1b3c26d29b8da9aa8ebad6edb9d14b0937ef40686650855ebd48fbc6ba.Focused proof commands: