Skip to content

feat: generate features from source via [tool.testmap.generate]#17

Merged
tylerriccio33 merged 2 commits into
mainfrom
feat/generate-features-from-source
Jul 3, 2026
Merged

feat: generate features from source via [tool.testmap.generate]#17
tylerriccio33 merged 2 commits into
mainfrom
feat/generate-features-from-source

Conversation

@tylerriccio33

Copy link
Copy Markdown
Owner

What

Adds [[tool.testmap.generate]], which derives the expected feature universe statically from source. A feature with zero tests previously didn't exist in testmap's model — it only appeared once a test tagged it. Now generated features surface as all-missing rows, closing that blind spot.

Each block is a small select / from / where query:

[[tool.testmap.generate]]
select = "functions"   # "functions" or "classes"
from = "src/**/*.py"    # glob (Linux rules, ** allowed), relative to pyproject.toml
where = "public"        # "public" | "private" | "all" (default)
  • Top-level defs only (a file's public API); feature name = symbol name.
  • Multiple blocks combine and dedupe.
  • Resolved at load_config time and seeded into the matrix, so both the CLI and the pytest plugin get it with no call-site changes.
  • Zero new dependencies — built on the stdlib ast already used by discover.py.

Known tradeoff

Feature names are symbol-derived, so renaming a symbol silently orphans its tests. Inherent to any glob/query-based derivation; the refactor-safe fix is an in-source @feature decorator, left for a follow-up.

Testing

make lint, make test (33 passed), make prek (incl. testmap self-check) all green. New tests cover kind/visibility selection, recursive globbing + dedupe, unknown-select rejection, and end-to-end config generation. README documented with a worked example.

🤖 Generated with Claude Code

tylerriccio33 and others added 2 commits July 2, 2026 22:16
Lets [tool.testmap] declare features via __features__ = [...] that each
default to the global required kinds, instead of repeating them in a
[tool.testmap.features] table. Explicit table entries still override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nt2UtcTGK75D11cSKzyTP4
Derive the expected feature universe statically so a feature with zero
tests surfaces as an all-missing row instead of being invisible. Each
[[tool.testmap.generate]] block is a select/from/where query: select
functions or classes, glob source files, filter by public/private
visibility. Resolved at load_config time and seeded into the matrix, so
both the CLI and the pytest plugin pick it up with no call-site changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nt2UtcTGK75D11cSKzyTP4
@tylerriccio33 tylerriccio33 merged commit e452684 into main Jul 3, 2026
2 checks passed
@tylerriccio33 tylerriccio33 deleted the feat/generate-features-from-source branch July 3, 2026 12:52
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.

1 participant