Beagle SCM
JS-090: modularity cleanup batch — dead checkout.apply, 3 short-hex resolvers, duplicated helpers
A batch of low-severity modularity nits surfaced across the JS tree:
dead code whose header still advertises an unused API, three overlapping
short-hex resolvers, and helpers (ancestor walk, sub-traversal, stdout
writers, require idioms) re-implemented per module instead of shared.
One TODO per item; each is independently landable. Method: Issues.
Context
- checkout.js:125-162
apply() + its scanWt(:129) are dead —
the header (:7) advertises apply() but no caller drives it.
- THREE short-hex resolvers: resolve.js:40 (tips-only resolveHex),
store.js:302 (resolveHexAny, any-object), log.js:104-134 (a
pack-walk re-impl, see JS-085).
- patchscope.js:82-119
ancestorSet/lca re-implement the dag
walk locally ("so patchscope has no dag cycle", :81).
- status.js:247-304 + diff.js:229-248 re-implement sub-recurse
(joinPrefix/isMount) that core/recurse.js already exports
(walk :74, isMount :32, joinPrefix :63).
- delete.js:47-49 re-defines
join/statExists/statKind.
- THREE stdout writers: bro.js:33-44 (writeStdout/writeStderr),
render.js:35 (writeStdout), pager.js:26 (ttyWrite) — all
io.buf+feed+io.writeAll(fd,…).
- subs.js:53 lazy
require(.../core/discover.js) — a shared→core
upward require (also in JS-088).
- refs.js:26-36 writes fd1 via
io.log(...) directly instead of
the ctx.out header sink (refs.js:4 admits ctx.out is a no-op stub).
Goals
- Delete checkout.apply()+scanWt; trim the header (:7) claim.
- Make resolve.resolveHex a thin tips-first wrapper over
store.resolveHexAny; drop the log.js variant (JS-085).
- Fold patchscope ancestorSet/lca onto dag.js.
- Consolidate status/diff sub-recurse onto core/recurse.js::walk.
- delete.js uses shared/util/path.js join + a shared statExists.
- One fd-parameterised writer shared by bro/render/pager.
- refs.js emits via ctx.out, not io.log.
Constraints
- Byte-identical output for every touched verb (get/log/diff/
status/patch/refs); existing parity tests stay green.
- No new bindings; libabc/libdog only.
WIP
Design decisions
- Land as independent commits, one per TODO — each reversible.
- resolveHex stays the SEED-only tips fast-path (resolve.js:39
comment) but delegates the prefix scan to resolveHexAny.
TODOs
Blockers and bummers
- 2026-07-07 audit: STILL OPEN except the apply-delete item (now moot, above). Confirmed live:
3 short-hex resolvers (resolve.js/store.js:303/log.js:121); patchscope
ancestorSet/lca local
(patchscope.js:83,101); delete.js local join/statExists/statKind (:55-57); 3 stdout writers
(pager.js:81 ttyWrite, view/render.js:54 writeStdout, views/bro/bro.js:34 writeStdout); subs.js:53
lazy core/ require.
- 2026-07-10 revision: still OPEN (batch remainder) — 3 resolvers resolve.js:19/store.js:303/log.js:121 resolveHashlet (still k._packs() pack-walk); patchscope.js:83,101; delete.js:59-61 join/statExists/statKind; 3 writers bro.js:34/render.js:54/pager.js:89; subs.js:63-65 lazy. apply-delete item moot (submount.js live)
Outcome