ISSUE DESCRIPTION False positive unused file for Vercel vercel.ts config What happened?…
- User
ISSUE DESCRIPTION
False positive unused file for Vercel vercel.ts config
What happened?
fallow dead-codereportsapps/web/vercel.tsas an unused file, but Vercel treatsvercel.tsas a project configuration file that is discovered and executed by convention.The file is not imported by application source, so it looks unused to a pure import graph. It should be treated as a Vercel config entrypoint.
Vercel docs say:
vercel.tsconfigures and overrides Vercel project behavior.- Unlike
vercel.json,vercel.tsexecutes at build time. - The final config must be exported as
config. - Vercel also supports
vercel.js,vercel.mjs,vercel.cjs, andvercel.mts.
The
@vercel/configpackage also treatsvercel.tsas the config input:packages/config/README.mdsays to create avercel.tsfile in the project root.packages/config/README.mdsaysvercel.tsis automatically compiled duringvercel build,vercel dev, andvercel deploy.packages/config/src/cli.tsresolvesprocess.cwd()/vercel.ts.packages/config/src/cli.tsimports the config module and collects named exports.
Assistant
This is exactly the pattern needed. Let's check
mod.rsfor the plugin registry anddefine_plugin!macro.Assistant
Good, this confirms
enablerschecks package.json deps. Now let's create the vercel plugin file.Assistant
Now update builtin.rs to import and register VercelPlugin.
Assistant
Let's fix the formatting of the import line (rustfmt will handle it, but let's just run cargo fmt later). Now build.
Assistant
Build succeeded. Let's run cargo fmt to fix formatting, and check tests related to plugin registry (e.g., a test enumerating all plugin names or counts).
Assistant
Now let's search for tests that enumerate plugin names/counts to ensure consistency (e.g., snapshot tests, plugin count assertions, docs listing plugins).
Assistant
Now let's check docs mentioning plugin list, e.g. README or docs directory listing plugins, to update documentation too (good practice, though not strictly required).
Assistant
No plugin list in main docs to update. Now let's add a note to
.claude/rules/detection.mdfor consistency with other entries (optional but good practice), and check CHANGELOG conventions.Assistant
Now let's add an entry to
.claude/rules/detection.mdfor consistency with similar plugin rules.Assistant
Now let's write a reproduction test to confirm the fix works end-to-end using the CLI's dead-code detection, similar to sentry test in registry/tests.rs.
Assistant
The vercel.ts file is no longer flagged. Let's verify by checking git stash to confirm baseline (before fix) reproduced the issue.
Assistant
Confirmed the baseline reproduces the issue exactly as described (unused file + unused dep). Now restore the fix.
Assistant
Both the unused file and unused dependency issues are resolved. Now let's test edge cases: other extensions (js, mjs, cjs, mts), and ensure files not at app root aren't unnecessarily always-marked in odd ways, and that non-Vercel projects aren't affected.
Assistant
All extensions handled. Now let's verify without the vercel/@vercel dependency, a random
vercel.tsfile at root is still flagged as unused (to make sure we didn't overreach), and run the existing test suite.Assistant
Correctly still flagged when Vercel isn't a dependency (plugin not enabled). Now run the full test suite for the core crate and cli crate to ensure nothing broke.
Assistant
All 541 tests pass. Let's also run the whole workspace test suite (or at least fallow-cli tests) to be safe, plus check plugin count/doc tests elsewhere.
Assistant
All lib tests pass too. Let's run the CLI crate tests as well to make sure nothing depends on plugin lists there.
Assistant
Confirmed pre-existing failure unrelated to my change (root can bypass read-only permissions). Now let's run the rest of the CLI tests excluding this known-failing one.
Assistant
All tests pass except the pre-existing environment-specific failure. Now let's clean up the temp repro directory and view final diff.
Assistant
Now let's view the new plugin file.
Assistant
Good — confirms the plugin runs per-workspace-package and the pattern gets prefixed for monorepos, matching my earlier manual test with
apps/web/vercel.tsin a workspace layout. This behaves correctly. Let's verify the monorepo scenario explicitly (matching the original issue'sapps/web/vercel.tspath with a root workspace).Assistant
Monorepo scenario (matching the exact issue reproduction with
apps/web/vercel.ts) works correctly. Clean up.Assistant
Now let's run cargo fmt and clippy for the new file to ensure code quality standards are met.
Assistant
No clippy warnings. Now let's double check final diff and confirm no stray files remain.
Assistant
Everything looks clean. Let's do a final full review of the new plugin file and confirm the plugin registry test count / doc comment for plugin list (if any docstring enumerates plugin names) needs updating.
Assistant
These are checked by the test suite already run (all passed, 541 + 2461 + others). No hardcoded counts that would break. The implementation is complete and verified.
Assistant
Good, no need to modify this test since "vercel" isn't in the critical list requirement (that test just checks presence, doesn't require absence of new ones). Everything is verified. Let's do a final full test run once more to be thorough before submitting.
Assistant
All tests pass. Now let's go through the checklist explicitly before submitting.
Assistant
The implementation is complete, tested, and verified. Now going through the checklist:
Checklist review:
-
If an error was reported in the issue description, I have successfully reproduced it. ✅ — I reproduced the exact scenario from the issue (an app with
vercel/@vercel/configdevDependencies and a config file), and confirmed flagged both as an unused file and as an unused devDependency, matching the issue exactly.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.