Skip to content

Commit af759ef

Browse files
committed
fix(bootstrap): D-383 — bundled-ns regex literals verified working; stale claims removed
Smell-audited: 1: reality-alignment discharge — the cycle-1 reader limitation dissolved at some point (reader unification); probe confirmed a regex literal in a bundled .clj builds via cache_gen and runs. Restored clojure/instant.clj's guard to the natural (re-find #"[\"\\]" s) form (now also the living lock for bundled-ns regex), removed the false "regex unsupported in bundled ns" comments (pprint char walk kept as a legitimate impl), e2e quote_chars_rejected pins the guard. D-383 discharged; D-058 (renderer context) stays open.
1 parent 4f03401 commit af759ef

5 files changed

Lines changed: 30 additions & 20 deletions

File tree

‎.dev/debt.yaml‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -641,20 +641,6 @@ active:
641641
(incremental flush / max-bytes). Tie to D-347 (both are wasm/run resource
642642
bounds). Low priority while wasm/run is demo/trusted-module scoped.
643643
last_reviewed: "2026-06-09"
644-
- id: "D-383"
645-
status: "open (2026-06-10, reader asymmetry found during the clojure.instant backfill). A regex literal `#\"…\"` LOADS + works at RUNTIME (`(re-find #\"a+\" \"baaab\")`→\"aaa\") but FAILS in a bootstrap-loaded `.clj` (anything `@embedFile`d from src/lang/clj/**): `regex literal (unsupported syntax in cycle 1) is not supported`. So a bundled namespace cannot use `#\"…\"` — clojure.instant had to guard with `(some #{\\\" \\\\} s)` instead of `(re-find #\"[\\\"\\\\]\" s)`. The bootstrap/cycle-1 reader is a narrower reader than the runtime one; regex-literal support is the gap. Also: the error renderer mis-attributes the location to `<bootstrap>` core.clj (D-058 renderer context gap), so the caret points at the wrong file. LOW priority (clean char-set/ string workaround; few bundled ns need regex), but a real definition-coverage gap (F-013): a bundled ns should reach the full reader."
646-
category: "reader"
647-
barrier: |-
648-
Blocked-by: the bootstrap/cycle-1 reader lacks regex-literal (`#\"…\"`) support that
649-
the runtime reader has. Predicate to land: a bundled `clojure/**.clj` genuinely needs
650-
a regex literal (e.g. clojure.xml / a future ns), OR the cycle-1 reader is unified
651-
with the runtime reader. Then teach the bootstrap reader the regex-literal token (it
652-
already exists in the runtime path — likely a shared-reader wiring, not a new parser)
653-
+ fix the D-058 renderer file-context so the error points at the offending bundled
654-
file. Workaround until then: char-set / string ops in bundled `.clj` (memory
655-
`regex_literal_unsupported_bootstrap_clj`). Cross-ref D-058 (renderer context),
656-
ADR-0031 / D-051 (regex engine — works at runtime), F-013, D-273 (surfacing backfill)."
657-
last_reviewed: "2026-06-10"
658644
- id: "D-384"
659645
status: |-
660646
open (2026-06-10) — the wasm cross-runtime comparison (`bench/wasm_bench.sh`,
@@ -2372,6 +2358,20 @@ standing:
23722358
barrier: "open after the D-440 arc completes (R4 + R5 must first rewrite the bulk of 'Phase N' citations to gap-area terms). Premature adoption = ~70 dangling citations with no 1:1 redirect. Trigger: D-440 R4/R5 done + a user nod to re-architect the planning axis (it is depth-4, the project's organizing metaphor)."
23732359
last_reviewed: "2026-06-15"
23742360
discharged:
2361+
- id: "D-383"
2362+
status: "DISCHARGED 2026-07-17 — the barrier had already dissolved: a regex literal in a bundled `.clj` now builds through cache_gen AND works at runtime (probe: `(re-find #\"[a-f0-9]+\" s)` appended to clojure/uuid.clj → clean build + correct result; the bootstrap path uses the unified reader). Reality-alignment landed: clojure/instant.clj guard restored to the natural `(re-find #\"[\\\"\\\\]\" s)` form (semantically identical to the char-set workaround; now also the living lock — every read-instant-date call exercises a bundled-ns regex literal, e2e quote_chars_rejected pins it); stale \"regex unsupported in bundled ns\" comments removed from pprint.clj (char walk kept — legitimate single-pass impl, no longer forced) + tools/cli.clj header. D-058 (renderer file-context mis-attribution) remains its own row."
2363+
category: "reader"
2364+
barrier: |-
2365+
Blocked-by: the bootstrap/cycle-1 reader lacks regex-literal (`#\"…\"`) support that
2366+
the runtime reader has. Predicate to land: a bundled `clojure/**.clj` genuinely needs
2367+
a regex literal (e.g. clojure.xml / a future ns), OR the cycle-1 reader is unified
2368+
with the runtime reader. Then teach the bootstrap reader the regex-literal token (it
2369+
already exists in the runtime path — likely a shared-reader wiring, not a new parser)
2370+
+ fix the D-058 renderer file-context so the error points at the offending bundled
2371+
file. Workaround until then: char-set / string ops in bundled `.clj` (memory
2372+
`regex_literal_unsupported_bootstrap_clj`). Cross-ref D-058 (renderer context),
2373+
ADR-0031 / D-051 (regex engine — works at runtime), F-013, D-273 (surfacing backfill)."
2374+
last_reviewed: "2026-06-10"
23752375
- id: "D-316"
23762376
status: "DISCHARGED 2026-07-17 — the residual (computed def-meta) resolved on the D-563(b) meta_expr channel: the def-meta map now analyzes as a REAL expression (quotes stay data, literals embed, computed values EVALUATE at def time — clj-exact, oracle [3 (a b) \"s\"] / defn attr-map (* 2 3) → 6). Prerequisite: defn/defmacro now QUOTE their synthesized :arglists at the generator (like clj), which is what made raw-expression analysis safe. unquoteMetaValues stays only for the analyze-time static Var.meta lift (pre-eval approximation; the runtime value wins). Corpus def_meta_eval.txt; e2e computed_meta/defn_attr_computed on phase15_var_source_meta. ORIGINAL NARROWED note (2026-06-08) + original finding (2026-06-07) in git history."
23772377
category: "scope"

‎src/lang/clj/clojure/instant.clj‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
"Parse an instant string into a java.util.Date via the canonical #inst reader.
1919
A valid instant string is reader-quote-free; a `\"` / `\\` would let the reader
2020
consume a partial form, so reject those (malformed → throw), matching clj's
21-
reject-bad-input contract. (Char-set guard, not a regex literal — regex literals
22-
are unsupported in a bootstrap-loaded namespace.)"
21+
reject-bad-input contract."
2322
[s]
24-
(if (and (string? s) (not (some #{\" \\} s)))
23+
(if (and (string? s) (not (re-find #"[\"\\]" s)))
2524
(read-string (str "#inst \"" s "\""))
2625
(throw (ex-info "Invalid instant string" {:s s}))))
2726

‎src/lang/clj/clojure/pprint.clj‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@
282282
(recur (rest ts) gi (str acc (nth segs tk)))))))))))
283283

