fix(corpus): the root index links the bundle's own log

Measured on the K2 artifact by a consumer: `log.md` was on disk and no
index named it, so a reader entering the bundle at `index.md` -- the walk
section 8 exists to support -- never reached the one file carrying `N`.

Stated as a LOCAL choice rather than conformance, because it is one.
Upstream's own bundles do not link their log: measured at `9a15b13`, 0 of
the 24 shipped `index.md` files name the single `log.md` in the set, with
the same grep form finding `tables/index.md` in 4 of them as the
known-positive control. That shows the link is not REQUIRED -- not that
it is disallowed. `docs/plan/okf-v0.2-alignment.md` P1-F6 already
recorded the upstream shape; a line there now separates the two claims,
since reserved names still stay out of an `entries_match_directory`
listing and this profile has that off.

It lives in the harness because the library cannot make it. The log's
content IS the run's outcome, so it cannot exist when the indexes are
projected, and an index that enumerated it off the directory would gain
the link only from the second run onward -- breaking
rebuild-equals-incremental, the property the segmented bundle is built
on.

The membership test is load-bearing and was measured, not assumed. The
two reprojections disagree about this line: the per-directory one drops
every managed entry before re-emitting its block, while the flat one
keeps a managed line whose target is not an owned concept, deliberately,
so that a regex cannot delete curated content. Appending unconditionally
therefore doubled the entry on the second unsegmented run, which is why
both run modes are pinned separately.

1052 -> 1054 tests. `mypy --strict` clean, `ruff` clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-03 20:23:56 +02:00
commit 95eb271f57
4 changed files with 180 additions and 3 deletions

View file

@ -619,6 +619,16 @@ profile requires has to know to exclude reserved names, and this library tells
them only about `index.md`. Consistent with "the library enumerates nothing" —
but the caller is being asked to know something we hold and do not state.
**This is not in tension with the corpus harness linking its own `log.md`
(`tools/okf_corpus_run.py`, 2026-09-03), and the two statements are about
different things.** Here: a reserved name must stay OUT of the listing an
`entries_match_directory` profile matches against, or the directory comparison
fails. There: a harness adds one navigational link to the root index of the
bundle it produces, under a profile with `entries_match_directory=False`. What
upstream's `acme_retail` settles is that the link is not required; it does not
make the link wrong, and a consumer entering a bundle at `index.md` otherwise
never reaches the file carrying `N`.
**What the sweep confirmed, which matters as much as what it found:**
- **V-A3 holds against real third-party v0.2 data.** No `generated` value in