You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Roughly ten scripts/*.txt data files share one line format — comment lines, blank lines, and inline trailing comments are stripped; what remains is one active entry per line. Five bespoke parsers implement that format, and check-shell-portability.sh alone parses it two different ways in the same file.
Because the format lives only in its parsers, each one independently decides the edge cases: whether # inside an entry starts a comment, whether a backslash escapes it, whether surrounding whitespace is trimmed, and whether a blank-after-strip line is dropped. A token or allowlist entry that is read as active by one parser and inert by another is a silent disagreement — and for these particular files (portability tokens, docs-only prefixes, baselines) "inert" means a gate quietly stops enforcing something.
Route-lane finding 7 of 7 from the first /coupling:reduce dogfood run (#2914). Reproduced against the tree at dff0942: 15 scripts/*.txt files, no scripts/lib/read-list.sh.
Proposed work
Add scripts/lib/read-list.sh exposing read_active_lines, defining the comment / escape / trim semantics once — sourced-only, matching the scripts/lib/ precedent.
Return entries through a nameref rather than stdout, and prefix every internal local (_rl_*): a nameref resolves in the scope where it is used, so an unprefixed local sharing the caller's out-var name shadows it silently. See refactor(scripts): extract the shared changed-file and awk-operand seams #3144, where exactly that produced two silently-empty results.
Replace the five bespoke parsers, including both of check-shell-portability.sh's.
Write down the format's edge cases as tests: inline #, escaped \#, leading/trailing whitespace, blank-after-strip, and a line that is only a comment.
Parent
Refs #2914
Context
Roughly ten
scripts/*.txtdata files share one line format — comment lines, blank lines, and inline trailing comments are stripped; what remains is one active entry per line. Five bespoke parsers implement that format, andcheck-shell-portability.shalone parses it two different ways in the same file.Because the format lives only in its parsers, each one independently decides the edge cases: whether
#inside an entry starts a comment, whether a backslash escapes it, whether surrounding whitespace is trimmed, and whether a blank-after-strip line is dropped. A token or allowlist entry that is read as active by one parser and inert by another is a silent disagreement — and for these particular files (portability tokens, docs-only prefixes, baselines) "inert" means a gate quietly stops enforcing something.Route-lane finding 7 of 7 from the first
/coupling:reducedogfood run (#2914). Reproduced against the tree atdff0942: 15scripts/*.txtfiles, noscripts/lib/read-list.sh.Proposed work
scripts/lib/read-list.shexposingread_active_lines, defining the comment / escape / trim semantics once — sourced-only, matching thescripts/lib/precedent._rl_*): a nameref resolves in the scope where it is used, so an unprefixed local sharing the caller's out-var name shadows it silently. See refactor(scripts): extract the shared changed-file and awk-operand seams #3144, where exactly that produced two silently-empty results.check-shell-portability.sh's.#, escaped\#, leading/trailing whitespace, blank-after-strip, and a line that is only a comment.Acceptance criteria
scripts/lib/read-list.shdefines the format once and is sourced by every consumer.scripts/*.shcarries its own comment/blank-stripping parser;check-shell-portability.shparses the format one way, not two._rl_-prefixed, with a test that a caller may name its out-array anything.References
scripts/check-shell-portability.sh— the two in-file parsersscripts/*.txt— the ~10 data files sharing the formatscripts/lib/extraction precedent, the nameref-prefix requirement, and the ci: harden shell-portability-lint detection precision (sed -i spellings, portability-scope precision, awk operand edge case) #1513 empty-token-list fail-openMetadata
Generated by Claude Code