Skip to content

v3.51.0: faster mutation runs, a publicPackages hint and bounded inputs

Latest

Choose a tag to compare

@BartWaardenburg BartWaardenburg released this 29 Nov 08:38
· 29 commits to main since this release
Immutable release. Only release title and notes can be modified.
v3.51.0
5b990f2

Features

  • A workspace package that looks published gets a publicPackages hint. A package looks published when its package.json is not "private": true and has an exports, main or module field. When publicPackages does not list such a package and its entry file exports names or members with findings, workspace_diagnostics[] gets a public-package-candidate entry. Human, Markdown and SARIF output show the hint. A --workspace run shows only the hints of the selected packages, and a --changed-since, diff or --file run shows none. The entry changes no finding, no count and no gate. (#5335)
  • fallow mutation reports the worker mode of the mutant runs. The new runner.worker_modes object of the JSON report gives the number of mutant runs and their time in each mode of the Vitest companion. The modes are isolated, shared and reused. When a run is slow, a high isolated value shows why. (#5423)
  • fallow mutation --reach-selection skips the dry run of each test file that cannot run a mutant. With --reach-selection on, a run records in dry-runs.json which functions each test file enters. A later run skips a test file when its record proves that the file cannot run a mutant of the run. With check, fallow dry-runs each file and lists each mutant that a dropped file covers. If the list is not empty, fallow exits with code 2. The config key is mutation.reachSelection, and the selection is off by default. On one project, 7 test files reach a changed file through a barrel file, and 1 of them runs it. After a change of a function body, the dry run went from 22 seconds to 1 second, with the same verdicts. (#5425)

Changed

  • fallow mutation is faster with more than one companion.
    • fallow divides the dry run over the --concurrency companions, and each companion keeps its share for the mutant runs. On a project with 7 test files, 6 of which wait 10 seconds, the dry run went from 61 to 21 seconds. The mutant phase went from 62 to 3 seconds, with the same verdict for each mutant. (#5413)
    • With Vitest, a companion that starts later takes the test index of the first dry run and does no dry run of its own. (#5419)
    • With Vitest, a mutant that would outlast the work of the other workers runs in parts on the idle workers. A kill in any part decides killed. (#5422)
    • Each companion now runs the self-check of the first job for the tests in its own share. This happens when those tests are in more than one share. (#5444)
  • fallow mutation reuses the dry run of each unchanged test file. On a project with 7 test files, a repeat run with no change went from 21 seconds to 1 second. Each mutant kept its verdict. A test file with a failed baseline test no longer turns the cache off for the other files. --no-cache disables the dry-run cache. (#5424, #5482)
  • coverage analyze --cloud keeps hot-path, blast-radius and importance IDs on a line move. The IDs hash the file and the function name, or the stable_id when the file has more than one function of that name. Thus an edit above a function no longer gives it a new ID. Each entry also has legacy_id with the old ID for a transition window.
  • coverage analyze --cloud fills the local structure on cloud rows. When a cloud row has no caller graph, complexity or owners, fallow fills caller_count, caller_count_weighted_by_traffic, the risk band, cyclomatic and owner_count from the local AST. Before, these fields read as 0.
  • coverage analyze --cloud caps safe_to_delete when the local join is incomplete. When under 80% of the cloud functions match the local AST, each safe_to_delete finding becomes review_required with medium confidence. The report adds the cloud_local_join_incomplete warning.
  • The blast-radius risk_band follows the importer count alone. high starts at 20 importer files, and medium starts at 5. Without --production, the local count includes test importers. Traffic no longer moves the band, in coverage analyze --cloud and in health --runtime-coverage. When a cloud row has no caller count and fallow cannot fill it, risk_band is unknown. A script that validates the JSON strictly must accept unknown.
  • caller_count_weighted_by_traffic is the sum of the production hits in the importer files, and can be null. The value is null when no importer file has runtime data, and in a local health --runtime-coverage run. A script that validates the JSON strictly must accept null for this field.
  • fallow refuses a --changed-since or --base ref that searches commit messages or names a range. Examples are main^{/fix}, :/fix and main...HEAD. fallow also refuses a ref with nested braces. Use a branch, a tag, a commit SHA, or a form such as HEAD~3 or main@{upstream}.

Bug fixes

Detection

  • fallow reads build.rolldownOptions.input in a Vite 8 config. The Vite plugin reads input under rollupOptions and rolldownOptions, in build and in environments.<name>.build. The Electron plugin does the same for electron-vite configs. (#5385)
  • The Vite plugin is enabled when the manifest lists only vite-plus. A vite-plus dependency or a vp script now enables the Vite plugin. The build inputs of vite.config.* then count as entry points. (#5386)
  • unresolved-import skips more imports of generated files. fallow no longer reports an extensionless relative import of a file that .gitignore ignores. fallow also skips a type-only import of the +types of a parent route, such as ../+types/layout.
  • unused-class-member follows a local wrapper of a factory. In const setup = () => newService(Service, options), the reads on the result of setup() now credit the class of the factory. (#5366)
  • --type-aware no longer reports an optional hook of a library interface. fallow no longer reports an optional member that a class declares for an interface of a dependency. The type-aware protocol is now version 11. Install the companion of this version with fallow type-aware setup or from npm.
  • invalid-client-export reports only App Router entry files. fallow checks only a page, layout or route file below app/ or src/app/, as Next.js does. (#5405)
  • unused-component-emit credits the update:<key> event of a VueUse model ref. A write of a useVModel or useVModels ref, in the script or in the template, marks the event as used. (#5403)
  • unused-component-input credits an Angular input that a @HostBinding on the same member reads. (#5404)
  • A composite action credits a script that $GITHUB_ACTION_PATH names. A run: or github-script step that names a script through $GITHUB_ACTION_PATH now credits that script in the action folder. (#5414) Thanks @aloneangel45 for the patch in #5415.
  • A directory argument of a test runner no longer makes its index file an entry point. In vitest run src/lib/, the index file of src/lib is no longer an entry point. Only a script runtime (node, tsx, bun, deno run) resolves a directory to its index file. bash scripts/deploy.sh no longer credits scripts/deploy.ts. In an Nx run-commands target, a Vite+ task or a CI step, node scripts/process-messages now credits scripts/process-messages/index.js. (#5370)
  • fallow dupes compares the type arguments of calls and new expressions. fallow no longer reports calls that differ only in their type arguments as clones. fallow rebuilds the duplication token cache once. (#5401) Thanks @neumaennl for the report.
  • A boundary preset and the Sass and Less keyframes check no longer panic. A boundary preset no longer panics on a tsconfig rootDir such as src[. A rootDir such as src[a] now matches as a literal folder. The keyframes check of Sass and Less files no longer panics on a statement that starts with a multibyte character.

Mutation testing

  • fallow mutation suggests a --setup-timeout value that is longer than the value that failed. The example is two times the failed value, with a minimum of 5m. (#5389)
  • fallow mutation with Vitest no longer counts a __tests__ helper as a test file. A file below __tests__ is a test file only when its name has a test marker, or when a runner test pattern selects it. (#5391)
  • fallow mutation --time-budget no longer ends a run early. Before, a run ended early by about the time of the first dry run, with mutants pending. (#5421)

Output and CI

  • The composite action runs its scripts on Windows runners. Every run: step quotes GITHUB_ACTION_PATH, so bash keeps the backslashes of the Windows action path. (#5352) Thanks @lidongze1002 for the patch in #5408.
  • Compact dependency and duplicate-export lines name a path and a line. The lines now have the form <tag>:<path>:<line>:<name>. A script that splits a line on : now finds the name in field 4, not in field 2. unlisted-dep and duplicate-export write one line for each location, so they can write more lines than before. (#5017) Thanks @1abdala for the patch in #5372.
  • fallow coverage upload-inventory and the other API requests send compact JSON. An inventory body is about a quarter smaller, which fixes an HTTP 413 on large repositories. (#5453) Thanks @chbert for the report.
  • Text output escapes control characters in project strings. A line break or a terminal sequence in a path or a name now prints as a visible escape, such as \n. A CI runner can no longer read such a name as a workflow command. JSON output keeps the raw values.
  • next_steps[].command stays one shell command. A value with a space or a shell character is now in single quotes.
  • fallow ci posting steps check who wrote a comment and where its marker is. ci post-pr-comment updates only a comment of the bot account with the marker as a full line. ci post-review and ci reconcile-review read review markers only from the marker lines at the end of a comment. ci post-review always posts a GitHub review with the COMMENT event. A GitLab note for a finding without a diff position escapes control characters in the file path.

Hardening

These fixes limit what a file in a cloned repository can make fallow read, write or run, and how long a run takes:

  • fallow runs no git hook of the repository, and no diff.external program or textconv filter. Each git diff also ends its revisions with --, so a tracked file named HEAD no longer stops --changed-since.
  • Cache loaders read only regular files of a limited size inside the cache directory. A malformed cache file gives a cold run, not a panic. fallow fix without --dry-run reads and writes no parse or graph cache.
  • fallow writes and removes no mutation run directory, through a symlink that leaves the project. A symlink at <cache>/mutation, runs or companion stops the run with FALLOW_MUTATION_UNSAFE_CACHE_DIR, also when it points inside the project.
  • fallow writes no pr-comment-* sidecar file through a symlink that resolves outside the project, the Git work tree, the CI workspace or the temp directory. The GitLab comment and review jobs refuse a symlink at a result file.
  • fallow checks a path that a project file names against the project before it tests whether the file exists. This applies to package.json entries, plugin setup files, Nuxt layers, source map sources, lockfiles, workspace globs, and the init, migrate and hooks commands.
  • Symlink checks follow a link target one step at a time. Thus the result is the same on each machine. Coverage paths with .. also match the same file on each machine.
  • Write refusals name the given path, not the link target.
  • fallow mutation inspect, export, tasks and recheck, fallow inspect --cloud, fallow agent status and fallow hooks status read only files inside the project. The binary map reads only regular node_modules manifests within the read limit.
  • fallow reads an ignore file only when it is a regular file of at most 1 MiB, or a link to one inside the project. Above the project root, fallow reads a link to any regular file. fallow skips other files with a warning, so a FIFO or a device no longer stops a run. A skipped file below the root removes its directory from the run.
  • GitLab requests send GITLAB_TOKEN as Authorization: Bearer. A token goes only to the same host on a redirect. A redirect of the GitHub or Fallow Cloud API to the same host now keeps the token, which fixes requests for a renamed private repository.
  • The project id from the git remote no longer contains the user part of the URL.
  • fallow agent install --approve approves the MCP server only when .mcp.json has the entry that fallow wrote.
  • fallow coverage setup no longer takes a default answer when stdin ends. When stdin is not a terminal, pass --yes.
  • The import of an old in-repo Impact store keeps the user decisions unset.
  • Repeated or very large config input stays within limits. This covers extends lists, rule packs, plugin files, regexes, YAML aliases, alias spreads in bundler configs, and expanded package.json scripts. A config glob that does not compile is now a config error with exit code 2, not a panic. Real configs stay far below these limits.

Performance

  • fallow mutation with Vitest decides the worker mode for each set of test files. On a public TypeScript monorepo, a run of 73 mutants took 470 s in place of 1,165 s, with the same verdicts. (#5423)
  • Import resolution makes fewer file system calls. A probe for a missing path costs one lstat, not a realpath lookup of each component. On a large public repository, fallow dead-code with all threads spent about 23% less system time and about 10% less CPU time, with the same output.
  • fallow writes the parse cache and the graph cache without fsync. After a one-file edit, the parse cache save takes 5 to 9 ms less on small and medium projects.
  • A bare fallow run with health keeps one copy of the parsed modules. The peak memory decreased by 3.3% to 4.3% on two public projects.
  • Extraction copies a bounded amount of data for long chains, long callees and repeated names. The output for real projects does not change. The first run after the upgrade parses each file again.

Upgrade notes

  • Install the type-aware companion of this version. The protocol is now version 11.
  • In compact output, the name of a dependency or duplicate-export line is now in field 4. unlisted-dep and duplicate-export can write more lines than before.
  • risk_band can be unknown, and caller_count_weighted_by_traffic can be null.
  • fallow coverage setup without a terminal on stdin needs --yes.
  • fallow fix without --dry-run runs without the cache, so it is slower on large projects.
  • The first run after the upgrade rebuilds the parse, extraction, graph and duplication caches.

Full Changelog: v3.50.0...v3.51.0