Repository navigation
perf: reuse prepared plugin metadata normalizers - #136063
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 2:53 AM ET / 06:53 UTC. ClawSweeper reviewWhat this changesThis PR reuses the normalizer prepared during plugin-metadata rebasing for local snapshot finalization, while retaining worker-side reconstruction after structured cloning. Merge readiness✅ Ready for maintainer review Keep open. Current main still rebuilds the normalizer after completion and config-wide composition; this branch preserves explicit worker reconstruction while finalizing already-local prepared snapshots. No introduced correctness or security defect was found. Priority: P3 Review scores
Verification
How this fits togetherPlugin metadata snapshots collect immutable plugin manifests, aliases, and ownership facts for configuration, CLI, and Gateway startup. Local composition can retain prepared functions, but worker transfers must restore process-local functions that structured cloning omits. flowchart LR
A[Plugin inventory] --> B[Metadata snapshot]
B --> C[Rebase manifests and aliases]
C --> D{Execution boundary}
D -->|Local composition| E[Freeze and bind cache]
D -->|Worker transfer| F[Rebuild normalizer]
E --> G[CLI and Gateway consumers]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -1. Total -1 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Use the shared finalizer for snapshots that remain in-process, and reserve restoration for worker-transferred snapshots where the function is absent. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR optimizes internal snapshot preparation rather than reporting a user-facing bug. Is this the best way to solve the issue? Yes. The new finalizer centralizes existing freeze/cache binding while preserving reconstruction at the sole worker boundary that requires it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c505a0b65b70. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Parent maintainer review is complete. The stored-data-model notice is a filename-based false positive: this change reuses a process-local alias normalizer and the existing freeze/cache-binding functions. It does not change a database, persisted representation, migration, retention, or concurrency policy. Worker recipients still rebuild their own normalizer unconditionally. The 78 existing tests and actual structured-clone/receiving-cache proof cover that boundary; no migration or upgrade action is required. |
|
Merged via squash.
|
What Problem This Solves
Plugin metadata completion and multi-workspace composition build an alias normalizer during rebase, then immediately discard it through the worker-restoration path. This repeats preparation of the same immutable plugin inventory.
Why This Change Was Made
Finalize prepared local snapshots through the existing recursive-freeze and cache-binding owners. Worker restoration still unconditionally rebuilds its process-local normalizer, including when the input carries a stale function. Inlining the one-call completion wrapper absorbs this distinction while retaining parameter capture order, projection caching, and source/receiving-cache ownership.
Production: 49 additions / 50 deletions, net −1. Tests unchanged. No configuration, persistence, schema, plugin API, or dependency changes.
User Impact
Metadata values, alias precedence, disabled membership, workspace collision rejection, and snapshot immutability are preserved. Completion and workspace composition each avoid one 184-entry alias Map and one 151-reference sorted array on the current 151-plugin fixture. These are observed preparation counts, not an RSS or latency claim.
Evidence
59673aa2cfff7b3aaa5a86aa03d73f71532cda951c12d5bff8243bb72e6f9959, and the same 370 alias answers. Object and collection ordering, undefined/functions, reference contracts, and parameter read order are checked. Two measured timing fields, an independently asserted fingerprint, and the private test-home prefix are normalized.WorkerTaskPool/serveWorkerTasksexchange uses Node structured-clone transport. Both arms receive native Maps without the function, restore exactly once, bind the receiving cache, retain shared graph references, reject mutation, and replace an injected stale normalizer. Both pool closes were awaited.