memory: derive the L3 and L4 paths and citation ids from a track tag #108

Merged
JakeHillion merged 1 commits from jj/pxqtwqrulmxp into main 2026-07-28 18:25:49 +01:00
Owner

The u in l3u/l4u was spelled out inline everywhere it mattered:
two directory names in nightly, two output filenames in mod, two
filename parsers and two id builders across l3/l4/doc, and the
USER- prefix on archived documents. Adding a second track would mean
finding every one of those format!s and prefix checks.

A new memory::layout module owns every place the tag is spelled out --
directory names, filenames, filename parsers, prefix checks, and the
l2-/l3{tag}- citation ids -- and PersonalityFile gains
track_tag() and stem() to supply it. The match in track_tag is
exhaustive rather than a lookup table, so two tracks cannot collide on a
tag by construction. L2 is shared across tracks and so stays untagged.

Call sites pass PersonalityFile::User.track_tag() explicitly for now;
threading a Track through in place of the bare tag comes later in the
stack. Nothing about the names changes: layout's first test pins the
user track's directories and filenames to the exact strings already on
disk, so a regression here fails loudly rather than silently writing to
a new path.

PeriodTag and PeriodSpan were the same struct in two modules and
both become aliases of layout::Span.

Test plan:

  • CI
  • The filename and id-format tests move into layout, which covers what
    the per-level copies did plus the cases they could not express: that a
    parser rejects the neighbouring level, and that track t does not
    claim track u's files. 8 removed, 7 added, so cargo test goes
    181 -> 180 passing with the same 19 pre-existing calendar failures
    (those need a container runtime).
  • layout::user_track_names_match_the_established_layout is the
    load-bearing one: it asserts l3u/l4u and
    l3u-{first}-{last}.jsonl.zst verbatim.
The `u` in `l3u`/`l4u` was spelled out inline everywhere it mattered: two directory names in `nightly`, two output filenames in `mod`, two filename parsers and two id builders across `l3`/`l4`/`doc`, and the `USER-` prefix on archived documents. Adding a second track would mean finding every one of those `format!`s and prefix checks. A new `memory::layout` module owns every place the tag is spelled out -- directory names, filenames, filename parsers, prefix checks, and the `l2-`/`l3{tag}-` citation ids -- and `PersonalityFile` gains `track_tag()` and `stem()` to supply it. The match in `track_tag` is exhaustive rather than a lookup table, so two tracks cannot collide on a tag by construction. L2 is shared across tracks and so stays untagged. Call sites pass `PersonalityFile::User.track_tag()` explicitly for now; threading a `Track` through in place of the bare tag comes later in the stack. Nothing about the names changes: `layout`'s first test pins the user track's directories and filenames to the exact strings already on disk, so a regression here fails loudly rather than silently writing to a new path. `PeriodTag` and `PeriodSpan` were the same struct in two modules and both become aliases of `layout::Span`. Test plan: - CI - The filename and id-format tests move into `layout`, which covers what the per-level copies did plus the cases they could not express: that a parser rejects the neighbouring level, and that track `t` does not claim track `u`'s files. 8 removed, 7 added, so `cargo test` goes 181 -> 180 passing with the same 19 pre-existing calendar failures (those need a container runtime). - `layout::user_track_names_match_the_established_layout` is the load-bearing one: it asserts `l3u`/`l4u` and `l3u-{first}-{last}.jsonl.zst` verbatim.
JakeHillion changed target branch from jj/qkozvqrtnsru to main 2026-07-28 18:07:02 +01:00
JakeHillion added 1 commit 2026-07-28 18:07:02 +01:00
The `u` in `l3u`/`l4u` was spelled out inline everywhere it mattered:
two directory names in `nightly`, two output filenames in `mod`, two
filename parsers and two id builders across `l3`/`l4`/`doc`, and the
`USER-` prefix on archived documents. Adding a second track would mean
finding every one of those `format!`s and prefix checks.

A new `memory::layout` module owns every place the tag is spelled out --
directory names, filenames, filename parsers, prefix checks, and the
`l2-`/`l3{tag}-` citation ids -- and `PersonalityFile` gains
`track_tag()` and `stem()` to supply it. The match in `track_tag` is
exhaustive rather than a lookup table, so two tracks cannot collide on a
tag by construction. L2 is shared across tracks and so stays untagged.

Call sites pass `PersonalityFile::User.track_tag()` explicitly for now;
threading a `Track` through in place of the bare tag comes later in the
stack. Nothing about the names changes: `layout`'s first test pins the
user track's directories and filenames to the exact strings already on
disk, so a regression here fails loudly rather than silently writing to
a new path.

`PeriodTag` and `PeriodSpan` were the same struct in two modules and
both become aliases of `layout::Span`.

Test plan:
- CI
- The filename and id-format tests move into `layout`, which covers what
  the per-level copies did plus the cases they could not express: that a
  parser rejects the neighbouring level, and that track `t` does not
  claim track `u`'s files. 8 removed, 7 added, so `cargo test` goes
  181 -> 180 passing with the same 19 pre-existing calendar failures
  (those need a container runtime).
- `layout::user_track_names_match_the_established_layout` is the
  load-bearing one: it asserts `l3u`/`l4u` and
  `l3u-{first}-{last}.jsonl.zst` verbatim.
JakeHillion merged commit 7530203346 into main 2026-07-28 18:25:49 +01:00
JakeHillion deleted branch jj/pxqtwqrulmxp 2026-07-28 18:25:49 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JakeHillion/personal-agent#108