feat(consume): --follow-parent carries the enclosing section's text, from room the cut left
K3-21 B. The second form of `parent`: `okf consume --follow-parent` (`consume.attach_parent_text`) puts the enclosing concept's text inside an excerpt's `parent`, with that concept's own `sha256` so a claim resting on it is cited as that concept. It runs AFTER the cut, on the room the cut left, in rank order, so the delivered set, its order, the withheld list and the denominators are the same with the flag as without it -- inherited text cannot displace an excerpt, the mechanism a consumer measured when copied-in ancestor text pushed the right section to withheld place 504 and 1 069. A text that does not fit is cut to the longest prefix that does and marked `truncated`; a parent the payload already holds, or one a higher-ranked excerpt already carried, travels once. OFF; the defaults are chosen on the measurement that follows this commit. `delivered_text` is the one normalisation an excerpt's `text` and a parent's share. Contract SS 8 point 6 gains the MAY; the template tells the reader what `text`, `sha256` and `truncated` mean. README and CLAUDE.md name the flag. Moved on purpose: the SS 7.4 known-positive again (14 455 / 14 083 / 372 -> 14 721 / 14 346 / 375), and `skills/okf-consume/` regenerated with it. `tests/test_parent_text.py::test_no_room_means_no_text_and_no_lost_excerpt` changed from its red form: it asked through `build_payload` at `limit == spent`, where the knapsack's 500 B buckets admit nothing at all (`budget_admits_nothing`); it now holds the rule at `attach_parent_text`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
ca83dadf53
commit
839bd61349
8 changed files with 158 additions and 25 deletions
|
|
@ -94,12 +94,30 @@ def test_a_text_that_does_not_fit_is_clipped_and_says_so(tmp_path: Path) -> None
|
|||
|
||||
|
||||
def test_no_room_means_no_text_and_no_lost_excerpt(tmp_path: Path) -> None:
|
||||
"""Held at the function, not through `build_payload`: the knapsack buckets
|
||||
weights up and capacity down to 500 B, so a payload limit equal to what was
|
||||
spent admits nothing at all (`budget_admits_nothing`). The red version of
|
||||
this test asked through that and met the bucket instead of the rule."""
|
||||
bundle = _flagged(tmp_path)
|
||||
plain = consume.build_payload(bundle, question=SHELL, k=1)
|
||||
exact = plain["budget"]["spent"]
|
||||
followed = consume.build_payload(bundle, question=SHELL, k=1, follow_parent=True, limit=exact)
|
||||
assert "text" not in _shell(followed)["parent"]
|
||||
assert _ids(followed) == _ids(plain)
|
||||
concepts = {
|
||||
concept.concept_id: concept
|
||||
for concept in consume.link_parents(
|
||||
[
|
||||
consume.read_concept(
|
||||
bundle / f"{concept_id}.md",
|
||||
bundle_root=bundle,
|
||||
root_bundle_id="inherit-fixture",
|
||||
)
|
||||
for concept_id in consume.enumerate_concepts(bundle)
|
||||
]
|
||||
)
|
||||
}
|
||||
spent = plain["budget"]["spent"]
|
||||
# No room, and room smaller than the members a text needs around it.
|
||||
for limit in (spent, spent + 30):
|
||||
followed = consume.attach_parent_text(plain["excerpts"], concepts, limit=limit)
|
||||
assert list(followed) == plain["excerpts"]
|
||||
|
||||
|
||||
def test_a_parent_the_payload_already_holds_is_not_delivered_twice(tmp_path: Path) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue