feat(okf): den erklaerte bundle_id-en er identiteten - mountet er en filsystem-tilfeldighet

S7a-3 pkt. 1. Til i dag NEKTET reconcile_bundle_id en base som erklaerte en id
katalogen ikke bar. Maalt mot K2 - den foerste leverte basen som erklaerer sin
egen id (618 av 630 konseptfiler + rot-index, alle "k2-trinn1-20260903", levert
som "K2-bundle-20260903") - betydde det at basen ikke kunne aapnes slik den var
levert, og at eneste botemiddel var aa montere den paa nytt for haand, en gang
per leveranse. PM-beslutning: konsumenten slakker.

- Erklaert vinner (B1s rekkefoelge uroert), avviket REGISTRERES:
  ResolvedBundleId.mount + ProvenanceStamp.bundle_id_source +
  DryRunReport.bundle_id_source + run.bundle_id_notice (None ved enighet).
  Stempel-feltet er PAAKREVD uten default: None er en VERDI (veg-stien).
- Det som fortsatt nekter er den EKTE kollisjonen: to KONSEPTER i en base som
  erklaerer ULIKE id-er (okf.assert_declared_ids_agree, kalt ved hver doer som
  aapner en base). Rot-index er IKKE med i enighets-settet - konsept-slaar-index
  er en presedens-regel, saa en index i utakt er fallbacken som taper.
- KONSEKVENS, ikke scope-krype: explore._bundle_index loeser naa den erklaerte
  id-en. Den brukte Path(raw).name mens dispatcheren brukte reconcile...id; med
  erklaert-vinner ville explore() myntet approaches som navngir MOUNTET mens
  dispatcheren ruter paa ERKLAERINGEN - en utforskning med uruterbart mandat.

Load-bearing MAALT: 10 mutasjoner alle roede mot HELE suiten, groenn kontroll
1243 passed / 5 skipped og golden demo-transcript.stdout byte-uendret
(shasum -a 1 = ea8c534773acdbe41ae68f2c55724d69aaf8be4f).
M1 1 / M2 1 / M3 1 / M4 9 / M5 2 / M6 1 / M7 1 / M8 2 / M9 2 / M11 1.

Tre armer i test_bundle_id_reconciliation_loadbearing er SKREVET OM (ikke
slettet) - de pinnet nekten beslutningen fjernet. (j) ble skarpere enn den den
erstattet: erklaert id ruter, mountet nektes.

Kontrakt: docs/okf-konsum-kontrakter.md § 3.1. Invariantrad i CLAUDE.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-03 06:47:58 +02:00
commit baae7507a9
14 changed files with 708 additions and 73 deletions

View file

@ -97,7 +97,8 @@ propagates unchanged; reading an unreadable base as *"no declaration"* is the to
that widens an answer instead of refusing it. Only a base whose index *is* readable and declares
nothing falls through to the next row.
**Measured today: every base resolves `mount-derived`.** No shipped `index.md` declares the key:
**Measured today: every base *in this repo* resolves `mount-derived`.** No shipped `index.md`
declares the key:
```sh
find shared -name index.md | wc -l # -> 7
@ -107,6 +108,42 @@ grep -l 'bundle_id' $(find shared -name index.md) | wc -l # -> 0
So this contract changes which sources are **consulted**, not what happens when none of them
declares anything — which is why adopting it moves no existing call site.
### § 3.1. A declared id BEATS the mount; the mount is a filesystem accident
**Amended 2026-09-03 (S7a-3 pkt. 1), and the amendment is a consumer slacken.** Until then, a base
that declared an id its mount did not carry was **refused** (`BundleIdMismatch`) at every door. The
first delivered corpus that declares its own id — K2, measured 2026-09-03: 618 of 630 concept files
plus the root `index.md`, all saying `k2-trinn1-20260903`, delivered in a directory named
`K2-bundle-20260903` — could therefore **not be opened as delivered**. The only remedy was to
re-mount it under the declared name by hand, once per delivery, forever.
That is a consumer refusing a producer's legitimate output over a directory name. The rule is now:
- **The declared id is the identity.** The mount's basename answers only when nothing is declared.
- **A disagreement is RECORDED, never refused:** `ResolvedBundleId.mount` carries the overridden
directory, `ProvenanceStamp.bundle_id_source` / `DryRunReport.bundle_id_source` carry the whole
resolution into the artefacts, and the run prints **one warning line** naming both values.
- **A base is addressed by its declared id at BOTH doors.** The exploration catalogue
(`list_bundles` / `read_bundle` / `read_file` / `quick_validate`) and the mandate dispatcher
resolve the same id. This is a consequence of the slacken rather than a separate decision: while
a disagreeing declaration was refused the two could not differ, and if they differed now, an
exploration's own minted mandate would be unroutable.
**What still refuses, because no mount name can settle it:** two **concepts inside one base**
declaring **different** ids. Such a base cannot say what it is, and an artefact stamped from it
would name one of two corpora at random. The check runs at every door that OPENS a base.
**The root `index.md` is NOT part of that agreement check** — decision B1 applied a second time.
Concept-beats-index is a *precedence* rule, so an index out of step with its concepts is the
fallback losing, not a collision; folding the index in would newly refuse exactly the K2-shaped
bases this amendment exists to admit.
**Honesty limits, stated.** (1) Without a named concept the root `index.md` answers, so a base whose
index declares X while its concepts declare Y resolves to X — that is B1's resolution order,
unchanged. (2) Two *differently named* directories that both declare the same id now collide in the
dispatcher's "two knowledge bases share the id" refusal; that branch used to require two mounts with
the same basename and is no longer defensive.
**There is no cross-bundle link form.** A consumer holding several bundles partitions per bundle;
the producer emits no syntax for pointing from inside one bundle into another, and adding one is out
of scope until a consumer states the need.