JS-084 LOW: confirmed-minor correctness/perf cleanup batch

A batch of confirmed low-severity correctness/perf nits from the review, each a 1-2 line fix, grouped into ONE ticket (a TODO checkbox per item) to avoid ticket sprawl. Every cited file:line is verified below. The cheap ones land together; any item that grows past a couple of lines splits out into its own ticket. Repro where the bug is observable (the CR-in-line matcher, the oversized-line split, the empty-dir/dead-branch cases). Method: Issues.

Input

Context

Goals

Constraints

WIP

Design decisions

TODOs

Blockers and bummers

Outcome