fix(plugins): suppress false duplicate-id warnings across origins#72409
fix(plugins): suppress false duplicate-id warnings across origins#72409vincentkoc wants to merge 2 commits intomainfrom
Conversation
Greptile SummaryThis PR suppresses false duplicate plugin-id warnings that fired when the same plugin ID was legitimately discovered across different origins (e.g., a bundled plugin also installed globally). It introduces two new per-ID tracking maps — The logic is correct across the tested scenarios: cross-origin same-root promotion updates origin tracking before the Confidence Score: 4/5Safe to merge; logic is correct and tests cover cross-origin suppression, same-origin warnings, and the promotion edge case. No P0 or P1 issues found. The implementation correctly suppresses only cross-origin duplicates while preserving same-origin collision warnings and handling origin promotion. Two minor P2 style observations do not affect behavior. No files require special attention; manifest-registry.ts logic is well-tested and the two new tracking maps behave consistently with the existing seenIds path. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/plugins/manifest-registry.ts
Line: 89-91
Comment:
**`SeenRootEntry` is a single-field wrapper**
`SeenRootEntry` wraps only `candidate: PluginCandidate` with no other fields. This is fine for extensibility, but the type could be eliminated in favour of `Map<string, PluginCandidate>` to simplify the data model. If there is a plan to attach more per-root metadata in follow-up work the wrapper makes sense; otherwise it is a no-op indirection.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/plugins/manifest-registry.ts
Line: 527-534
Comment:
**Stale empty Sets linger in `originsForId` after promotion**
`promoteSeenOriginRoot` deletes `rootKey` from the `fromOrigin` Set but leaves that (now-empty) Set in `originsForId`. In practice this has no correctness impact because `hadOriginRoot` correctly reads the empty size as `false`. However, it means `originsForId` silently accumulates empty Sets for every origin that ever had a root promoted away, which could be confusing when debugging or extending this code later.
Consider cleaning up empty Sets after deletion:
```ts
params.originsForId.get(params.fromOrigin)?.delete(params.rootKey);
const remaining = params.originsForId.get(params.fromOrigin);
if (remaining?.size === 0) {
params.originsForId.delete(params.fromOrigin);
}
addSeenOriginRoot(params.originsForId, params.toOrigin, params.rootKey);
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(plugins): suppress false duplicate-i..." | Re-trigger Greptile |
bdf60d8 to
264fd71
Compare
264fd71 to
93d84b2
Compare
|
Codex review: needs changes before merge. Keep this PR open. It is maintainer-authored and has the protected Required change before merge: Keep this PR open for maintainer review. The best path is to decide the duplicate plugin-id diagnostic policy explicitly: if the goal is only same-physical-root false-positive suppression, current Best possible solution: Keep this PR open for maintainer review. The best path is to decide the duplicate plugin-id diagnostic policy explicitly: if the goal is only same-physical-root false-positive suppression, current What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5fe81cdf527b. |
93d84b2 to
bfa867e
Compare
Summary
Credit
This replacement is based on the focused work by @macarronesc in #42192. ProjectClownfish could not safely update that branch because
maintainer_can_modifyis false, so this PR carries the narrow fix forward with attribution.Validation
pnpm -s vitest run src/plugins/manifest-registry.test.tspnpm check:changedFixes #42099.
ProjectClownfish replacement details: