Skip to content

transformer: keep outputs in TREE_CALCULUS_CACHE, beside every other cache - #58

Merged
olydis merged 1 commit into
mainfrom
claude/dag-machine-simplicity-audit-r0jgsx-one-cache
Oct 2, 2026
Merged

olydis merged 1 commit into
mainfrom
claude/dag-machine-simplicity-audit-r0jgsx-one-cache

Conversation

@olydis

@olydis olydis commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This is the first of four PRs that move compiled-source caching onto the shared cache. The others are in lambada, arboretum and forest, and each one keeps every build working on its own, whatever order they merge in.

What changes. transformer used to memoize into a directory the caller chose (cache_dir; lambada's --cache .cache/lambada). Every other reduction cache lives under TREE_CALCULUS_CACHE. The separate directory also never refreshed an entry's timestamp when it was read, so arboretum's age-based pruning couldn't reach it and it only grew.

memoize now writes to a transform-v1 store under TREE_CALCULUS_CACHE, through the same store code as the other caches. cache_dir and TransformerOptions are removed. A caller that still passes cache_dir has it ignored, and its compiled sources are cached exactly when everything else is.

Existing caches. The key is unchanged, so entries from an old cache_dir are valid in transform-v1 as they are. Moving them over just saves recompiling once.

Tested

  • test-runner.sh has three new checks: a transformer answers; a fresh process asking the same thing again doesn't spawn the runner; the entry lands in transform-v1. Runner 19/19, reduce_canonicalize 4/4.
  • node src/test.mjs passes.
  • lambada emit against this runtime gives byte-identical output to before with the Node evaluator and with both runners, on a cold and a warm cache. A warm run never reaches the runner.
  • bin/ is rebuilt.

🤖 Generated with Claude Code

https://claude.ai/code/session_011zRRfk1bnCFEJEjxgSDavL


Generated by Claude Code

…cache

`transformer` memoized into a directory of the caller's choosing
(`cache_dir`), while every other reduction cache lives under
TREE_CALCULUS_CACHE. Two spellings of one mechanism, and the private one
did less: it never stamped an entry it read, so a pruner keeping what was
recently used (arboretum's build deletes what no build has needed in 30
days) could not tell its live entries from dead ones, and the directory
only grew.

Now `memoize` writes to a `transform-v1` store under TREE_CALCULUS_CACHE,
through the same `store` that writes, stamps and renames for the others.
The key is unchanged — sha256 of the program's hash and the input — so an
old `cache_dir`'s entries are valid there as they are. The `cache_dir`
option, and with it `TransformerOptions`, goes: a caller still passing it
is ignored, so nothing breaks before its own change lands, and its sources
are cached exactly when everything else is.

Tested: test-runner.sh gains three checks — a transformer answers, a fresh
process asking the same thing again spawns no runner, the entry is in
transform-v1 — runner 19/19, reduce_canonicalize 4/4; node src/test.mjs;
`lambada emit` against this runtime gives byte-identical output to before
under the Node evaluator and both runners, cold and warm, and warm never
reaches the runner. bin/ rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011zRRfk1bnCFEJEjxgSDavL
@olydis
olydis merged commit 1fafaa4 into main Oct 2, 2026
2 checks passed
olydis pushed a commit to lambada-llc/arboretum that referenced this pull request Oct 2, 2026
tree-calculus 5a83063 -> 1fafaa4 (lambada-llc/tree-calculus#58): a
transformer's outputs are kept under TREE_CALCULUS_CACHE, in transform-v1.
lambada a7398b8 -> ef0bbc3 (lambada-llc/lambada#46): `--cache` is gone;
compiled sources are cached exactly when everything else is.

build.sh already stopped passing the flag (#76), so compiled sources now
sit in .cache/tree-calculus and the 30-day prune covers them; an old
.cache/lambada is dead and can be deleted.

Tested: ./build.sh from an empty cache exits 0 in 3m26s with no diff;
.cache holds only tree-calculus/, transform-v1 included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011zRRfk1bnCFEJEjxgSDavL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants