Record which rules run on Python, measured rather than read - #3
Merged
Conversation
Once a Python parser pack exists, some rules work on Python for free, some are lit up by the pack, some correctly decline, and some are genuinely Rust-only. This is that inventory, taken by RUNNING each rule against 44 files of CPython's Lib and against a file written to trigger every regex rule -- not by reading `applies_to`. Seven rules already worked and the pack had nothing to do with it: file-size, deep-nesting, emoji, stray-todo, no-comments, unknown-barrier, unused-marker. `entl-codebase` has carried a Python LanguageProfile all along, which is why. Two are lit up by the pack and by nothing else. Against a parser-paths directory holding only the rust pack the same 44 files produce "ok -- no findings"; with the python pack they produce 37. exact-clone and near-clone read the pack's [tokenization] lists, which is what makes those lists load-bearing rather than decorative. Four correctly decline: color, inline-font, inline-svg and motion are gated on a style facet Python does not have, and a Python file containing a hex string, a font-family, an inline SVG and a transition produces nothing. Recorded so nobody "fixes" it. Four are Rust-only, each with what it would need. error-discard is the interesting one: it is fact-backed through a vocabulary built entirely around a fallible return type, and Python spells failure with exceptions. Also records a gap this turned up. `analysis-incomplete` reports parse diagnostics, and a file with no parser pack at all is never selected and so never becomes one. Run over 44 Python files with no Python pack configured it said nothing, and straitjacket printed "ok -- no findings in 44 file(s)". The one case that most needs saying is the one it cannot say. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UBzKrVRq966CUheQEUCunT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A notes-only change. Once a Python parser pack exists (entl#13), some rules work on Python for free, some are lit up by the pack, some correctly decline, and some are genuinely Rust-only. The brief called that inventory "a cheap deliverable in itself"; this is it, taken by running each rule rather than by reading
applies_to.Two corpora: 44 files of CPython's
Lib(json, asyncio, argparse, dataclasses), and a file written to contain one trigger for every regex rule.Work today, no further work — seven rules
file-size(3 findings),deep-nesting(71),emoji,stray-todo,no-comments,unknown-barrier,unused-marker.The pack is not what turned these on — nothing was.
entl-codebasehas carried a PythonLanguageProfileall along, which is whystray-todoalready had a Python test before any of tonight's work.unknown-barrieris listed as applies, not demonstrated: I did not produce a finding for it.Lit up by the pack, and by nothing else — two rules
exact-clone(26 findings) andnear-clone(11). Verified by running the same 44 files against aparser-pathsdirectory holding only the rust pack:These read the pack's
[tokenization]lists, which is what makes those lists load-bearing rather than decorative.infact-duplicationclassifies only leaf nodes, so declaring Python'sstring— a parent ofstring_start/string_content/string_end— would have named a kind that exists and normalized nothing, and near-clone would have compared string contents as if they were code. Silently. The pack declaresstring_contentfor that reason.Correctly decline — four rules
color,inline-font,inline-svg,motionare allRegexRules gated on a style facet Python does not have. A Python file containing"#ff8800", afont-familystring, an inline<svg>and atransition:string produces zero findings.Recorded explicitly so nobody "fixes" it: giving Python a style facet would make every hex string in every Python file a finding.
Genuinely Rust-only — four rules, each with what it would need
error-discardis the interesting one. It is fact-backed throughinfact-errors, whose entire vocabulary is a fallible return type, and Python spells failure with exceptions. It needs[error-handling]in the pack plus aqueries/discards.scmnaming Python's forms (except: pass, anexceptthat only logs, an unawaited coroutine,contextlib.suppress). The pack deliberately ships neither yet — inventing values for aResult-shaped manifest before writing the forms would be guessing.effect-barrierandeffect-capabilityneed an effect catalog and a call graph.library-opportunityneeds behavior derivation;infact-python-normalize(infact#24) is the half of that which now exists.A gap this turned up
analysis-incompleteexists to say "fact-backed analysis could not inspect a source file." Run over 44 Python files with no Python parser pack configured, it reported nothing, and straitjacket printed:which reads as a clean repository and is not one. The rule reports
facts.diagnostics, and those are parse failures; a file with no parser at all is never selected and so never becomes a diagnostic. The one case that most needs saying — an entire language went unanalyzed — is the one it cannot say.With the pack it works exactly as intended, and names the construct:
The notes record the cheapest fix (have
infact-analysisemit a diagnostic for a file whose language resolves to no pack) and that this is not hypothetical: it was Python's state until today and is every un-onboarded language's state now.No code changed;
cargo fmt --all --checkis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01UBzKrVRq966CUheQEUCunT