on master help sign in
server.knot: document Knot compiler hang on beforeChar consolidation

The beforeX/afterX helper family (beforeColon/afterColon, beforeDot/ afterDot, beforeComma/afterComma) looks ripe to fold into one generic beforeChar sep s / afterChar sep s. Do NOT: routing splitOnComma's tail recursion through a partially-applied afterChar , hangs the Knot compiler indefinitely (confirmed 2026-07-11 — a 9-line repro never finishes, while the bespoke single-argument afterComma compiles in ~1s). The per-separator helpers stay bespoke on purpose. Second deep server audit found no new correctness bugs — the global write lock makes the state machine race-free, and all prior hardening holds under scrutiny.

commit254f6a08da45b7cf0dfc8539fb9a55ac83a6b6ec authoriko <mail@iko.soy> dateSat 11 Jul 2026, 19:23 (3 months ago) parent5477c47
1 file changed+8
server.knot+8
server.knot+8
@@ -565,6 +565,14 @@ else afterComma (drop 1 s)
565565-- is the usual beforeX/afterX recursion. Empty fields survive the split (",,a"
566566-- yields "" twice — relations dedupe, so once) and are dropped by the caller;
567567-- see `seedPeerList`.
568+--
569+-- The `beforeComma`/`afterComma`/`beforeDot`/`afterDot`/`beforeColon` family
570+-- looks ripe to fold into one generic `beforeChar sep s` / `afterChar sep s`.
571+-- Do NOT: routing *this* function's tail recursion through a partially-applied
572+-- `afterChar ","` hangs the Knot compiler indefinitely (confirmed 2026-07-11 —
573+-- a 9-line repro of `splitOnComma = ... splitOnComma (afterChar "," s)` never
574+-- finishes compiling, while the bespoke single-argument `afterComma` compiles
575+-- in ~1 s). The per-separator helpers stay bespoke on purpose.
568576splitOnComma : Text -> [Text]
569577splitOnComma = \s -> if s == ""
570578then ([] : [Text])