Skip to content

scripts/lib: define the comment-stripped list format once in read-list.sh #3161

Description

@claude

Parent

Refs #2914

Context

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

Acceptance criteria

  • scripts/lib/read-list.sh defines the format once and is sourced by every consumer.
  • No scripts/*.sh carries its own comment/blank-stripping parser; check-shell-portability.sh parses the format one way, not two.
  • Every edge case above is covered by a test of the library.
  • An unreadable or missing list file is a loud non-zero return, never an empty active-entry set.
  • Every internal local in a nameref-taking function is _rl_-prefixed, with a test that a caller may name its out-array anything.

References

Metadata

Field Value
Category unspecified
Area unspecified
Ecosystem unspecified

Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions