Repository navigation
chore(scripts): prevent new wrapper shadowing - #121456
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
92b7775 to
b7c78d2
Compare
b7c78d2 to
e00f8ed
Compare
|
Coordination note (session handoff): this PR extends the canonical collision checker (#121300) with detection of behavior-adding same-name wrappers — the class #121300 deliberately exempts via its forwarding-only detection. Verified complementary, not duplicative: only 2 of this PR's top-10 shadowed names appear in the canonical baseline. The simplification campaign session owns plan 04 and has CI green on head e00f8ed, autoreview clean, baseline seeded with 77 violations. |
|
Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 2:50 AM ET / 06:50 UTC. ClawSweeper reviewWhat this changesThis PR adds a baseline-backed static check that rejects newly introduced same-name exported wrappers around imported implementations and runs it in aggregate and changed-file CI. Merge readiness✅ Ready for maintainer review Keep open. This active maintainer PR adds a focused, source-backed CI guard; no concrete correctness or security defect was found in the reviewed head. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s script checks parse TypeScript source to enforce repository architecture rules. This guard reuses the export-analysis layer, compares detected wrapper relationships with recorded debt, and feeds failures into contributor CI. flowchart LR
A[TypeScript source] --> B[Export analysis]
B --> C[Wrapper-shadowing detector]
D[Debt baseline] --> C
E[Changed paths] --> F[Changed-check planner]
F --> C
C --> G[Architecture and CI checks]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +146, Config +2, Other +876. Total +1024 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Retain one shared AST-analysis path and land the baseline-backed guard after normal maintainer review of the exact head. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a preventive static-analysis check, not a report of broken runtime behavior; its fixture scenarios define the relevant failure shapes. Is this the best way to solve the issue? Yes. Extending the existing export-analysis owner is preferable to adding another parser, and the check is connected to both architecture and changed-file paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 98d1397a9de3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
e00f8ed to
00acd8c
Compare
|
Merged via squash.
|
* chore(scripts): prevent wrapper shadowing * chore(scripts): refresh wrapper baseline
What Problem This Solves
The repository had no permanent check for same-name wrapper shadowing, so a refactor could reintroduce the naming hazard removed by #121308 and related cleanup: an inner implementation and its behavior-complete outer wrapper could both export the same canonical name.
Why This Change Was Made
This adds a wrapper-shadowing guard that extends the existing export-collision AST analysis instead of introducing a second symbol parser. It follows direct imports and one pure re-export hop, exempts pure re-exports, seeds all 77 current violations as baseline debt, and fails only when a new directed wrapper relationship appears. Existing violations are intentionally unchanged for the separate burn-down PR.
The guard is wired beside deprecated-API hygiene in aggregate checks, architecture CI, and changed-file routing. This is an AI-assisted, maintainer-directed implementation for Refactor plan 04, PR 1 of 2.
During CI, #121434 briefly left the synthetic merge with Plugin SDK hash drift. Rebasing onto current
mainincorporated the upstream generated refresh; the final diff contains no SDK manifest change.User Impact
There is no runtime user-visible change. Contributors now get a deterministic CI failure when new code gives an inner implementation the canonical name that belongs to its behavior-complete wrapper; removing existing baseline debt remains allowed.
Evidence
node --import tsx scripts/check-wrapper-shadowing.mts— passed with 77 current / 77 baselined violations.node scripts/run-vitest.mjs test/scripts/check-wrapper-shadowing.test.ts test/scripts/check-export-name-collisions.test.ts test/scripts/changed-lanes.test.ts— 181 tests passed on the rebased head.node scripts/check-changed.mjs— passed, including scripts/test-root typechecks, script lint, package-lock validation, SDK checks, and the new guard. Remote providers were unavailable, so the repository wrapper used its documented trusted-source local fallback.node scripts/check-changed.mjs --dry-run -- scripts/check-wrapper-shadowing.mts scripts/check-export-name-collisions.mts scripts/lib/wrapper-shadowing-baseline.json— selectedpnpm check:wrapper-shadowing.node --max-old-space-size=8192 --import tsx scripts/generate-plugin-sdk-api-baseline.ts --check— passed on the final rebase; no SDK manifest delta remains.node scripts/run-vitest.mjs test/scripts— 1,471 tests passed; two unrelated host-load timing cases failed. The focused rerun clearedbench-cli-startup.test.ts;bench-sqlite-reliability.test.tsrepeated its existing 300-second reliability timeout. No files in either benchmark are touched here..agents/skills/autoreview/scripts/autoreview --mode local --stream-engine-output— clean; no accepted/actionable findings.