feat(consume): parent reaches the reader -- excerpt field, body link, checker rule

K3-21 A. `okf consume` resolves a concept's `parent:` pointer -- a
`segment_id`, unique only inside one document's plan -- among the concepts
sharing its `source_file` (`consume.link_parents`, one pass, no file opened
again) and an excerpt carries `parent: { concept_id, title }`. Conditional
like `req_number`: a concept with no `parent` key moves no byte. A pointer
that lands nowhere is named `parent_unresolved: true`, never dropped.

The door writes ONE line into a heading-only body whose entry has a parent:
`Enclosing section: [<title>](/<bundle-relative path>)` (SPEC SS 5.1 lineage
through links, SS 6.1 the recommended absolute form and the kind in the
prose). Only such a body, so the segmented goldens' declared parents -- bodies
holding text -- are untouched. Appended AFTER structure derivation and
screened on its own (`_screened`, the `description` rule): read as body text
the link was derived into a second, unresolved `references` edge, measured on
the fixture. `segmentation.heading_only` is the one predicate the proposer and
the door share.

`okf check` gains its seventeenth rule, `parent_unfollowable`: a `parent`
that is not a concept_id and title, names its own excerpt, or names a concept
in neither `excerpts` nor `withheld` (together every considered concept).
Contract SS 8 point 6 added, the figure carries `parent`, and "additional
members are not read by the checker" now says the checker reads only the
members SS 8 names. The template tells the reader what `parent` is and that
SS 2.2 lets it read that one concept; `skill.CONDITIONAL_FIELDS` gains
`parent`. README and CLAUDE.md say what consume now reads.

Moved on purpose, each named: the SS 7.4 known-positive IS the contract
document, so `budget.known_positive` moves in every payload (13 238 / 12 893
/ 345 -> 14 455 / 14 083 / 372); `skills/okf-consume/` regenerated from the
segmented golden, whose plan declares s1 and s2 under s0 -- its example
payload now carries both parents; `test_bundle_identity` 16 -> 17 rules;
`test_shell_parent`'s byte test also accounts for the link line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-11 12:36:23 +02:00
commit 4f7bd61500
16 changed files with 319 additions and 58 deletions

View file

@ -121,6 +121,18 @@ because the producer wrote none — never because the source has none, and never
something to fill in. An excerpt carrying `sources_unreadable` has an address
this reader could not decode: say so rather than reporting no address.
**An excerpt carrying `parent` names the section that encloses it** — the
`concept_id` and `title` of another concept in this bundle. The payload names
that one concept as reachable (§ 2.2), so it is the one file outside the
delivered excerpts you may read: when an excerpt's `text` is its heading alone,
what that section inherits stands in the enclosing concept, whose file is its
`concept_id` plus `.md` under the bundle root. The text links it too, on a line
`Enclosing section: [title](/path)`, where `/` is the bundle root. Cite what you
take from it by that concept's own `(bundle_id, concept_id)`, never by the
excerpt that pointed to it. An excerpt carrying `parent_unresolved` names a
parent this reader could not find in the bundle: say so rather than reporting
that it has none.
| Marking | Use when |
|---|---|
| `extracted` | the bundle states it directly |

View file

