fix(vercel): conditionally import listAll only when lookup method is generated #168
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/vercel-unused-listall-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
listAllimport incodegen/vercel/extensionModelGenerator.tsthat causeddeno lintno-unused-varserrors in 4 models lacking a lookup methodlistAllis now only included inhelperImportswhenresource.listPath || resource.paginationStyle !== "none"— the same guard used for lookup method generationAffected models
access-groups/projects— no lookup method generatedblob-storage/blob— no list endpoint existsedge-config/token— no lookup method generatedteams/request— no lookup method generatedVerification
deno lint,deno check,deno fmt --checkall pass on affected directoriesCloses #1515
🤖 Generated with Claude Code
Adversarial Review
Critical / High
No critical or high severity findings.
Medium
No medium severity findings.
Low
No low severity findings.
Verdict
PASS — The change correctly gates the
listAllimport behind the same condition (resource.listPath || resource.paginationStyle !== "none") that guards the lookup method wherelistAllis the sole consumer. ThepaginationStyletype is"cursor" | "none"(never undefined), so the!== "none"check is safe. The four possible combinations oflistPath(string | null) ×paginationStyle("cursor" | "none") all produce consistent import-vs-usage behavior. Clean, minimal fix.Code Review
Blocking Issues
None.
Summary
This PR fixes a codegen bug where listAll was unconditionally imported even
for resources that never use it. The fix aligns the import guard on line 58 of
extensionModelGenerator.ts with the identical guard on line 347 that controls
whether the lookup method (the sole consumer of listAll) is emitted.
Before this fix, resources with no listPath and paginationStyle of "none"
would receive an unused listAll import in their generated file, causing a lint
error. Now listAll is only added to the import when the lookup method will
actually be generated.
The model file changes are legitimate codegen regeneration outputs: projects.ts,
blob.ts, token.ts, and request.ts each had the unused listAll import removed,
received a version bump, and got a matching upgrade entry. CLAUDE.md compliance
is satisfied because the model file changes accompany a codegen/ change.
Suggestions
controlling whether listAll is imported (line 58) is identical to the one
controlling whether the lookup method is emitted (line 347). Hoisting it to a
named local variable such as "hasListMethod" before both uses would prevent
future divergence if the condition ever needs to change.