Skip to content

feat(config): content conditions on refinements - #4

Open
groxxda wants to merge 4 commits into
mbackschat:mainfrom
groxxda:proposal/content-refinements
Open

groxxda wants to merge 4 commits into
mbackschat:mainfrom
groxxda:proposal/content-refinements

Conversation

@groxxda

@groxxda groxxda commented Nov 12, 2026

Copy link
Copy Markdown

Adds an optional content regex to [[refinements]], tested only against the lines Tokei classifies as code. It is for categories that paths cannot express, such as TypeScript façades that keep their path after a module is ported to Kotlin.

This implements the Required scope of docs/proposals/content-refinements.md. The proposal stays draft for your decision; merging would accept it. Open in the proposal: whether the deferred entry's agent A/B applies when the consumers are people tracking a migration, whether to bundle the companion items (decided_by, except_entries), and whether to add content_absent.

  • explain shows the matching line, capped at 200 characters.
  • summary.policy_entries[].content_unmatched reports files an entry's globs matched but its content did not, and the verbose notes name the expression rather than the glob.
  • Policies without content read no extra file.

Verification:

  • Red/green integration tests; cargo test --locked passes (517 integration tests), plus fmt, clippy, the file-size and doc-index gates.
  • A cold review found seven issues, fixed in 1b46809, among them content being skipped by the public file_records wrapper and globs misreported as unused.
  • On a private TypeScript-to-Kotlin migration project, the façade split matched its local record exactly; that record is in the Git-ignored local research folder and can be shared separately.
  • microsoft/vscode timing: without content refinements, unchanged against main (ratio 1.00); with one refinement over all production source, 1.31 times as long, on a loaded machine. Details are in the proposal.
  • Not run: the private regression and the documentation example scripts.

🤖 Generated with Claude Code

Alexander Ried and others added 4 commits November 12, 2026 14:04
Reopens the deferred content predicates for a migration project whose facade files keep their paths, so no glob expresses the category at any one commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A refinement may carry content, one Rust regex tested against the lines the counter classifies as code, so categories that paths cannot express (such as TypeScript façades over a Kotlin implementation) stay measurable. explain names the matching line, and summary.policy_entries reports content_unmatched for the files a content refinement's globs matched but its expression did not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…port their misses faithfully

file_records now takes the root its paths are relative to, so no entry point skips content. Code lines are tested in place and only the matching one is copied, capped at 200 characters. Line classes use the counter's own configuration. A glob that matched a file's path counts as used, and verbose notes blame the content expression instead of the glob.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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