feat(rules): one parser for .tidal, enforced by a shrink-only ratchet
I wrote a THIRD .tidal parser this session -- an ad-hoc regex census of which synths the set calls -- while tools/setlist_samples.py already answered exactly that. It produced garbage twice: a substring grep matched the synth `gfunk` against the `gfunk_*` SAMPLE banks, then the regex version read `s "k"` (58 files) as a missing sample and I reported it as a possible bug. PLN caught both in seconds. `#` is `|>` -- structure from the left, values from the RIGHT -- so `s "k" # s "jazz"` plays jazz and `k` is a rhythm skeleton that must never resolve. Nothing was broken. His diagnosis is the one worth keeping: a CLAUDE.md line alone would be a bandage, because the cause is not ignorance but COST ASYMMETRY. tools/ holds ~40 scripts with no index and the canonical resolvers are human-facing CLIs, not importable functions, so writing a regex cost 30 seconds and finding the parser cost a search. The cheap path wins under pressure. What black teaches Python devs is not taste, it is that the decision is gone. So: a rule in CLAUDE.md that states the trap concretely (with the `s "k" # s "jazz"` example, since the rule is useless if you don't believe it), plus structural enforcement in tools/tests/test_one_tidal_parser.py. The test matches the SHAPE of a Tidal call-site regex, not a blocklist of filenames, so a new file is covered the day it is written. It is a RATCHET, not an amnesty: KNOWN_DEBT may only shrink. A file not on the list that starts parsing fails immediately; an entry that stops offending ALSO fails, so paying one off must be recorded. Mutation-verified in both directions -- a planted regex turns it red, and a fictitious paid-off entry turns it red -- because a green test is not evidence that it can fail. Enforcement immediately found FIVE pre-existing hand-rolled parsers I did not know about, plus a sixth once the markers were tightened. They are not the same mistake, so they are listed individually rather than waved through by directory: tidal_score.py, sample_tfidf.py and pattern_ngrams.py genuinely duplicate bank extraction and are what #23 should absorb; at/lens.py reads `mask "..."`, pvlint/rules.py reads `# n "..."` and deshadow-helpers.py rewrites whole source lines -- different concepts, and forcing those through a bank resolver would be the wrong API. Precision here is load-bearing: a looser first draft flagged tools/setlist.py's "^(sound\s*check|line\s*check|balance)$", which is about a stage soundcheck and has nothing to do with Tidal. A rule that cries wolf gets switched off. Also fixes a fake test inside the hollow-suite guard itself: test_suite_hygiene's `test_files` was a HELPER, collected by pytest as a test that passed by returning a list without asserting anything -- the exact shape that file exists to catch. Renamed to _gather_test_files. That was the suite's only PytestReturnNotNone warning. 903 passed, 0 failed, 28 warnings.
Showing
tools/tests/test_one_tidal_parser.py
0 → 100644
Please
register
or
sign in
to comment