Skip to content

Detection: auxiliary-only languages, nested packages as units, test-project credit by dependency - #372

Merged
lefticus merged 8 commits into
cpp-best-practices:mainfrom
leftibot:detection-triage
Nov 24, 2026
Merged

lefticus merged 8 commits into
cpp-best-practices:mainfrom
leftibot:detection-triage

Conversation

@leftibot

Copy link
Copy Markdown
Collaborator

Detection fixes for the area: detection issues: auxiliary-only languages, nested packages, test-project credit. Part of #182, #188 and #230. #186 is left out, as decided.

Decisions this follows

Commits

Each commit is test-first and references its issue.

  1. Role names (A language present only in auxiliary files (fixtures, tooling, docs assets, editor dotfiles) becomes a product ecosystem and its FAILs decide the project #182, Nested manifests are folded into the root product unit or judged as products: benchmark/example/test/template/docs sub-projects #188). New directory names now tell a role: hack/, tool/, vendor-bin/ (tooling), listings/ (example), blueprints/ (template) and integration_test/ (test). So do directory names whose first or last word is a role, such as ruff_benchmark, flutter_http_example and example_packages. A final test alone does not count, because bloc's bloc_test is a library for testing.

  2. Auxiliary by default (A language present only in auxiliary files (fixtures, tooling, docs assets, editor dotfiles) becomes a product ecosystem and its FAILs decide the project #182). A language counts as auxiliary when all of these hold:

    • every one of its sources is auxiliary code;
    • no build file outside auxiliary code builds it;
    • its ecosystem has no product language. This keeps a Java project's Kotlin tests as its own.

    It is then judged as if --auxiliary had named its role. This settles Deferred from the bug-fix rounds: policy decisions and design work #324's A language present only in auxiliary files (fixtures, tooling, docs assets, editor dotfiles) becomes a product ecosystem and its FAILs decide the project #182 item, and A language present only in auxiliary files (fixtures, tooling, docs assets, editor dotfiles) becomes a product ecosystem and its FAILs decide the project #182's expected-failure regression test now passes.

  3. Nested packages are units (Nested manifests are folded into the root product unit or judged as products: benchmark/example/test/template/docs sub-projects #188, Test files and formats are attributed to the whole tree or the root unit, not to the unit that owns them #230). A new hook, BuildSystem.standalone, says whether a nested build file is a project of its own:

    • projects of their own: nested Package.swift, mix.exs, Cargo.toml, a named package.json, pubspec, fpm.toml, dbt_project.yml, composer.json, pyproject.toml, go.mod, .cabal, Gemfile, deps.edn and project.clj. Examples are vapor's Benchmarks/, phoenix's installer/ and integration_test/, and dbt-utils' integration_tests/.
    • still part of the unit above: CMake subdirectories, Maven modules, LuaRocks' rockspecs/, {"type": "module"} marker files and test fixtures.

    Auxiliary units are not judged for the product-only gates (NOT_FOR_AUXILIARY, now shared by the score and the checks). tests-run judges such a unit only when it has tests of its own.

  4. pnpm workspaces (Nested manifests are folded into the root product unit or judged as products: benchmark/example/test/template/docs sub-projects #188). pnpm-workspace.yaml is read as a workspace declaration, sharing its parser with command scoping.

  5. yarn c8 yarn test (Nested manifests are folded into the root product unit or judged as products: benchmark/example/test/template/docs sub-projects #188). A package-manager command naming no script now runs the binary of that name. prettier's coverage job had never been seen to run c8. Its only c8 credit came from a nested package that is now a unit of its own.

  6. Corpus follow-ups (Nested manifests are folded into the root product unit or judged as products: benchmark/example/test/template/docs sub-projects #188):

    • template units count as auxiliary (fluentd's templates/new_gem);
    • dependency-management is a product-only gate, so tokio's, serde's and puma's test and benchmark crates stop warning about lock files;
    • vendor-bin/ is tooling (guzzle).
  7. Test-project credit (Test files and formats are attributed to the whole tree or the root unit, not to the unit that owns them #230). A unit of tests tests the units it depends on by path, plus the unit it sits inside, unless that is the root. Path dependencies come from Cargo's path = and package.json's file:, through a new hook, BuildSystem.path_dependencies. A unit of tests that says neither still tests every unit, as before. One predicate, tests_unit, now serves both test-file credit and run credit.

  8. Fixture configuration (Nested manifests are folded into the root product unit or judged as products: benchmark/example/test/template/docs sub-projects #188). Manifests and tool configuration under tests/fixtures/, Fixtures/ or testdata/ are no longer named as the product's. Examples are PHP_CodeSniffer's fixture phpcs.xml.dist files and composer's and poetry's fixture manifests.

Corpus (235 projects, main → this branch)

127 projects differ. 151 check results go from FAIL to WARN (or SKIP); most are a fixture, docs script or maintainer script in a language the product doesn't use. Five get worse. Each comes from per-unit judgement now that borrowed credit stops:

  • graphql-eslint and graphql-inspector, tests-run PASS → FAIL: their workspace packages without tests, such as packages/rule-tester and packages/cli, are now judged one by one.
  • serde, tests-run PASS → FAIL: serde_derive_internals is no longer credited with test_suite's tests. test_suite doesn't depend on it; it shares source with serde_derive through a symlink.
  • ripgrep and tokio, fuzz-testing WARN → FAIL: a fuzz crate now counts only for the crates it depends on. ripgrep's only depends on globset, so the root and the other crates now report no fuzz targets.

Also changed:

  • rspec's dependency-management goes PASS → WARN. Its root Gemfile is now a unit without a gemspec, so the validator asks for a lock file.
  • Humanizer's vcs-ignore goes PASS → WARN, because of a single root tools/ .mjs script. Ignore rules in the docs site don't count for auxiliary tooling code. That rule already applied with --auxiliary.

Left open

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

leftibot and others added 8 commits November 23, 2026 23:08
…ts/, *_bench, *_example

Part of cpp-best-practices#182 and cpp-best-practices#188.

Names the corpus uses for auxiliary code besides the plain ones:
Kubernetes' `hack/` and Dart's `tool/` maintainer scripts (tooling),
rust-lang/book's `listings/` (example), koyo's `blueprints/` (template),
Flutter's and phoenix's `integration_test/` (test), and a directory whose
first or last word tells its role: dart-lang/http's
`flutter_http_example`, fpm's `example_packages`, ruff's
`ruff_benchmark`, `tests-build`. A last word `test` does not tell: a
library for testing is a product (bloc's `bloc_test`), and Racket's
`foo-test` packages are told by what their info.rkt says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Part of cpp-best-practices#182.

A language whose every source is test, example, docs, tooling or
benchmark code (a test fixture in C, a docs theme's script, a maintainer's
script under hack/), that no build file outside auxiliary code builds and
whose ecosystem has no product language (a Java project's tests in Kotlin
stay its own), is judged as if --auxiliary named its role: labelled
"(auxiliary: only in test code)", failures are warnings, and it weighs
half in the score. A project with no product language left is judged as
it is. An auxiliary unit's result says it is auxiliary once.

The expected-failure regression test for cpp-best-practices#182 now passes. Tests that
pinned the old default (a C++ project's lone Python release script judged
as the product) now pin the new one, and that a language with product
code is still the product's in its helper scripts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…or product-only gates

Part of cpp-best-practices#188 and cpp-best-practices#230.

A build file below another of its build system's is a project of its own
where the build system says so (`BuildSystem.standalone`): a nested
Package.swift, mix.exs, Cargo.toml (a package or workspace), package.json
with a name, pubspec, fpm.toml, dbt_project.yml, composer.json,
pyproject.toml, go.mod, .cabal, Gemfile, deps.edn or project.clj. It
becomes a unit with the role its directory tells: vapor's Benchmarks/,
phoenix's installer/ and integration_test/, dbt-utils' integration_tests/.
A CMake subdirectory, a Maven module, LuaRocks' rockspecs/, a package.json
that only marks its directory's modules and a test fixture's manifest
stay part of the unit above them.

A unit the map names auxiliary (a cargo-fuzz crate, a benchmark package)
is not judged for the gates of the product alone (NOT_FOR_AUXILIARY, now
shared by the score and the checks), nor asked for tests it does not have
(tests-run judges one that has tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
… a unit

Part of cpp-best-practices#188.

pnpm declares its workspace in pnpm-workspace.yaml, not package.json
(graphql-eslint, graphql-inspector). The npm build system now reads it
as it reads package.json's `workspaces`, so a member is a unit of its own
whether or not its package.json has a name, with the role its directory
tells (`examples/*`). The command-scoping reader of the same file now
shares its parser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Part of cpp-best-practices#188.

pnpm, yarn and bun run the binary of a name that is no script of the
package: `yarn c8 yarn test` is `yarn exec c8 yarn test`. That command was
dropped, so prettier's coverage job (`yarn c8 yarn test`) was never seen
to run c8; its c8 credit came only from a nested tooling package's script,
folded into the root until that package became a unit of its own. The
command now launches the binary it names, and its own `yarn test` runs the
package's test script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…ling

Part of cpp-best-practices#188.

Found in the corpus once nested packages became units:
- A template unit (fluentd's templates/new_gem, the gem its plugin
  generator writes) is not the product's: it counts with the auxiliary
  units, so it is not asked for tests or the product's gates.
- dependency-management is a gate of the product alone: a benchmark app
  or a test project that locks nothing (puma's benchmarks/local/sinatra,
  tokio's tests-integration) no longer warns.
- `vendor-bin/` holds the tools bamarni/composer-bin-plugin installs
  (guzzle): tooling, not product units without tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
Part of cpp-best-practices#230.

A unit of tests (a separate test project) counted, and its CI runs
counted, for every unit of the project: tokio's tests-integration lent its
9 test files to benches/, examples/ and stress-test/, and
hledger-web/test/browser's Playwright specs to the root package. A unit of
tests now tests the units its build files depend on by path (Cargo's
`path = "../tokio"`, package.json's `file:../x`: the new
`BuildSystem.path_dependencies`) and the unit it is in, but for the root
(`Unit.tests`); one that says neither still tests every unit (serde's
test_suite, .NET's and OCaml's test projects). One predicate,
`tests_unit`, now answers it for both the test files and the test runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
…oduct's

Part of cpp-best-practices#188.

A manifest or a tool's configuration below a test suite's data directory
(`tests/fixtures/`, `tests/**/Fixtures/`, `testdata/`) is test data, set
apart from the code around it as code --auxiliary names is
(`Selectors.apart`): PHP_CodeSniffer's fixture phpcs.xml.dist files no
longer define its formatting, nor composer's and poetry's fixture
manifests and lock files its dependencies. An example's files are not set
apart: a Flutter plugin's tests are its example app's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.32402% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.69%. Comparing base (67e7972) to head (cd46495).

Files with missing lines Patch % Lines
project_validator/ecosystems/rust/__init__.py 84.61% 2 Missing ⚠️
...roject_validator/ecosystems/javascript/__init__.py 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #372      +/-   ##
==========================================
- Coverage   99.70%   99.69%   -0.02%     
==========================================
  Files         313      313              
  Lines       20155    20273     +118     
  Branches     2376     2388      +12     
==========================================
+ Hits        20096    20211     +115     
- Misses         59       62       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants