You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 57f634f
Browse filesBrowse the repository at this point in the historyBrowse files
feat(format): D-470 — the %t/%T date/time conversion family (UTC/English, AD-052)
Smell-audited: 2: the tz/locale question got an AD, not an ad-hoc pick —
AD-052 records why UTC+English is the ONE deterministic rendering (cljw
ships no tz/locale database per D-462; the JVM's own %t output is
host-env-dependent), pinned by e2e; corpus deliberately NOT used (host
clj is JST/ja — goldens would be locale-dependent).
formatTimeSub covers time (H k I l M S L N p z Z s Q), date (Y y C m d e
j B b h A a), and composites (R T r D F c); args accept java.util.Date or
Long epoch-ms (Java semantics); %T upper-cases the rendering. Every
numeric conversion verified byte-for-byte against `TZ=UTC clj`. En-route
fix: Zig's signed `{d:0>N}` prints an explicit `+` — padNum renders the
sign manually. The stale "no width/flags yet" error template corrected.
e2e phase14_format 41->48 cases. D-470 discharged.
Copy file name to clipboardExpand all lines: .dev/accepted_divergences.yaml
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -883,3 +883,19 @@ accepted:
883
883
ARE byte-usable in cljw). Record: `private/notes/2026-06-25-D472-bytes-da-fork.md`.
884
884
derives_from: "AD-019 (type-erased arrays — no per-array component type, so byte-array is runtime-indistinguishable from any other array) + F-004 (uniform 8-byte Value) + F-005 (no primitive specialization) + F-011 (the common positive guard `(bytes? (byte-array n))` matches clj true exactly; only non-byte arrays diverge) + F-013 (no bespoke per-array type-tag mechanism added to fake a distinction the representation does not carry)."
885
885
pin: "test/e2e/phase14_arity_parity.sh — `AD-051 (bytes? byte-array)`/`AD-051 (bytes? int-array)`/`AD-051 (bytes? object-array)` lock cljw's over-broad `true` (incl. the int/object-array cases where clj returns false). The clj-IDENTICAL cases (byte-array→true, string/nil/vector→false) are corpus-pinned in test/diff/clj_corpus/clojure_1_11_additions.txt."
886
+
- id: "AD-052"
887
+
summary: "format's `%t` date/time conversions render in UTC with fixed English names (month/day/am-pm) and a fixed `+0000`/`UTC` zone; the JVM renders in the process's default TIME ZONE and LOCALE (a JST/ja machine shows shifted hours and 金曜日/2月/午後)."
%tr) match a TZ=UTC JVM byte-for-byte — verified against `TZ=UTC clj`
898
+
2026-07-07. Name conversions (%ta %tA %tb %tB %tp) match an
899
+
English-locale JVM.
900
+
derives_from: "ADR-0059 no-JVM (no host tz/locale database dependency) + F-011 (the deterministic-environment rendering matches TZ=UTC/en JVM exactly; only the host-env-dependent rendering diverges) + D-462 (tz database out of scope for the edge/wasm target)."
901
+
pin: "test/e2e/phase14_format.sh — the `%t` cases pin the UTC/English renderings (epoch-0 hour 00, Fri/Feb names, +0000 zone)."
status: "open (2026-06-20, clj-diff format probe). `clojure.core/format` does NOT support the `%t`/`%T` date/time conversion family: `(format \"%tY\" (java.util.Date. 0))` → cljw 'unsupported directive %t' vs clj '1970'. The `%t` family is ~40 sub-conversions (%tY year / %tm month / %td day / %tH hour / %tM min / %tS sec / %tF ISO-date / %tT ISO-time / %tc full / %tj day-of-year / %tB %tb month-name / %ta %tA weekday / %tp am-pm / %tI %tl 12h / %tR %tr / %tD / %tZ %tz zone / %ts epoch-sec / %tQ epoch-ms …) over a Date/Calendar/Long/TemporalAccessor arg. The rest of the format flag/conversion surface is COMPLETE (D-216 discharged 2026-06-03 + a 2026-06-20 verify-sweep re-confirmed: heap-Long %d, unsigned-64 %x, # alternate, float +/space/(/, flags, %S/%H, %.Ns, %s-nil→null all match clj; %h/%H hashcode = AD-009). LOW priority — `%t` printf-style date formatting is rare in idiomatic Clojure (date code uses java.time formatters / clojure.instant, not (format \"%tY\" …)). Take up on a real consumer; mechanise via the format_surface corpus (anti-D-177) when landed. The zone sub-directives (%tZ/%tz) would also need the user/ADR-owned tz-DB (cf. D-462 ZonedDateTime)."
349
-
category: "clj-parity"
350
-
barrier: "none — bounded but sizable (~40 sub-conversions + Date/Long/Temporal arg dispatch); a focused unit when a consumer needs it. Zone sub-directives gated on the tz-DB (D-462)."
351
-
last_reviewed: "2026-06-20"
352
347
- id: "D-471"
353
348
status: "open (2026-06-20, IO probe — surfaced while fixing spit options). `slurp`/`spit` accept ONLY a string PATH for the file arg; clj routes the arg through the `clojure.java.io/Coercions` + `IOFactory` protocols, so `(spit (clojure.java.io/file \"/tmp/x\") c)` / `(slurp (clojure.java.io/file …))` (a java.io.File), and a `java.net.URL`/`URI`/`Reader`/`Writer`/`InputStream` arg, all work in clj. cljw raises 'spit: expected string, got host_instance'. The file_io.zig primitive docstring already acknowledges this ('restricted to the file-path overload; the URL / Reader / Writer overloads arrive when java.net.URL / java.io.Reader land'). SAME-CYCLE PROGRESS (2026-06-20): spit's `& options` (`:append` truthy→append via new file_io.appendAll, `:encoding` UTF-8 no-op) + content `(str …)`-coercion (non-string content rendered via print.writeStrValue; string fast-path) ARE now done + clj-verified (e2e phase16_clojure_java_io spit_append_options). REMAINING = the PATH-arg Coercions: accept a java.io.File host_instance (extract its path — cljw File already stores one) for slurp/spit (the common, tractable sub-case); URL/URI/Reader/Writer/stream args are gated on those types landing (lower value). LOW-MODERATE priority — `(spit (io/file …) …)` is moderately common in real code; take up as a focused unit (extract File path + a coerce-to-path helper shared by slurp+spit). DRAIN 2026-06-25: the File-arg sub-case LANDED — a coerceToPath(rt, v) helper in lang/primitive/file_io.zig accepts a .string directly OR a java.io.File host_instance (extracts its state[0] path); R4-clean, identifying the File by descriptor identity via rt.types + host_instance (NOT importing the runtime/java/io surface — the uriQ pattern). Both slurp and spit consult it; a non-File/non-string still raises. clj-verified ((spit (io/file p) c) + (slurp (io/file p)) round-trip + multi-segment File); e2e phase16_clojure_java_io slurp_spit_file_arg. REMAINING (lower value, NOT the common case): URL / URI / Reader / Writer / InputStream args route through clj IOFactory (slurp a Reader reads the stream) — a bigger unit gated on routing slurp/spit through the stream surface; take up when a consumer needs a non-File Coercions arg."
354
349
category: "clj-parity"
@@ -6474,6 +6469,12 @@ discharged:
6474
6469
barrier: "DISCHARGED (was: ns attr-map skipped at analysis)."
6475
6470
last_reviewed: "2026-07-07"
6476
6471
6472
+
- id: "D-470"
6473
+
status: "DISCHARGED 2026-07-07. `format` gained the full `%t`/`%T` date/time conversion family (formatTimeSub in primitive/core.zig): time H k I l M S L N p z Z s Q / date Y y C m d e j B b h A a / composites R T r D F c — args accept java.util.Date or Long epoch-ms (Java semantics). RENDERING IS UTC + ENGLISH + `+0000` (AD-052): cljw ships no tz/locale database (edge/wasm target, D-462), and the JVM's own %t output is host-env-dependent — cljw picks the TZ=UTC/en JVM rendering, verified byte-for-byte against `TZ=UTC clj` for every numeric conversion (2009-02-13 23:31:30 / 02/13/09|11:31:30 PM|044|… / epoch-0 row). Zig gotcha fixed en route: signed `{d:0>N}` prints an explicit `+` — padNum() renders sign manually. %T upper-cases the whole rendering. e2e phase14_format +7 cases (48 total; the AD-052 pin); the stale `no width/flags yet` error template was corrected. Corpus intentionally NOT used (host clj is JST/ja — the sweep would record locale-dependent goldens)."
6474
+
category: "clj-parity"
6475
+
barrier: "DISCHARGED (was: format %t family unimplemented)."
6476
+
last_reviewed: "2026-07-07"
6477
+
6477
6478
conventions: |-
6478
6479
- Structure: two top-level lists — `active:` and `discharged:`. Active entries carry id / status / category / barrier (+ optional quality_floor / last_reviewed); discharged entries carry id / discharged_at / resolution. Edit as YAML (no Markdown table to align).
6479
6480
- New debt: grep `.dev/debt.yaml` for class-overlap before adding (per `.claude/rules/debt_dedup.md`).
// `%t<X>`/`%T<X>` date/time conversions (D-470). Arg = a
1240
+
// java.util.Date or a Long (epoch millis, Java semantics).
1241
+
// Rendered in UTC: cljw ships no tz database (edge/wasm target),
1242
+
// so the JVM's default-locale-TZ rendering is an accepted
1243
+
// divergence (AD — corpus-unfixable, e2e pins the UTC values).
1244
+
't', 'T'=> {
1245
+
if (i>=fmt.len) returnerror_catalog.raise(.format_spec_invalid, loc, .{ .spec="%t" });
1246
+
constsub=fmt[i];
1247
+
i+=1;
1248
+
constms: i64=if (date_mod.isDate(rt, args[src]))
1249
+
date_mod.epochMsOf(args[src])
1250
+
elseif (args[src].tag() ==.integer)
1251
+
args[src].asInteger()
1252
+
else
1253
+
returnerror_catalog.raise(.arg_value_invalid, loc, .{ .fn_name="format", .expected="Date or Long (epoch ms) for %t", .actual=@tagName(args[src].tag()) });
1254
+
tryformatTimeSub(tw, sub, ms, loc);
1255
+
if (conv=='T') {
1256
+
// %T upper-cases the whole rendering (Java Formatter).
1257
+
constlower=tmp.writer.buffered();
1258
+
constupper=tryrt.gpa.alloc(u8, lower.len);
1259
+
deferrt.gpa.free(upper);
1260
+
for (lower, 0..) |ch, k|upper[k] =std.ascii.toUpper(ch);
0 commit comments