"""What round 7 moved to the default, and the opt-out that reproduces the old bytes. Three moves, each with its own acceptance measurement in `docs/2026-09-10-k3-runde7-forste-spenn-og-rangeringen.md`: * `--first-span-from-zero`, because 32 of the 32 corpus documents with a plan left their opening text in NO segment -- 9.18 % of the corpus. * `--sheet-section-rows --keep-table-heading`, which were held back in round 6 by a retrieval regression the third move removes. * `tie_shared_rank` on the reading side, which is what removed it. Every move keeps an explicit opt-out: a default a caller cannot turn off is not a default, and a consumer needing the previous bytes needs a way to say so. """ from __future__ import annotations from pathlib import Path from llm_ingestion_okf import cli, consume def test_the_build_defaults_carry_the_three_rules_round_seven_moved() -> None: assert cli.DEFAULT_FIRST_SPAN_FROM_ZERO is True assert cli.DEFAULT_SHEET_SECTION_ROWS is True assert cli.DEFAULT_KEEP_TABLE_HEADING is True def test_the_reading_side_shares_a_rank_a_signal_did_not_earn_by_default() -> None: """`tie_shared_rank` is what let the two build rules above ship. Measured on the D1+D3 bundle: the gold document splits from 1 concept into 12, its own 12 concepts occupy the document-prior signal's whole top tie group, and the concept leading the body signal lands at prior position 11 instead of 1. Row 1 falls from fused rank 1 to 2. Shared ranks put it back. """ assert consume.DEFAULT_TIE_SHARED_RANK is True def test_every_moved_default_has_an_opt_out_that_the_parser_accepts() -> None: args = cli.parse_args( [ "build", "src", "--bundle", "out", "--bundle-id", "x", "--no-first-span-from-zero", "--no-sheet-section-rows", "--no-keep-table-heading", ] ) assert args.first_span_from_zero is False assert args.sheet_section_rows is False assert args.keep_table_heading is False def test_the_build_defaults_reach_the_parser_without_a_flag() -> None: args = cli.parse_args(["build", "src", "--bundle", "out", "--bundle-id", "x"]) assert args.first_span_from_zero is True assert args.sheet_section_rows is True assert args.keep_table_heading is True def test_the_consume_parser_offers_an_opt_out_for_the_shared_rank() -> None: assert consume.parse_args(["b", "--question", "q"]).tie_shared_rank is True assert ( consume.parse_args(["b", "--question", "q", "--no-tie-shared-rank"]).tie_shared_rank is False ) def test_build_payload_defaults_to_the_shared_rank(tmp_path: Path) -> None: """The default reaches the API, not only the CLI. `okf skill` emits `okf consume`, but `tests/test_default_bundle_pin.py` and every measurement harness call `build_payload` directly. A default living in `argparse` alone would make the two disagree. """ import inspect signature = inspect.signature(consume.build_payload) assert signature.parameters["tie_shared_rank"].default is True