Finish the CRLF fix, and make the guard one that cannot drift (#1041) - #1047
Merged
Merged
Conversation
#1042 fixed six modules chosen from a hand-written list and declared the job done. It was not: 11 files across five sources still shipped CRLF, including two real graph files -- prego_habitat/{nodes,edges}.tsv and rhea_mappings/edges.tsv. Both misses came from guessing paths instead of enumerating them. The survey looked for data/transformed/prego/nodes.tsv, but PREGO writes to prego_habitat (PREGO_SHAPES=habitat changes the output directory, the same confusion as #885), so the check silently skipped the source entirely. And it tested nodes.tsv first and stopped, so rhea_mappings -- whose nodes.tsv happens to be LF and whose edges.tsv is not -- read as clean. Every csv.writer/DictWriter under transform_utils/ and merge_utils/ now goes through tsv_io: 37 call sites across 14 modules. Nothing outside those trees is touched; scripts/ still has its own. The guard no longer carries a list. It walks both trees (68 modules) and fails on any bare writer, with a companion test asserting the walk found more than 30 modules and specifically reaches prego, rhea_mappings, metatraits, merge_kg and gtdb -- a glob that silently matched nothing would otherwise make every check vacuous. A list someone has to remember to extend is the failure mode #1035 was about; this removes it. The acceptance test now enumerates too: it globs every *.tsv under data/transformed and fails naming the offenders, rather than looping over guessed source names. It fails today on the 11 known files, which is correct -- the code is fixed, the output needs regenerating. Reruns needed to clear it: prego, rhea_mappings, metatraits, metatraits_gtdb, microbedecoder, bactotraits, madin_etal, mediadive (~64 min, dominated by metatraits). No shared code moved, so nothing else goes stale and no dependent cascades. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TPpUDtT57QRMteXw7dLvRo
Collaborator
Author
Adversarial reviewRead-only pass over all 37 converted call sites plus four probes.
|
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.
Reopens and completes #1041. #1042 was incomplete and I called it done.
What was still shipping CRLF
11 files, five sources — found only by enumerating every TSV instead of looping over guessed names:
prego_habitat/nodes.tsv,edges.tsv,unmapped_associations.tsvdata/transformed/prego/— PREGO writes toprego_habitat(PREGO_SHAPES=habitatchanges the output dir, #885's exact confusion), so the source was skipped entirelyrhea_mappings/edges.tsvnodes.tsvand stopped; that one happens to be LFmetatraits/,metatraits_gtdb/× 3 reports,microbedecoder/unmapped_labels.tsvTwo of those are graph files that feed the merge.
Fix
Every
csv.writer/DictWriterundertransform_utils/andmerge_utils/now goes throughtsv_io— 37 call sites across 14 modules. (scripts/is out of scope and untouched.)The guard no longer carries a list
That was the real defect.
GRAPH_WRITERSwas seven hand-written paths; a list someone must remember to extend is the failure mode #1035 was about, and it drifted within a day. It now walks both trees — 68 modules — with a companion test asserting the walk found >30 and specifically reachesprego,rhea_mappings,metatraits,merge_kg,gtdb, so a glob that silently matched nothing can't make every check vacuous.The acceptance test enumerates too
It fails today, naming all 11 offenders — correct behaviour: the code is fixed, the output needs regenerating. It skips where
data/transformedis absent, so CI is unaffected.Verification
pytest -k "prego or rhea or metatraits or microbedecoder or mediadive or bactotraits or madin or stubs or gtdb or merge"→ 482 passed, 4 skipped._normalize_nodes_tsvturns a CRLF input into pure LF with no stray\rin any field, somerged-kg.tar.gzis LF regardless of what transforms hand it.Reruns
prego,rhea_mappings,metatraits,metatraits_gtdb,microbedecoder,bactotraits,madin_etal,mediadive— ~64 min, dominated bymetatraitsat 42. No shared code moved, so nothing else goes stale and no dependents cascade.🤖 Generated with Claude Code
https://claude.ai/code/session_01TPpUDtT57QRMteXw7dLvRo