ingest.add rewrites the refs ULOG non-atomically + restamps the reflogingest.add lands a re-get pack into an existing shard and updates refs
(ingest.js:108-128). It drains the old reflog then rewrites the WHOLE file
via writeUlog→writeBytes, which does io.resize(fd,0) then
io.writeAll(fd,b) IN PLACE (ingest.js:24-32) — no temp file, no sync, no
rename. A crash in that window leaves refs empty, losing every tip; the
re-get path reaches it (get.js:126). The crash-safe ulog.write
(temp+sync+rename) exists and is bypassed. Worse, writeUlog re-feeds rows
with NO ts (ingest.js:37), restamping every surviving reflog row. Method:
Issues.
ingest.js:24-32 writeBytes: io.resize(fd,0) then io.writeAll(fd,b)
on the live file — a destructive in-place truncate-and-rewrite.ingest.js:35-40 writeUlog: log.feed(r.verb, r.uri) — drops ts, so
every drained reflog row is restamped to "now" on rewrite.ingest.js:119-127 add: drains refs (no ts captured —
{verb,uri} only, line 122) then writeUlog(refs, old.concat(...)).get.js:126: the non-fresh re-get calls ingest.add — this IS reached.ulog.js write/_stage: temp sibling + io.sync + io.rename
(ulog.js:107-126), the crash-safe writer that add bypasses.ulog.append preserves each row's original ts (ulog.js:131-143);
test/ulog.js:62-63 asserts "old rows keep their ORIGINAL timestamps".ingest.add writes refs crash-safely (temp+sync+rename): a kill after
the truncate leaves the OLD refs byte-intact, no tip loss.ulog.write/ulog.append (already temp+rename + ts-aware);
capture each drained row's log.time and feed it back.0000000001.keeper pack-log write path
(writeBytes for the pack itself, content-addressed, is fine).clone fresh-store path's intent.add refs rewrite with ulog.write(refs, old+new) carrying
each old row's ts, OR ulog.append(refs, newRows) (drains+preserves).writeBytes; only refs needs the ULOG writer.test/js/ingest/*: kill-after-resize on refs leaves it
intact (no empty refs / no lost tip).add.add's refs write through ulog.write/append; drop the
in-place writeUlog for refs.ulog.js writer surface; keep parity with JS-048 writers.