fix(vercel): conditionally import listAll only when lookup method is generated #168

Merged
stack72 merged 1 commit from fix/vercel-unused-listall-import into main 2026-08-03 13:42:39 +00:00
Owner

Summary

  • Fixes the unconditional listAll import in codegen/vercel/extensionModelGenerator.ts that caused deno lint no-unused-vars errors in 4 models lacking a lookup method
  • listAll is now only included in helperImports when resource.listPath || resource.paginationStyle !== "none" — the same guard used for lookup method generation
  • Regenerated all 28 Vercel models; only the 4 affected models changed (import removed, version bumped, upgrade stanza added)

Affected models

  • access-groups/projects — no lookup method generated
  • blob-storage/blob — no list endpoint exists
  • edge-config/token — no lookup method generated
  • teams/request — no lookup method generated

Verification

  • Second generation run produced 0 diffs (idempotency confirmed)
  • deno lint, deno check, deno fmt --check all pass on affected directories
  • CalVer bumped exactly the 4 affected services — no extras

Closes #1515

🤖 Generated with Claude Code

## Summary - Fixes the unconditional `listAll` import in `codegen/vercel/extensionModelGenerator.ts` that caused `deno lint` `no-unused-vars` errors in 4 models lacking a lookup method - `listAll` is now only included in `helperImports` when `resource.listPath || resource.paginationStyle !== "none"` — the same guard used for lookup method generation - Regenerated all 28 Vercel models; only the 4 affected models changed (import removed, version bumped, upgrade stanza added) ## Affected models - `access-groups/projects` — no lookup method generated - `blob-storage/blob` — no list endpoint exists - `edge-config/token` — no lookup method generated - `teams/request` — no lookup method generated ## Verification - Second generation run produced 0 diffs (idempotency confirmed) - `deno lint`, `deno check`, `deno fmt --check` all pass on affected directories - CalVer bumped exactly the 4 affected services — no extras Closes #1515 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(vercel): conditionally import listAll only when lookup method is generated
All checks were successful
CI: Models / model/digitalocean - check (pull_request) Successful in 1m21s
CI: Models / model/hetzner-cloud - check (pull_request) Successful in 1m5s
CI: Models / model/digitalocean - lockfile up to date (pull_request) Successful in 1m5s
CI: Models / model/hetzner-cloud - lockfile up to date (pull_request) Successful in 1m3s
CI: Models / aws models - sample check (pull_request) Successful in 1m26s
CI: Models / aws models - lockfiles up to date (pull_request) Successful in 1m18s
CI: Models / gcp models - lockfiles up to date (pull_request) Successful in 1m20s
CI: Models / gcp models - sample check (pull_request) Successful in 1m37s
CI: Models / cloudflare models - sample check (pull_request) Successful in 1m6s
CI: Models / cloudflare models - lockfiles up to date (pull_request) Successful in 1m2s
CI: Models / vercel models - lockfiles up to date (pull_request) Successful in 1m0s
CI: Models / vercel models - sample check (pull_request) Successful in 1m17s
CI: Models / codegen - fmt (pull_request) Successful in 1m11s
CI: Models / codegen - lint (pull_request) Successful in 1m3s
CI: Models / codegen - lockfile up to date (pull_request) Successful in 1m3s
CI: Models / codegen - check (pull_request) Successful in 1m46s
CI: Reviews / Detect Changes (pull_request) Successful in 58s
CI: Reviews / CI Security Review (pull_request) Has been skipped
CI / Actions Audit (pull_request) Successful in 1m12s
CI: Models / Gate: Models (pull_request) Successful in 29s
CI: Reviews / Adversarial Code Review (pull_request) Successful in 2m39s
CI / Dependency Audit (pull_request) Successful in 4m6s
CI: Reviews / Claude Code Review (pull_request) Successful in 3m37s
CI / Gate: Audit (pull_request) Successful in 32s
CI: Reviews / Gate: Reviews (pull_request) Successful in 30s
656e1bc883
The Vercel model generator unconditionally imported listAll for every
model, but 4 models don't generate a lookup method (no list path or no
filterable fields). This caused a deno lint no-unused-vars error that
blocked swamp extension push for access-groups/projects,
blob-storage/blob, edge-config/token, and teams/request.

Now listAll is only included in helperImports when the model will
actually generate a lookup method, matching the existing conditional
pattern for read, tryRead, remove, and update imports.

Closes #1515

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

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 listAll import behind the same condition (resource.listPath || resource.paginationStyle !== "none") that guards the lookup method where listAll is the sole consumer. The paginationStyle type is "cursor" | "none" (never undefined), so the !== "none" check is safe. The four possible combinations of listPath (string | null) × paginationStyle ("cursor" | "none") all produce consistent import-vs-usage behavior. Clean, minimal fix.

## 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 `listAll` import behind the same condition (`resource.listPath || resource.paginationStyle !== "none"`) that guards the lookup method where `listAll` is the sole consumer. The `paginationStyle` type is `"cursor" | "none"` (never undefined), so the `!== "none"` check is safe. The four possible combinations of `listPath` (string | null) × `paginationStyle` ("cursor" | "none") all produce consistent import-vs-usage behavior. Clean, minimal fix.
Author
Owner

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

  1. Extract the shared condition to a named constant. The boolean expression
    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.
## 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 1. Extract the shared condition to a named constant. The boolean expression 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.
stack72 deleted branch fix/vercel-unused-listall-import 2026-08-03 13:42:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
swamp-club/swamp-extensions!168
No description provided.