284284
;; Capitalize the first letter of each space-separated word, lowercasing the rest
285-
;; (the `~:(` transform). Manual char walk — a regex literal cannot live in a
286-
;; bundled `.clj` (cycle-1 reader limitation).
285+
;; (the `~:(` transform). Manual char walk (single pass, no regex needed).
287286
(defn cl-cap-words [s]
288287
(loop [cs (seq s) prev-space? true acc ""]
289288
(if (nil? cs)

‎src/lang/clj/clojure/tools/cli.clj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
;; options (:id :default :default-desc :default-fn :parse-fn :update-fn
1212
;; :assoc-fn :validate :missing), `--opt=val`, `--[no-]opt`, grouped
1313
;; boolean shorts (-vvv), the `--` terminator, and the parse-opts kwargs
14-
;; :in-order / :no-defaults. No regex literals (bundled-bootstrap reader).
14+
;; :in-order / :no-defaults.
1515
(ns clojure.tools.cli
1616
(:refer-clojure)
1717
(:require [clojure.string :as s]))

‎test/e2e/phase15_clojure_instant.sh‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,17 @@ EOF
5050
)
5151
assert_eq 'malformed_throws' "$got" ':threw'
5252

53+
# Reader-quote chars are rejected before reaching read-string (the guard is a
54+
# regex literal in a BUNDLED ns — also locks bootstrap-reader regex support, D-383).
55+
got=$("$BIN" - <<'EOF' 2>/dev/null
56+
(require 'clojure.instant)
57+
(print [(try (clojure.instant/read-instant-date "2024-01-01T00:00:00\"x") :no-throw
58+
(catch Exception e :threw))
59+
(try (clojure.instant/read-instant-date "a\\b") :no-throw
60+
(catch Exception e :threw))])
61+
EOF
62+
)
63+
assert_eq 'quote_chars_rejected' "$got" '[:threw :threw]'
64+
5365
echo
5466
echo "clojure.instant backfill (D-273) e2e: all green."

0 commit comments

Comments
 (0)