Skip to content

v3.43.0: constant-parameter rule, fallow audit --staged, and mutation replay

Choose a tag to compare

@BartWaardenburg BartWaardenburg released this 13 Nov 22:24
· 575 commits to main since this release
Immutable release. Only release title and notes can be modified.
v3.43.0
65ff0b9

Features

  • The new opt-in rule constant-parameter reports a parameter that each call passes in one way. The finding gives the reason identical-argument when each visible call passes the same value. It gives never-passed when no call passes an optional parameter. For a destructured options parameter such as { retries = 3, signal }, option_key names each key that no call sets, or that each call sets to the same value. Turn the rule on with fallow dead-code --constant-parameters or rules.constant-parameters. The default is off, and the rule has no automatic fix. The rule reports only when it sees each caller. It skips public API and entry-point exports, dynamic imports, CommonJS and functions with fewer than 2 calls. With --type-aware, the rule also reports the reason unused-default and reads the methods of exported classes. These findings have evidence: "type-aware". (#4491, #4516)
  • fallow audit --staged audits the staged index, not the working tree. The changed files are the staged changes against HEAD, and the analysis reads each file from the index. Unstaged edits and untracked files do not change the result of the audit. When Git gives the hook another index file (git commit -a, git commit <path>), the audit reads that index. --staged does not take --base or --changed-since.
  • fallow mutation inspect <id> --replay calls the mutated function on the original code and on the mutant. Pass the arguments with --args '[2, 3]'. The replay calls the export three times on each side and shows the results side by side. A difference that each call repeats is a witness. A test with this input can kill the mutant. Equal results are no_witness_found, never equivalent. The Vitest and node:test runners replay, and the JSON output adds the replay object.
  • fallow mutation --record-args values records the arguments of the changed exported functions. --replay without --args then replays up to 3 recorded inputs and stops at the first witness. Recording is off by default and runs after the mutant runs, so it never changes a result. The inputs stay in the gitignored cache directory for 7 days. Fallow does not keep an input with a secret. --record-args shapes keeps only the argument types.
  • fallow mutation tasks gives a ready test input for a survivor. After a --record-args values run, fallow mutation tasks replays the recorded inputs of up to 20 open tasks. A task then gets a witness with the result of the current code, the result of the changed code and the --replay command. A test with that input that asserts the current result kills the mutant. The MCP tool mutation_tasks gives the same field.
  • The new opt-in mutation operator nullish-fallback removes the fallback of a ?? b. Name it in --operators or mutation.operators. A survivor shows that no test gives a nullish left operand. With --typecheck, a survivor gets the hint type-non-nullish when the declared type of a excludes null and undefined. A negate-condition survivor can now also get equivalence_hint: "constant-parameter" when the condition is a parameter p, !p or !!p, and each visible call passes the same literal for p. The status stays survived, and the score does not change. (#4502)
  • The focus map of the review brief ranks changed files also by churn, complexity growth, test reach and surviving mutants. The score of a focus unit can have the new components churn, worsened, test_reach and mutation. The new fallow audit --mutation-report <file> flag reads a saved fallow mutation --format json report for the mutation component. These components can change total, the label and the rank order of a unit. triage.risk_class does not change. (#4505)
  • The agent task matrix and the fallow skill now name fallow mutation. The matrix has the row "improve or check the tests of a change" with fallow mutation --plan --base <ref>. The row is in fallow --help, fallow schema, the fallow://task-matrix MCP resource and the AGENTS.md block of fallow init --agents and fallow hooks install --target agent. The skill has a short workflow for the tests of a change.
  • fallow architecture --shared-state lists direct writes through imported values and custom global read and write sites. The observations have human, JSON and Markdown output. They are not in the finding totals and gates. They make no claim about runtime identity or execution order.
  • health.tailwindIgnorePatterns excludes intentional Tailwind arbitrary values. Each regular expression matches a normalized prefix-[value] token, so -mt-[7px] and mt-[7px] both match as mt-[7px]. Fallow removes matching classes from the token-drift findings and analytics, also in CVA variants. The default excludes nothing. Thanks @DrJKL for the patch in #4421.
  • fallow security says when client-server-leak checked nothing. The rule starts only from files with a top-level "use client" directive. When no such file exists, the run records the client-server-leak-no-client-roots workspace diagnostic. The human output prints a blind-spot line, and MCP adds a warnings sentence. Thanks @cr101 for the report. (#4430)
  • A stored security verdict now survives an edit that moves the sink to another line. Each fallow security finding has a new stable_finding_id of the form sec1:<16 hex digits>. Whitespace, comments, line breaks and an edit above the sink do not change it. fallow security survivors accepts this id or finding_id in a verdict. The location-based finding_id and the SARIF fingerprint do not change. A sink in Vue, Svelte or Angular template markup has no stable_finding_id. Thanks @cr101 for the report. (#4429)
  • fallow audit prints a note when it compared no changed file. The note goes to stderr, also under --quiet. The GitHub Action prints the same fact as a ::warning::, and the GitLab template as a WARNING: line. The usual cause is a push to the default branch. The warning names the base ref and tells how to give a base. The job result does not change.

Changed

  • npm install fallow no longer installs the type-aware companion and TypeScript 7. The install is about 30 MB smaller on every platform. Default analysis does not use the companion. If you use --type-aware, read the upgrade notes.
  • npm install fallow on Linux installs one platform binary, not two. The Linux platform packages now declare libc, so npm, pnpm, Yarn Berry and Bun install only the glibc or the musl package. The install is 56 to 59 MB smaller on linux-arm64 and 65 to 71 MB smaller on linux-x64. Yarn 1 does not read libc and still installs both.
  • The @fallow-cli platform packages no longer contain the similar-code companion. Each platform package is 7 to 12.5 MB smaller. The release archives on GitHub keep the companion next to the CLI binaries.
  • The install hint for a missing companion uses the package manager of the project. The hint shows pnpm add -D, yarn add -D or bun add -d for a project that uses pnpm, Yarn or Bun. At the root of a Yarn 1 workspace project, Fallow adds -W to its suggested Yarn commands. The -W flag also goes into the fallow doctor fix commands and the sidecar install of fallow coverage setup. (#4519)
  • The MCP server refuses a response over 1,000,000 bytes. The refusal body has a new narrow array with the parameter names that make the output smaller, for example issue_types, file and workspace on analyze. On a large public monorepo, an unfiltered analyze returned 5.6 MB and find_dupes returned 9.2 MB. Both now get a valid refusal with code: FALLOW_MCP_SUBPROCESS_OUTPUT_LIMIT.
  • The generated pre-commit hook runs fallow audit --staged. fallow hooks install --target git, fallow init --hooks and the Lefthook hint now audit the commit that Git is about to make. Before, an untracked file could block a clean commit. Before the first commit of a repository, the hook skips the audit and prints one line on stderr.
  • fallow audit --gate new-only reports the unused files and unused exports that a change creates outside the changed files. A change can remove the last import of a file, or a config change can remove an entry point. The audit now marks such a finding introduced: true and counts it in attribution.dead_code_introduced. A finding that the base also reports stays out of the report. When the change touches the config file, the audit runs one more dead-code pass on the base commit, with the config of the base commit.
  • fallow mutation --kill-matrix-for gives baseline-failure only to the targets that the failure can affect. Before, one broken test anywhere in the suite made every target incomplete. A target can now be complete in a run with baseline failures. The top-level status, reasons and completion do not change. The human report names the baseline failures of each target. (#4469)
  • The fail-on-issues count of the GitHub Action and FALLOW_FAIL_ON_ISSUES of the GitLab template follow rule severity for dead code. On dead-code, check, architecture and the dead-code part of the combined run, only error findings fail the job. This is the same rule as the CLI exit code. Before, a warn finding also failed the job while the comment and the CLI said that the run passed. See the upgrade notes for older fallow versions.
  • The human fallow health output says when CRAP scores are a static estimate. Without a coverage file, one note above the complexity findings tells you to pass --coverage <coverage-final.json> for measured scores, or to raise health.maxCrap. The --file-scores footer and the --coverage help use the same terms. The CRAP formula and the JSON output do not change.
  • --type-aware does less checker work. The symbol scan keeps only the aliases that can lead to a checked target. The semantic pass skips files below node_modules and declaration files by their name. On a large public repository, the scan uses about 30% less CPU, and a request transfers 4,006 files instead of 10,130. The results do not change.

Bug fixes

  • fallow mutation runs more test suites without a false baseline failure.
    • A Vitest test that uses a test.extend fixture no longer fails with FixtureParseError. Thanks @andrius-kr for the report. (#4423)
    • The dry run gives each test three times the test timeout of the project, so a test that is close to its timeout no longer becomes a baseline failure. (#4409)
    • A test that runs a source function in another realm, such as a node:vm context, no longer fails with ReferenceError. Thanks @cr101 for the report. (#4438)
    • With Vitest, code that reads import.meta.env now sees a vi.stubEnv value. (#4470)
  • fallow mutation handles more run shapes correctly.
    • --kill-matrix-for no longer stops the run for one target that selects no test. That target gets the status incomplete and the reason unmatched-target. Thanks @cr101 for the report. (#4439)
    • Build-tool code that no test can reach gets the prune reason framework-config or build-tool-only, so it no longer lowers the coverage. (#4471)
    • --recheck without --mutant now keeps the earlier results with carried: true and replaces the --report file. (#4477)
    • --plan and fallow doctor report an unsupported Vitest version before a run starts. Doctor has a new mutation-runner check. (#4465)
  • fallow dead-code credits more packages, members and files.
    • A package that the inline tool config of a workspace package.json names, such as "prettier": "@acme/config-prettier". Thanks @stanlrt for the report and the patch in #4527. (#4530)
    • A package that a stylesheet url() names, for example a font package in an @font-face rule. Thanks @stanlrt for the patch in #4528.
    • The modules that a Stylelint config names in extends, plugins and customSyntax, in every config form. Thanks @stanlrt for the patch in #4526.
    • The shared config packages that extends in biome.json or biome.jsonc names.
    • A binary that a script runs through its node_modules/.bin path, for example ./node_modules/.bin/<name>.
    • The packages that agent hook commands in .claude/settings.json and .codex/hooks.json run.
    • A class member that code reads through Pick, Omit, Partial, Required, Readonly or NonNullable of the class.
    • A Durable Object method that a Worker calls through an RPC stub.
    • A hand-written declaration file such as lib.d.mts, through an import of its JS sibling ./lib.mjs.
    • The pattern branch of a conditional import() source.
  • fallow dead-code reports fewer false unused files and dependencies.
    • The arguments of cp, mv and other file utilities in package scripts no longer become entry points. (#4455)
    • A quoted jq filter in a CI run step no longer becomes an entry pattern. Thanks @rezamuliawijaya for the patch in #4418 and @deniskern for the report. (#4380)
    • A vite.config.* file in a workspace package is an entry point when only the root manifest lists vite or vite-plus.
    • A dependency that only a framework or build config file imports, such as astro.config.mjs, is no longer test-only.
    • An alias import of a gitignored generated path, such as @/.next/types/routes, is no longer unresolved.
    • A Nuxt #layers/<name>/ import resolves to the named local layer first. It resolves to the project root when the root nuxt.config sets $meta.name. A missing target through a named layer alias now reports as an unresolved import.
  • A fallow-ignore-next-line or fallow-ignore-file marker in a JSDoc comment now takes effect. A block comment accepts a marker at the start of any of its lines. A next-line marker applies to the line after the closing */. This applies to every analysis and to Vue, Svelte, Astro, MDX, HTML and CSS files.
  • The Git hook and the agent gate find a working fallow. The hook now looks in PATH, then ./node_modules/.bin/fallow, then yarn exec fallow, then npx --no-install fallow. Before, the hook accepted every commit with no message when PATH had no fallow. Both now use an install only when --version prints a fallow version. When a launcher exists but no install works, both block the commit and name the launcher. When no install exists, the hook still accepts the commit and prints fallow-hook: fallow not found (...), skipping the pre-commit audit. on stderr.
  • --type-aware gives more correct results. A read no longer confirms a setter as used, and a write no longer confirms a getter. A strict-mode name error under // @ts-ignore or // @ts-expect-error no longer blocks the type evidence of the whole program.
  • fallow security gives fewer false findings and clearer errors.
    • A spawn or spawnSync call that runs no shell now uses the execFile gate. A program path from a file of the repository or from an environment variable is now clean.
    • --gate new no longer says that it reports on the whole project when it cannot resolve --changed-since. The run prints only the gate error and exits 2. Thanks @cr101 for the report. (#4431)
  • fallow audit reports fewer false introduced findings. A skip-only weakened test no longer appears for a skip marker that the base already had. A one-line edit in one copy of a clone splits the clone group into smaller groups. Such a group is now inherited when each instance lies inside a different instance of one base clone group.
  • Each run of a multi-analysis SARIF document has its own category. Before, GitHub code scanning rejected the upload, because the dead-code run and the health run had the same category. Bare fallow --format sarif now gives the ids fallow/dead-code/, fallow/dupes/ and fallow/health/. fallow audit --format sarif gives ids that start with fallow/audit/. The SARIF of a single command does not change.
  • The pull-request comment says "Quality gate failed" when an enforced gate failed. Before, the heading said "Quality gate passed" when the diff filter dropped every finding of a failed run.
  • The GitHub Action installs the fallow version of a pnpm or Bun catalog. Before, a "fallow": "catalog:" dependency made the Action install the latest release.
  • The GitLab CI template no longer fails the job when the installed fallow has no fallow report. For a pin older than 3.4.2, the template runs the analysis again with --format codeclimate. (#4481)
  • After git fetch --unshallow or git fetch --deepen, the next run reads the full history again. Before, hotspots and change coupling still showed the shallow history.
  • The setup hint of a bare fallow run names npx fallow when npx started fallow. Before, the hint said fallow init, which usually fails after npx with fallow: command not found.
  • fallow migrate tells you when it skips a TypeScript source config. It names the .ts file and tells you to convert it to JSON first. The exit code stays 2.
  • Fallow Impact no longer records a run on a project in a system temp folder. Test fixtures and throwaway clones made fallow impact --all and the MCP tool impact_all slow. (#4555)
  • Fallow keeps the parse errors of embedded scripts. Fallow also keeps the note that it cut an object at the property-depth limit, and it discards stale parse caches. The inventories and the parse-error gates then report the source that Fallow could not read.
  • A cache.dir in a config file must be inside the project. A committed .fallowrc.json with an absolute cache.dir, such as /home/user, made fallow write its cache files and a .gitignore with * in that directory. See the upgrade notes.

Upgrade notes

  • A project that uses the type-aware companion must install it. This applies to --type-aware, mutation --typecheck and typeAware in the config. Install the companion at the same version as fallow:

    • project: npm install --save-dev fallow-type-aware@<fallow version>;
    • global: npm install --global fallow-type-aware@<fallow version>;
    • npx: npx -p fallow@<version> -p fallow-type-aware@<version> fallow.

    The GitHub Action and the GitLab template install the companion themselves. Without the companion, --type-aware keeps the syntactic findings and its warning names the install command.

  • A project that uses fallow similar-code must install its companion. This also applies to the MCP find_similar_code and inspect_similar_code tools. Run npm install --save-dev fallow-similar-code@<fallow version>.

  • A Linux image build can need a --libc flag. A cross-target install from macOS or Windows must pass --os=linux --cpu=<arch> --libc=<glibc|musl>. A build that installs node_modules on glibc and runs it on musl must install with --libc=musl.

  • The MCP response cap is now 1,000,000 bytes. Before, the default cap was 16 MiB. To use a different cap, up to 16 MiB, set FALLOW_MCP_MAX_OUTPUT_BYTES in the server environment. The max_output_bytes parameter of a call still only lowers the cap.

  • Code scanning alerts of multi-analysis SARIF documents move to new categories once. The category: input of upload-sarif does not apply to a run that already has an id. GitHub can show the alerts of the old category as closed after the first upload. The fallow/dupes and fallow/audit/diff-risk ids also change, to fallow/dupes/ and fallow/audit/diff-risk/.

  • Update an installed hook to get the new pre-commit behavior. Run fallow hooks install --target git --force. For the agent gate, also run fallow hooks install --target agent --force. --branch has no effect now and prints a note.

  • Fallow ignores a cache.dir outside the project. This includes a path that leaves the root with .., the root itself, and a path in .git. The run prints a warning and uses .fallow. To put the cache outside the project, for example a shared CI cache, set FALLOW_CACHE_DIR.

  • The fail-on-issues gate of the GitHub Action and the GitLab template counts only error findings for dead code. The count comes from gate_outcomes["error-severity-findings"].observed. With fallow 3.29.0 to 3.31.x, a pass status counts as 0 and a fail status lets every finding count. With a fallow older than 3.29.0, every finding still counts. Duplication, health and security counts do not change.

  • The first run after the upgrade parses each file again. The cache format changed.

Full Changelog: v3.42.0...v3.43.0