@ -132,6 +132,18 @@ because the producer wrote none — never because the source has none, and never
something to fill in. An excerpt carrying `sources_unreadable` has an address
this reader could not decode: say so rather than reporting no address.
**An excerpt carrying `parent` names the section that encloses it** — the
`concept_id` and `title` of another concept in this bundle. The payload names
that one concept as reachable (§ 2.2), so it is the one file outside the
delivered excerpts you may read: when an excerpt's `text` is its heading alone,
what that section inherits stands in the enclosing concept, whose file is its
`concept_id` plus `.md` under the bundle root. The text links it too, on a line
`Enclosing section: [title](/path)`, where `/` is the bundle root. Cite what you
take from it by that concept's own `(bundle_id, concept_id)`, never by the
excerpt that pointed to it. An excerpt carrying `parent_unresolved` names a
parent this reader could not find in the bundle: say so rather than reporting
that it has none.
| Marking | Use when |
|---|---|
| `extracted` | the bundle states it directly |
@ -179,6 +191,7 @@ measurement about the producer, never a fact about the source.
| `verified` | **0 of 3** | no concept in this bundle carries it | that the source document lacks what the field asserts |
| `req_number` | **0 of 3** | no concept in this bundle carries it | that the source document lacks what the field asserts |
| `sources` | **3 of 3** | the producer wrote none for that concept | that the source document lacks what the field asserts |
| `parent` | **2 of 3** | the producer wrote none for that concept | that the source document lacks what the field asserts |
| `source_file` | **3 of 3** | the producer wrote none for that concept | that the source document lacks what the field asserts |
| `source_lines` | **3 of 3** | the producer wrote none for that concept | that the source document lacks what the field asserts |
| `source_offset` | **3 of 3** | the producer wrote none for that concept | that the source document lacks what the field asserts |
@ -195,7 +208,7 @@ carries its denominator.
| Limit | `120000` |
| Unit | `utf-8 bytes of emitted JSON` |
| Instrument | `okf_consume.measure (len of the ensure_ascii=False JSON encoding, utf-8)` |
| Known-positive | `docs/consumption-contract.md, encoded as a JSON string` at `13238` |
| Known-positive | `docs/consumption-contract.md, encoded as a JSON string` at `14455` |
The instrument reproduces the known-positive figure before any of its own
numbers are believed. Report what the run actually spent.
@ -206,10 +219,10 @@ finding requiring a decision — not something to retry with a narrower question
**Scaling. Cost tracks the question, not the corpus.** Measured on this
bundle at generation time, with the question `Hva sier veiledningen om krav?`: the delivered set
was **3 excerpts** costing **2125 utf-8 bytes of emitted JSON**,
against a whole bundle that would cost **2092** by the same instrument if
was **3 excerpts** costing **2289 utf-8 bytes of emitted JSON**,
against a whole bundle that would cost **2256** by the same instrument if
one answer delivered all 3 concepts — so that answer was about
**101.6 %** of the corpus. One question is one measurement: a
**101.5 %** of the corpus. One question is one measurement: a
different question moves `spent` and this figure with it.
**The breaking point, stated so it can be observed to have been passed.**

View file

@ -34,7 +34,7 @@ Why each part is there:
checkout on one machine. The line strips that checkout's prefix and nothing
else, and a test holds the shipped `SKILL.md` to the generator's output with
exactly that prefix removed.
- **`okf check`** should report `conformant: 16 rules over 3 excerpts and 0
- **`okf check`** should report `conformant: 17 rules over 3 excerpts and 0
withheld entries, 0 findings` and exit 0.
The generated `name` is `b-golden-segmented-okf-v0-2-consume` while this

View file

@ -8,13 +8,13 @@
"unit": "utf-8 bytes of emitted JSON",
"instrument": "okf_consume.measure (len of the ensure_ascii=False JSON encoding, utf-8)",
"limit": 120000,
"spent": 2125,
"spent": 2289,
"known_positive": {
"case": "docs/consumption-contract.md, encoded as a JSON string",
"expected": 13238,
"measured": 13238,
"raw_bytes": 12893,
"encoding_delta": 345
"expected": 14455,
"measured": 14455,
"raw_bytes": 14083,
"encoding_delta": 372
}
},
"denominators": {
@ -42,6 +42,10 @@
"source_sha256": "6906ec0acbcfc246e825bda9863c716eb5611b465020e8204eeb448c32343f7d",
"source_lines": "[5, 8]",
"source_offset": "[94, 176]",
"parent": {
"concept_id": "veiledning",
"title": "Veiledning for eksempelbundel"
},
"text_sha256": "08447c690087834883a78fb9f40d474c68b2526ed57d0dafe01c4868db3c04f0",
"text": "\n## 1.1 Foerste krav\n\nEt krav som beskriver den foerste betingelsen i eksempelet.",
"rank": 1
@ -64,6 +68,10 @@
"source_sha256": "6906ec0acbcfc246e825bda9863c716eb5611b465020e8204eeb448c32343f7d",
"source_lines": "[9, 11]",
"source_offset": "[176, 253]",
"parent": {
"concept_id": "veiledning",
"title": "Veiledning for eksempelbundel"
},
"text_sha256": "4c181e1debb141d3cb1a7bd47249fdac1c0b2c5db1b47cf255ef8f04f83ec840",
"text": "\n## 1.2 Andre krav\n\nEt krav som beskriver den andre betingelsen i eksempelet.",
"rank": 2