Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION False positive unused file for Vercel vercel.ts config What happened?…

  1. User

    ISSUE DESCRIPTION

    False positive unused file for Vercel vercel.ts config

    What happened?

    fallow dead-code reports apps/web/vercel.ts as an unused file, but Vercel treats vercel.ts as 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:

    The @vercel/config package also treats vercel.ts as the config input:

    Because Vercel discovers this file by convention, Fallow should not report it as unused.

    Reproduction

    Create an app/workspace with a package.json like:

    {
      "name": "@example/web",
      "private": true,
      "type": "module",
      "scripts": {
        "build": "next build",
        "env-pull": "vercel env pull"
      },
      "devDependencies": {
        "@vercel/config": "latest",
        "vercel": "latest"
      }
    }
    

    Create vercel.ts at the app root:

    import type { VercelConfig } from '@vercel/config/v1';
    
    export const config = {
      regions: ['dub1'],
      fluid: true,
      installCommand: 'pnpm install --filter @example/web...',
      devCommand: 'next dev --port 3000',
      crons: [
        {
          path: '/api/jobs/run',
          schedule: '*/5 * * * *',
        },
      ],
    } satisfies VercelConfig;
    

    Run:

    fallow dead-code
    

    vercel.ts is reported as an unused file.

    Expected behavior

    Fallow should treat Vercel programmatic config files as used config entrypoints when Vercel is active.

    At minimum, the Vercel plugin/config detection should mark these app-root files as always used:

    • vercel.ts
    • vercel.js
    • vercel.mjs
    • vercel.cjs
    • vercel.mts

    A fix could add these to the relevant Vercel plugin config/always-used patterns, similar to how other framework config files are protected from unused-file reporting.

    Fallow version

    2.85.0

    Operating system

    macOS

    Configuration

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /fallow, current file: none) bash-$

  2. GLM Assistant

    I'll start by exploring the repository structure to understand the codebase and find the relevant Vercel-related files.

  3. GLM Assistant

    Let me explore the repository structure further, especially looking for Vercel-related files.

  4. GLM Assistant

    Let me look at the plugins directory structure to understand how plugins work in this codebase.

  5. GLM Assistant

    Let me continue looking at the plugins mod.rs to understand the Plugin trait and how config files are handled.

  6. GLM Assistant

    Let me see the rest of the Plugin trait.

  7. GLM Assistant

    Let me look at the registry and check if there's already a Vercel plugin.

  8. GLM Assistant

    Let me look at the nextjs plugin and the wrangler plugin to understand the patterns used.

  9. GLM Assistant

    Now let me look at the nextjs plugin to understand how it handles Vercel-related configurations.

  10. GLM Assistant

    Let me look at how Vercel is referenced in the discover module and understand the activation logic.

  11. GLM Assistant

    Let me look at a simple plugin like commitlint to understand the macro usage pattern, and check the registry tests.

  12. GLM Assistant

    Now let me understand the test infrastructure and reproduce the issue. Let me look at the registry tests file and how plugins are tested end-to-end.

  13. GLM Assistant

    Let me look at the registry helpers and mod to understand how always_used files are processed.

  14. GLM Assistant

    Let me look at the full registry builtin.rs to understand plugin categorization.

  15. GLM Assistant

    Let me check if there's a vercel module declaration already and look at the full module list in mod.rs.

  16. GLM Assistant

    Let me first build the project to understand the build process and reproduce the issue.

  17. GLM Assistant

    Now let me create a test project to reproduce the issue.

  18. GLM Assistant

    I've reproduced the issue. Now let me understand how always_used patterns are matched against files, especially for workspace scenarios.

  19. GLM Assistant

    Let me find where always_used patterns are matched against the file set to mark files as used.

  20. GLM Assistant

    Let me search the codebase for where the always_used patterns are actually consumed for dead-code analysis (i.e., where they mark files as used/protected).

  21. GLM Assistant

    Let me look at how always_used patterns get workspace-prefixed in the registry mod.rs.

  22. GLM Assistant

    The always_used patterns get workspace-prefixed via prefix_if_needed. Now let me check whether vercel.json would also be reported as unused, to understand the full scope.

  23. GLM Assistant

    Interesting - vercel.json is NOT reported as unused, but vercel.ts is. Let me understand why JSON files aren't reported.

  24. GLM Assistant

    JSON files aren't in the source extension set, so vercel.json isn't reported. Now let me look at how convention-based detection works for plugins, examining browser_extension which uses is_enabled_with_files.

  25. GLM Assistant

    Now I have a thorough understanding. Let me create the Vercel plugin. I'll model it after the commitlint/wrangler plugins. Let me first check the define_plugin! macro's full variants to ensure I use the right syntax for imports_only.

  26. GLM Assistant

    Now I have a complete understanding. Let me create the Vercel plugin file.

  27. GLM Assistant

    Now let me register the module in mod.rs and add it to the builtin plugins list.

  28. GLM Assistant

    I'll add the vercel module declaration right after wrangler (alphabetical order).

  29. GLM Assistant

    Now let me register the plugin in builtin.rs. I'll add it to the import and to the "Deployment" section alongside WranglerPlugin.

  30. GLM Assistant

    Let me view the full import block to add vercel::VercelPlugin correctly.

  31. GLM Assistant

    Now I'll add the import and register the plugin. First, the import (alphabetically by module name, between velite and vite):

  32. GLM Assistant

    Now add the plugin to the Deployment section:

  33. GLM Assistant

    Now let me build the project to make sure it compiles.

  34. GLM Assistant

    It compiles. Now let me run the reproduction to confirm the fix works.

  35. GLM Assistant

    The fix works. vercel.ts is no longer reported as unused. Let me verify the entry point detection shows the Vercel plugin and test more edge cases.

  36. GLM Assistant

    The Vercel plugin is now active. Let me test edge cases - all extensions and activation with each enabler separately.

  37. GLM Assistant

    All five extensions are protected. Now let me test activation with only @vercel/config and verify it's NOT protected when Vercel isn't active.

  38. GLM Assistant

    Let me see the full output for the no-deps case to confirm vercel.ts is reported as unused when Vercel is not active.

  39. GLM Assistant

    The behavior is correct. Now let me run the unit tests for the new plugin and verify existing tests pass.

  40. GLM Assistant

    Let me fix the type error in the test - contains on &[&str] needs &&str.

  41. GLM Assistant

    All tests pass. Now let me run the registry tests to ensure the plugin registration works and doesn't break existing tests.

  42. GLM Assistant

    Let me check if there's a test that asserts the count of builtin plugins, which might need updating.

  43. GLM Assistant

    The test doesn't use a brittle count check. Let me check if there are other places that list plugin names that might need updating (schema, knip migration, docs).

  44. GLM Assistant

    Let me understand the context of the knip_tables.rs file.

  45. GLM Assistant

    This is a list of knip-specific plugin keys (knip doesn't have a "vercel" plugin, only "vercel-og" which is already listed). Let me check the schema and docs for plugin lists.

  46. GLM Assistant

    There's a detection rules document. Let me examine its structure to add a Vercel entry for consistency.

  47. GLM Assistant

    Let me view the section around the Wrangler detection entry to add a Vercel entry nearby.

  48. GLM Assistant

    I'll add a detection rule entry for the Vercel plugin, right after the Wrangler entry for documentation consistency.

  49. GLM Assistant

    Now let me check the public-config-corpus.md and any schema that may need a Vercel entry.

  50. GLM Assistant

    Let me check if there are any tests that enumerate all plugin names or check the schema completeness.

  51. GLM Assistant

    The tests check for unique/non-empty names and a critical plugin list — my plugin passes these. Let me run the broader test suites to ensure nothing breaks.

  52. GLM Assistant

    All lib tests pass. Let me run the integration tests for the core crate.

  53. GLM Assistant

    All integration tests pass. Let me run the CLI tests to ensure the migration logic and other CLI tests still pass.

  54. GLM Assistant

    There's a failing test fix_batch_aborts_when_a_target_directory_is_read_only. This looks environment-related (read-only dirs don't apply to root). Let me verify it's pre-existing and unrelated to my change.

  55. GLM Assistant

    Confirmed — that test fails even without my changes (it's a pre-existing environment issue: running as root bypasses read-only filesystem permissions). Let me run the flags and migrate tests specifically since they reference Vercel.

  56. GLM Assistant

    All relevant tests pass. The only failure is pre-existing and environment-related. Let me now test the full reproduction scenario with a realistic node_modules setup to verify dependency crediting works too.

  57. GLM Assistant

    Let me verify dependency crediting more directly with a scenario that isolates the tooling_dependencies behavior.

  58. GLM Assistant

    Even without imports/scripts, the packages are credited as tooling dependencies. Let me test production mode to ensure vercel.ts is still protected there.

  59. GLM Assistant

    Production mode works. Let me verify that a nested vercel.ts (not at the app root) is still correctly flagged as unused, since Vercel only discovers root-level config.

  60. GLM Assistant

    The nested file is correctly flagged. Let me improve the test in the plugin to be more meaningful by actually verifying each extension matches the glob pattern.

  61. GLM Assistant

    All tests pass. Let me run clippy to ensure code quality standards are met.

  62. GLM Assistant

    Let me see the full clippy warning for my file.

  63. GLM Assistant

    The clippy warning is about unnecessary hashes in the raw string literal (content uses single quotes, so r"..." suffices). Let me fix this.

  64. GLM Assistant

    No more clippy warnings. Let me verify the full clippy run completes cleanly and re-run the vercel tests.

  65. GLM Assistant

    Everything is clean. Let me do a final review of all my changes.

  66. GLM Assistant

    Let me fix the alphabetical ordering of the mod vercel; declaration - it should be between velite and vite, not after wrangler.

  67. GLM Assistant

    Now the module is in proper alphabetical order. Let me rebuild and run the tests once more to confirm everything works.

  68. GLM Assistant

    Let me check if there's a typos configuration and verify my changes don't introduce spelling issues.

  69. GLM Assistant

    typos isn't installed, but my changes use standard English. Let me run the full core test suite (lib + integration) one final time to confirm nothing is broken after the module reordering.

  70. GLM Assistant

    Let me run the full lib test suite to confirm the combined count.

  71. GLM Assistant

    All tests pass. Let me verify one more edge case: a root-level vercel.ts (not in a workspace) is also protected.

  72. GLM Assistant

    Root-level vercel.ts is also protected. Let me clean up the temp test directories and do a final review.

  73. GLM Assistant

    Let me do a final review of the complete changes to ensure correctness.

  74. GLM Assistant

    Let me verify formatting conformance with cargo fmt --check on the affected files.

  75. GLM Assistant

    Let me apply cargo fmt to fix the formatting issues.

  76. GLM Assistant

    Formatting is now clean. Let me verify the final formatted state of the changed files and rebuild/test once more.

  77. GLM Assistant

    Everything builds and tests pass. Let me do one final end-to-end reproduction to confirm the fix, then submit.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.