Repository navigation
Keep a layer that reads a page's own package copy in that page's memory - #6432
Merged
Merged
Conversation
A layer whose selection includes a copy the page holds of a package it selects by path is now a reading of that page: its vocabulary and full composition live in the page's memory (`page_memory.memo`), beside the copy's stamp. A `page init` that replaces the copy replaces the layer instead of adding one beside it, and the layer goes when the page's memory does. A selection of shared package roots alone stays held for the process, one per selection, as before. Before, both readings sat in module dicts keyed by the selection's inputs and the copies' stamps, and nothing dropped an entry. Each `page init` that changed a copy, and each live sample of a page with copies (a new temporary page directory every time), added a composed layer for the life of the process: five inits of one page held five layers, each about 2.9 MB of served files for the default layer alone. Now it holds one. - `layer._Layers` keeps a selection's vocabulary and composition together by its inputs, replaced whole once a copy's stamp moves. One instance serves the process (`_shared`); a page's memory holds another. `page_memory.once` still makes each reading once for requests arriving together. - `page_memory`'s header and `layer-registry.md` no longer say every layer is held for the process. The new test edits a page copy three times and asserts one composed layer stays alive, and none after the page's memory is dropped; it fails against the old store, against a process-wide store, and against a store that ignores the copy's stamp. > _This was written by Claude Code on behalf of max-sixty_
# Conflicts: # src/leaf/layer.py
leaf-agent
approved these changes
Nov 18, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…ages share (#6440) Continues #6432. A layer vocabulary of shared package roots is one object for every page that selects those packages, held for the process, and its `readings` dict gained entries for each page that read it: the vocabulary with the page's `$layer`, and each revision's composed vocabulary, a deep copy of the layer's registry. Both name the page's generation, so no other page read them, and nothing dropped them. After 24 pages past the eight a process keeps, it held 7.4 MiB, growing 238 KiB per page; it now holds 3.9 MiB at 24 or 64. A revision's vocabulary now lives in its page's memory (`registry.storage._Revisions`), beside the layer vocabulary it was composed over, and is composed again once that is replaced. A page's revisions that declare the same still share one. The `$layer` vocabulary is a shallow copy made per call. `_Revisions` and `layer._Layers` share one keyed store, `page_memory.Stamped`. A sample composes its own revision vocabulary instead of sharing its parent's, holding 2.8 MiB rather than 2.6 MiB. The new test fails against the old store, a page store keyed by the vocabulary, and one blind to it. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continues #6411, which moved the server's per-page stores into page memory.
A layer whose selection includes a copy the page holds of a package it selects by path is now that page's reading: its vocabulary and composition live in the page's memory beside the copy's stamp (
layer._held). Apage initthat replaces the copy replaces the layer, which goes when the page's memory does. A selection of shared package roots alone stays held for the process.Before,
_vocabulariesand_compositionswere module dicts keyed by the inputs and the copies' stamps, and nothing dropped an entry. Each copy-changingpage init, and each live sample of a page with copies, kept another composed layer (about 2.9 MB served) for the process's life: five inits held five, now one.layer._Layersholds a selection's vocabulary and composition together, for the process and per page memory.oncestill composes a layer once for requests arriving together.forget_layers(#6412) replaces the shared store, and a page's layer, kept beside it, is composed again.The new test fails against the old store, a process-wide store, one ignoring the copy's stamp, and one ignoring
forget_layers.