Three cleanup findings from the v0.5.0 (#5/#6/#7) review, deliberately deferred rather than fixed inline in that PR - each is a real duplication-drift risk but low severity, and given how many rounds of regex fixes that PR already went through, further mechanical edits under the same time pressure felt like the wrong call. Tracking here for a calmer follow-up pass.
-
Duplicated timestamp format string (hooks/_lib.sh tl_err/tl_append_line, plus inline uses in session-flush.sh/session-precompact.sh): date '+%Y-%m-%d %H:%M:%S' is spelled out identically in 4 places. A future format change (e.g. adding a timezone offset) risks being applied to 3 of 4 sites. Fix: a shared tl_now() helper.
-
session-onboard.sh's per-buffer loop runs 3 separate grep passes (total, promptonly, session-ended) over the same file. Correctness is fine; it's 3x the file reads/forks needed. Fix: a single awk pass computing all three, or one grep with multiple -e patterns feeding sort | uniq -c.
-
_auth_scheme (command path) and _auth_scheme_prose (prompt path) duplicate the same bearer/basic/token regex literals, differing only in the length quantifier. A fix to the shared parts (e.g. tightening the base64 character class) applied to one during a future bugfix is easy to forget applying to the other. Fix: parameterize as _auth_scheme($min) called with different thresholds.
Also related to tl_jq_redact_defs being invoked via $(tl_jq_redact_defs) (a subshell + external cat per hook call, just to interpolate static jq text) - considered converting it to a plain shell variable to avoid the fork entirely, but the def text's comments contain many apostrophes that would need escaping for single-quote-safe variable assignment; that mechanical transform carries its own risk and deserves a dedicated, careful pass rather than a rushed edit.
Low priority - none of these are correctness bugs.
Three cleanup findings from the v0.5.0 (#5/#6/#7) review, deliberately deferred rather than fixed inline in that PR - each is a real duplication-drift risk but low severity, and given how many rounds of regex fixes that PR already went through, further mechanical edits under the same time pressure felt like the wrong call. Tracking here for a calmer follow-up pass.
Duplicated timestamp format string (
hooks/_lib.shtl_err/tl_append_line, plus inline uses insession-flush.sh/session-precompact.sh):date '+%Y-%m-%d %H:%M:%S'is spelled out identically in 4 places. A future format change (e.g. adding a timezone offset) risks being applied to 3 of 4 sites. Fix: a sharedtl_now()helper.session-onboard.sh's per-buffer loop runs 3 separategreppasses (total, promptonly, session-ended) over the same file. Correctness is fine; it's 3x the file reads/forks needed. Fix: a singleawkpass computing all three, or onegrepwith multiple-epatterns feedingsort | uniq -c._auth_scheme(command path) and_auth_scheme_prose(prompt path) duplicate the same bearer/basic/token regex literals, differing only in the length quantifier. A fix to the shared parts (e.g. tightening the base64 character class) applied to one during a future bugfix is easy to forget applying to the other. Fix: parameterize as_auth_scheme($min)called with different thresholds.Also related to
tl_jq_redact_defsbeing invoked via$(tl_jq_redact_defs)(a subshell + externalcatper hook call, just to interpolate static jq text) - considered converting it to a plain shell variable to avoid the fork entirely, but the def text's comments contain many apostrophes that would need escaping for single-quote-safe variable assignment; that mechanical transform carries its own risk and deserves a dedicated, careful pass rather than a rushed edit.Low priority - none of these are correctness bugs.