Skip to content

Replace fixed canonical coverage directories with config-first, analyzer-aware coverage roots #6

@marco0560

Description

@marco0560

Replace fixed canonical coverage directories with config-first, analyzer-aware coverage roots

codira currently hard-codes canonical coverage directories as src/, tests/, and scripts/. This is reasonable for many Python repositories, but it is biased toward Python-style layouts and does not
generalize well to Rust, Go, C/C++, JS/TS, mixed-language repositories, or monorepos.

Today there are effectively two different discovery models:

  • indexing scope is analyzer-driven via analyzer discovery globs
  • coverage scope is hard-coded to src/tests/scripts

This mismatch makes indexing flexible, but keeps coverage policy tied to a Python-centric layout.

Problem

A repository can be fully indexable by active analyzers while still being treated as non-canonical for coverage purposes simply because its sources live outside src/, tests/, or scripts/.

Examples:

  • Rust: src/, examples/, benches/
  • C/C++: src/, include/, tests/
  • Go: packages often live at module root or under custom directories
  • monorepos: multiple package roots, not one shared top-level convention

Proposed direction

Adopt a hybrid coverage-root strategy:

  1. If codira project config declares coverage roots, use that as the source of truth.
  2. Otherwise, fall back to analyzer-defined default coverage roots.
  3. For multi-language repos, take the deterministic union of active analyzer defaults.
  4. Keep build-file inference advisory only; do not silently make it authoritative.

Why

This keeps behavior deterministic and explicit while removing the current Python-centric hard-code.

It also clarifies semantics:

  • indexable = analyzers know how to claim the file
  • canonical/coverage-required = the project or analyzer defaults explicitly say this path should be covered

Expected changes

  • replace fixed CANONICAL_SOURCE_DIRS coverage policy with config-first resolution
  • add analyzer metadata for default coverage roots
  • expose resolved coverage roots in CLI JSON output
  • preserve deterministic ordering and current strict coverage behavior
  • keep uncovered-file auditing, but over resolved coverage roots rather than a fixed tuple

Non-goals

  • no fuzzy “guess likely source dirs by name” behavior
  • no broad filesystem heuristics replacing explicit policy

Acceptance criteria

  • repos can explicitly configure coverage roots
  • repos without config use analyzer defaults
  • mixed-language repos get deterministic union behavior
  • codira cov and codira index --require-full-coverage operate on resolved coverage roots
  • existing deterministic reporting remains stable

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions