Skip to content

Carve floor: one definition of a line — the arrival verifier numbers lines as the manifest validator does (RULED Q-L8 (c)) - #907

Merged
brettheap merged 2 commits into
mainfrom
change/carve-floor-one-definition-of-a-line
Sep 10, 2026
Merged

brettheap merged 2 commits into
mainfrom
change/carve-floor-one-definition-of-a-line

Conversation

@brettheap

@brettheap brettheap commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)

Refs #656

The ruling

Brett Heap, 2026-09-10, verbatim: "rule Q-L8 (a) approve, (b) (b′), (c) approve" — recorded at #656 comment 5621357564:

(c) APPROVED — unify line numbering in scripts/validate-carve-manifest.py and scripts/verify-carve-arrival.py (one definition of a line; the two rows carrying U+2028 re-declared so their 6 lines are appliable), a small tool fix on openxFactory, sequenced after leg 3 lands and before the § 5 remainder.

Asked as Q-L8 (c) in the leg-3 memo (comment 5621296616, finding 5): "the two halves of the floor number lines differently — validate-carve-manifest.py counts b"\n", verify-carve-arrival.py uses str.splitlines(), so 2 rows carrying U+2028 have 6 declared lines the leg cannot apply — a tool defect in openxFactory", and confirmed by the independent verification (comment 5621719657: "Q-L8 causes all CONFIRMED").

The divergence, both code sites

Before. scripts/validate-carve-manifest.py, _check_edit_lines — the bound a declared line must satisfy at the carve commit:

    total = content.count(b"\n") + (0 if not content or content.endswith(b"\n")
                                    else 1)

scripts/verify-carve-arrival.py, _check_declared_lines — which lines a phase-B diff touched at the destination:

    carve_lines = carve.decode("utf-8", "surrogateescape").splitlines()
    arrived_lines = arrived.decode("utf-8", "surrogateescape").splitlines()

str.splitlines() also breaks on U+2028, U+2029, \v, \f, \x1c, \x1d, \x1e and \x85. One tool issued line numbers; the other read them in a numbering it had never been given.

After. One module, imported by both:

# scripts/validate-carve-manifest.py
    total = carve_lines.count(content)

# scripts/verify-carve-arrival.py
    carve_records = carve_lines.text_records(carve)
    arrived_records = carve_lines.text_records(arrived)
# scripts/carve_lines.py — the whole definition
def records(content: bytes) -> list[bytes]:
    parts = content.split(b"\n")
    if parts and parts[-1] == b"":
        parts.pop()
    return parts

The definition adopted is the validator's own, which is what git diff and grep -n show and what the manifest's authors counted in: a line is a \n-terminated record of the raw bytes; line N is the Nth such record, 1-based; a trailing newline closes the last record without opening another; \r is content and not a terminator. So the count does not move — pinned rather than asserted by test_the_line_count_is_exactly_the_expression_the_validator_carried, which holds the module equal to the old inline expression over a corpus carrying every separator splitlines() would have added (\r\n, a lone \r, U+2028, U+2029, \x85, \v, \f, \x1c-\x1e, the empty blob, and a blob that is not UTF-8 at all).

Two consequences reported rather than buried:

  • \r staying content is a widening. A CRLF/LF flip is now a change AT a line number — refused by number where the row does not declare that line, admitted where it does — instead of falling into the old "a change no line number can name" message, which told an operator nothing about a file whose every line had in fact moved. test_a_flipped_line_terminator_is_named_by_its_line_number pins it.
  • That refusal stays, and is now exact. Under this definition the ONE change no line number can name is a final newline gained or lost (b"a\nb\n" and b"a\nb" have the same records), and the refusal now says so. test_a_change_no_line_number_can_name_still_refuses was moved onto that mutation.

NO MANIFEST CHANGE — the six lines at b075fd91

A census over all 456 rows' blobs at the carve commit: exactly three carry a blob the two numberings disagree about, and only two of them declare lines.

row floor (\n) splitlines() declares
tests/corpus-adapter/test_openxfactory_adapter.py 521 522 nothing (not_moved / stays_openxfactory_adapter)
tests/ideation-dashboard/test_gate_console.py 2364 2367 48-58, 870, 1627, 1785, 1786, 1810
tests/ideation-dashboard/test_round_trip.py 734 738 32, 33, 36, 728

All six were written in \n numbering, so nothing in the manifest is re-declared — measured line by line, class taken from the row, text from the blob at b075fd91dc8fced8e1373825ba80220c33536bae:

row : line class line N under the floor's definition line N under splitlines()
test_gate_console.py:870 import rewrites from ideation_dashboard import cli _fragment(root).parent.mkdir(parents=True, exist_ok=True)
test_gate_console.py:1627 path constants assert d["command"].startswith("python3 scripts/ideation_dashboard/cli.py gate") r = _run_node(tmp_path)
test_gate_console.py:1785 path constants assert argv[:1] == ["scripts/ideation_dashboard/cli.py"], argv command = _hostile_gate_commands(tmp_path)[action]
test_gate_console.py:1786 path constants assert argv.count("scripts/ideation_dashboard/cli.py") == 1, argv argv, _output, run_dir = _paste_gate_command(tmp_path, command)
test_gate_console.py:1810 import rewrites from ideation_dashboard import cli refuse it — inside the process, which is the layer that can refuse."""
test_round_trip.py:728 path constants mine = (REPO_ROOT / "scripts/ideation_dashboard/round_trip.py").read_text( def test_the_shared_predicate_is_spelled_the_same_in_all_three():

Every left-hand cell is exactly the import rewrites / path constants text its row's note describes; every right-hand cell is unrelated code. The U+2028 characters sit at test_gate_console.py \n-lines 795 and 802 (3 occurrences) and test_round_trip.py \n-lines 113, 115, 507 and 511 (4). No row's blob at the carve commit carries a \r at all, so the CRLF half of the definition changes nothing about the real manifest. test_the_real_manifests_declared_lines_are_the_floors_lines asserts this table AND the census against the landed document, so a fourth disagreeing row appearing later fails a test rather than a leg.

Counts unchanged, as the ruling's sequence requires: 456 rows, 318 digests, 794 declared lines over 147 rows, 20 replicas.

The regression tests

Ten new cases; the modified terminator case makes eleven touched.

tests/carve_arrival/ — the fixture scripts/pkg/exotic.py carries U+2028 inside line 2, so it is five lines to the floor and six to splitlines(), and its appended row declares line 4 (no other case's row or digest count moves):

  • test_a_declared_edit_after_a_u2028_line_verifies — phase A first, because the numbering plays no part in a digest comparison and must not move; then the declared edit applied at line 4 → phase B OK, declared_edits_diffed: 1, declared_edits_unapplied: 1.
  • test_an_undeclared_edit_after_a_u2028_line_names_the_floors_number — an undeclared edit at line 5 → arrival-undeclared-edit naming [5], the number the manifest can declare and the validator will bound. The old code said [6], which no row could declare.
  • test_a_flipped_line_terminator_is_named_by_its_line_number — CRLF/LF, refused at [2, 3] with declared line 1 admitted.
  • test_the_verifier_numbers_lines_with_the_floors_shared_definition — the module rather than a run.

tests/carve_manifest/ — the two tools agreeing:

  • test_the_two_tools_number_a_u2028_bearing_blob_identically — record by record on one U+2028 blob, with the old reading's line 4 (KEEP = 3) asserted as the non-vacuity.
  • test_both_tools_reach_one_definition_of_a_line — MODULE.carve_lines is arrival.carve_lines: one module object, not two spellings that agree today.
  • test_neither_tool_splits_lines_by_any_other_route — an AST drift guard over both scripts (a grep cannot tell prose from a call, and both docstrings must name splitlines() to explain what was wrong with it), with scripts/carve_lines.py asserted as the one file holding a split and both scripts asserted to import it.
  • test_the_bound_is_the_floors_line_count_on_a_u2028_bearing_blob — a row declaring line 6 of a five-line file refuses carve-shape-invalid: "names line 6 … carries 5 line(s)". A line the floor cannot express never reaches a leg as a declaration.
  • test_the_line_count_is_exactly_the_expression_the_validator_carried — the count does not move.
  • test_the_real_manifests_declared_lines_are_the_floors_lines — the table and census above.

Proof, verbatim

The suites.

$ python3 -m pytest -q tests/carve_manifest tests/carve_arrival
198 passed in 55.94s

origin/main's baseline is 187 (100 + 87); this branch is 198 (107 + 91) — ten new cases plus the review round's test_loading_either_tool_by_path_twice_does_not_grow_sys_path.

Non-vacuity, by mutation — every new case was proven to fail against the old numbering:

# mutation 1: the ARRIVAL site numbers with splitlines() again (nothing else changed)
4 failed, 193 passed
FAILED tests/carve_arrival/…::test_a_flipped_line_terminator_is_named_by_its_line_number
FAILED tests/carve_arrival/…::test_a_declared_edit_after_a_u2028_line_verifies
FAILED tests/carve_arrival/…::test_an_undeclared_edit_after_a_u2028_line_names_the_floors_number
FAILED tests/carve_manifest/…::test_neither_tool_splits_lines_by_any_other_route

# mutation 2: the SHARED definition becomes splitlines()
10 failed, 187 passed        (exactly the ten new cases)

Mutation 1 reproduces the defect on the fixture — a correctly applied declared edit REFUSING, which is what leg 3 met on six real lines:

{"result": "refused", "code": "arrival-undeclared-edit", "detail": "src/pkg/exotic.py was edited
at carve-commit line(s) [5] which the row for scripts/pkg/exotic.py does not declare; it declares
[4] under class(es) path constants. …"}

The manifest validator, every documented mode, exit 0.

$ python3 scripts/validate-carve-manifest.py
OK …/docs/opendox-carve-manifest.yaml: 456 row(s) at opensoft/openxFactory@b075fd91dc8f (opendox-carve-0), verified at e7c41e8ed491 — 172 moved_verbatim, 146 moved_with_declared_edit, 138 not_moved; 318 digest(s) recomputed; 456 file(s) in the declared surface with none undeclared

$ python3 scripts/validate-carve-manifest.py --at b075fd91dc8fced8e1373825ba80220c33536bae
OK …/docs/opendox-carve-manifest.yaml: 456 row(s) at opensoft/openxFactory@b075fd91dc8f (opendox-carve-0) — 172 moved_verbatim, 146 moved_with_declared_edit, 138 not_moved; 318 digest(s) recomputed; 456 file(s) in the declared surface with none undeclared

$ python3 scripts/validate-carve-manifest.py --json
{"result": "ok", …, "rows": 456, "dispositions": {"moved_verbatim": 172, "moved_with_declared_edit": 146, "not_moved": 138}, "digests_recomputed": 318, "surface": 456}

# § 5.2's mirror control, --manifest named absolutely
$ python3 "$OXF/scripts/validate-carve-manifest.py" --repo oxf-carve-src.git \
      --at b075fd91… --manifest "$OXF/docs/opendox-carve-manifest.yaml"
OK … 456 row(s) … 318 digest(s) recomputed; 456 file(s) in the declared surface with none undeclared

# from a descendant directory (docs/), the ANCESTRY reading
exit=0

Phase A, from a scratch destination materialised from b075fd91 — the numbering must not touch it.

$ python3 scripts/verify-carve-arrival.py --destination opendox_spec --dest-root … --source-repo . --phase A
OK …/dry-spec: opendox_spec (opensoft/openDox-spec) at opensoft/openxFactory@b075fd91dc8f (opendox-carve-0), phase A — 56 row(s) arrived, 56 digest(s) verified, 0 declared-edit row(s) within their lines, 0 unapplied; 0 of 0 declared replica(s) verified (byte-identical, or — where the row declares lines — differing only on them); 56 file(s) under contracts/schemas, docs, examples/ideation-dashboard with none undeclared (0 scaffold, 0 replica, 0 created); scaffold admissions by NAME ONLY (no --dest-base and no origin/main at the destination)

$ python3 scripts/verify-carve-arrival.py --destination opendox_code --dest-root … --source-repo . --phase A
OK …/dry-code: opendox_code (opensoft/openDox-code) at opensoft/openxFactory@b075fd91dc8f (opendox-carve-0), phase A — 123 row(s) arrived, 123 digest(s) verified, 0 declared-edit row(s) within their lines, 0 unapplied; 0 of 0 declared replica(s) verified (byte-identical, or — where the row declares lines — differing only on them); 123 file(s) under src/opendox, tests with none undeclared (0 scaffold, 0 replica, 0 created); scaffold admissions by NAME ONLY (no --dest-base and no origin/main at the destination)

56/56 and 123/123, and the control that matters: the same two runs driven by git show origin/main:scripts/verify-carve-arrival.py on the same two trees produce byte-identical output (diff empty for both destinations). Phase A does not move.

Phase B on leg 1's landed tree — opensoft/openDox-code at ce53b489 (leg 1's merge, PR opensoft/openDox-code#6), --dest-base da2391e0d3a3, with that PR's ten --replica-at declarations:

OK …/opendox-code: opendox_code (opensoft/openDox-code) at opensoft/openxFactory@b075fd91dc8f (opendox-carve-0), phase B — 123 row(s) arrived, 61 digest(s) verified, 61 declared-edit row(s) within their lines, 2 unapplied; 10 of 10 declared replica(s) verified (byte-identical, or — where the row declares lines — differing only on them); 132 file(s) under src/opendox, tests with none undeclared (1 scaffold, 0 replica, 0 created); scaffold admissions checked against da2391e0d3a3

Still OK, with the same 61 declared-edit rows within their lines and 10 of 10 replicas, and again byte-identical to origin/main's verifier on the same tree (diff empty), which is what makes the numbering change provably invisible to a landed leg.

Two disclosures on that line, neither caused by this change (the old-vs-new identity is the proof):

  • 2 unapplied where PR Add Omnigent install submodule #6's body recorded 1. The extra one is the Q-L7 (a) amendment, which landed after leg 1 and gave tests/ideation-dashboard/conftest.py its :25 declaration; leg 1's copy at tests/conftest.py is byte-identical to the carve blob, so its declared edit is unapplied and counted. The first is leg 1's own scripts/ideation_dashboard/doxbench_scope_types.py (lines 50, 69, 71 — the adapter calls the BUILD arc owns). Measured independently of the verifier.
  • 10 of 10 declared replica(s) verified (byte-identical, or …) where PR Add Omnigent install submodule #6 recorded byte-identical — the same Q-L7 amendment's wording change to the summary line, already on main before this branch.

openspec.

$ OPENSPEC_TELEMETRY=0 openspec validate --all --strict
Totals: 96 passed, 4 failed (100 items)
✗ change/disposition-codexfactory-declared-renames
✗ change/disposition-codexfactory-floor-relocation-retitle
✗ spec/neutral-product-pin
✗ spec/repo-boundary-governance

Identical on origin/main (96 passed, 4 failed, the same four items), measured in a worktree at 92d0367c. No new failure, and nothing under openspec/ is touched by this branch.

doc-health (python3 scripts/doc-health.py --single-repo .), branch against origin/main, repo labels normalised:

  • findings identical: 32 critical, 5 error, 47 warning, 16 info. New regressions vs previous report: 0. — none added, none cleared;
  • draft words 160055 → 160311 (+256: the § 2.1 paragraph, in a Status: draft runbook);
  • canon share by words 39.8% → 39.7% (canon words unchanged at 367584; governance words 924654 → 924910).

That is the whole delta — the expected dip from adding words to a draft, no finding either way.

Review round

Copilot, 2 threads, both FACTUAL, both fixed at adaad35e and resolved. Both said the same thing about the two entry points: sys.path.insert(0, <scripts>) was unconditional, and since both tools are hyphenated and therefore loaded by spec_from_file_location rather than imported — tests/carve_manifest/ loads the validator at import and the arrival verifier in four cases, tests/carve_arrival/ loads the verifier again — each load prepended another copy of scripts/ and moved import precedence for everything after it in the session. Now guarded with the if _SCRIPTS_DIR not in sys.path form scripts/proposal-support.py carries, whose comment names this exact case, and pinned by a test that loads both tools three further times and asserts the entry count does not move. Re-proved after the guard: 198 passed, and the validator's five documented modes, both phase-A runs and the leg-1 phase-B run are byte-identical to their output before it.

Sourcery declined the review ("you've used your own review budget of 250,000 diff characters for the last 7 days") — no threads, and its check reports SKIPPED.

The runbook

§ 2.1 gains the definition where a reader asks for it, immediately after the findings table that says arrival-undeclared-edit "names the lines": what a line is, that scripts/carve_lines.py holds it and both tools import it, the three rows and six declared lines the old reading broke, that no row was re-declared, and the one change the definition cannot express.

Lands on Brett Heap's ruling Q-L8 (c) via the lane's gate, sequenced after leg 3 (openXdox-code #5) lands.

🤖 Generated with Claude Code

…lines as the manifest validator does (RULED Q-L8 (c))

The two halves of FLOOR PART 1 disagreed about what a line IS.
`validate-carve-manifest.py` bounded the manifest's 794 declared edit lines
with `content.count(b"\n")`; `verify-carve-arrival.py` decided at the
destination which lines a diff touched with `str.splitlines()`, which also
breaks on U+2028, U+2029, \v, \f, \x1c-\x1e and \x85. Measured over the landed
manifest, three rows carry U+2028 inside a line — 521/522, 2364/2367 and
734/738 lines by the two readings — and two of them are
`moved_with_declared_edit` rows to `openxdox_code`, so six declared lines
(`test_gate_console.py` 870, 1627, 1785, 1786, 1810 and `test_round_trip.py`
728) named one line where they were issued and another where they were checked.
Carve leg 3 left all six among its 59 unapplied lines and reported the cause
(finding 5), and its independent verification confirmed it.

ONE DEFINITION, IN ONE MODULE, IMPORTED BY BOTH: `scripts/carve_lines.py` — a
line is a `\n`-terminated record of the raw bytes, line N the Nth such record
from 1, a trailing newline closing the last record without opening another,
`\r` content and not a terminator. It is the numbering the validator already
used, which `git diff` and `grep -n` show, and which the manifest's authors
counted in — so the count does not move and no declared line was re-declared.

THE COUNT IS PINNED, not asserted: the module is held equal to the validator's
old inline expression over a corpus carrying every separator `splitlines()`
would have added. `\r` staying content is a widening reported here rather than
buried: a CRLF/LF flip is now a change AT a line number, refused by number
where the row does not declare it, instead of falling into the "no line number
can name" message that told an operator nothing about a file whose every line
had moved. That refusal stays, and now names the one change the definition
cannot express — a final newline gained or lost.

NO MANIFEST CHANGE. Every one of the six lines already names, at
b075fd9, exactly the `import rewrites` / `path constants` text its row's
class describes under this definition, and unrelated text under
`splitlines()`; `tests/carve_manifest` now asserts that line by line against
the landed document, plus a census that the disagreeing set is exactly those
three rows. Counts unchanged: 456 rows, 318 digests, 794 lines over 147 rows.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 10, 2026 17:23
@sourcery-ai

sourcery-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR fixes Q-L8(c) by replacing the validator/verifier line-numbering mismatch with one shared raw-byte \n-record implementation, preserving existing manifest numbering while making Unicode-separator edits and CRLF/LF changes report and validate against the same lines. It adds extensive regression and drift guards, validates the affected real-manifest rows, and documents the ruling and behavior in the cutover runbook.

Sequence diagram for declared edit arrival verification

sequenceDiagram
    participant Manifest
    participant Validator as validate-carve-manifest.py
    participant Shared as carve_lines.py
    participant Verifier as verify-carve-arrival.py
    participant Arrival as Destination blob

    Manifest->>Validator: Validate edits[].lines
    Validator->>Shared: count(content)
    Shared-->>Validator: Raw-byte newline record count
    Validator-->>Manifest: Declared lines are bounded
    Manifest->>Verifier: Provide declared lines
    Verifier->>Arrival: Read arrived bytes
    Verifier->>Shared: text_records(carve)
    Verifier->>Shared: text_records(arrived)
    Shared-->>Verifier: Identically numbered records
    Verifier-->>Manifest: Accept declared changes or refuse undeclared lines
Loading

File-Level Changes

Change Details Files
Centralize the floor’s raw-byte line-record semantics and make both manifest validation and arrival verification use the same implementation.
  • Add carve_lines.py with \n-record parsing, line counting, surrogate-escaped text conversion, and the shared definition text.
  • Replace the validator’s inline newline count with carve_lines.count.
  • Replace the arrival verifier’s Unicode splitlines() calls with carve_lines.text_records, while retaining refusal for final-newline-only differences and treating CRLF/LF changes as line-local content changes.
  • Load the shared module from both hyphenated scripts via the scripts directory path.
scripts/carve_lines.py
scripts/validate-carve-manifest.py
scripts/verify-carve-arrival.py
Add regression, agreement, drift, and real-manifest census coverage for Unicode line-separator divergence without changing manifest declarations.
  • Exercise U+2028-bearing files, declared and undeclared edits, CRLF/LF changes, final-newline changes, and phase A/B behavior.
  • Assert both tools reference the same module and neither reintroduces independent line splitting or counting.
  • Pin the shared count to the validator’s previous expression and verify the six affected real-manifest lines retain their intended classes and content.
  • Confirm the manifest’s three discrepant rows and prove no row re-declaration is required.
tests/carve_arrival/test_verify_carve_arrival.py
tests/carve_manifest/test_carve_manifest.py
Document the unified line definition, affected real-manifest rows, and operational implications in the cutover runbook.
  • Define line numbering as raw-byte \n-terminated records with \r treated as content and a trailing newline not creating an extra record.
  • Record the three U+2028-bearing rows, six affected declared lines, and the fact that the manifest remains unchanged.
docs/opendox-cutover-runbook.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new unconditional sys.path.insert(0, ...) in both scripts should be made idempotent (as in other repo entrypoints) to avoid accumulating duplicate sys.path entries when modules are repeatedly loaded by path in tests/tooling.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR eliminates a long-standing line-numbering mismatch between the carve manifest validator and the carve arrival verifier by centralizing a single “what is a line” definition and updating both tools (plus tests/docs) to use it, ensuring declared edit lines remain applicable even when blobs contain Unicode line-separator characters.

Changes:

  • Introduce scripts/carve_lines.py as the shared, byte-level \n-record line definition (with helpers for counting and text records).
  • Update scripts/validate-carve-manifest.py and scripts/verify-carve-arrival.py to use the shared module for bounds checking and diff line attribution/refusals.
  • Add targeted regression tests for U+2028/CRLF/final-newline edge cases and document the ruled definition in the cutover runbook.
File summaries
File Description
tests/carve_manifest/test_carve_manifest.py Adds cross-tool agreement, drift-guard, and “count unchanged” tests around the shared line definition.
tests/carve_arrival/test_verify_carve_arrival.py Adds arrival-side regressions for U+2028 and CRLF/LF flips under the unified numbering.
scripts/verify-carve-arrival.py Switches declared-line checking to shared line records and updates refusal semantics/messages accordingly.
scripts/validate-carve-manifest.py Switches declared-line bound computation to the shared carve_lines.count().
scripts/carve_lines.py New shared implementation of “line = raw bytes between \n terminators” plus decoded records for diffs.
docs/opendox-cutover-runbook.md Documents the ruled line definition and its operational impact on refusals / declared lines.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/validate-carve-manifest.py Resolved
Comment thread scripts/verify-carve-arrival.py Resolved
@brettheap
brettheap marked this pull request as ready for review September 10, 2026 17:32

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 7 hours and 28 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

Copilot's finding on both entry points, and it is right on this repository's
own idiom: `sys.path.insert(0, <scripts>)` was unconditional, and both files
are loaded by `spec_from_file_location` rather than imported — `tests/carve_
manifest/` loads the validator at import and the arrival verifier in four
cases, `tests/carve_arrival/` loads the verifier again — so each load prepended
another copy of `scripts/` and moved import precedence for everything that ran
after it in the session. Guarded with the `if _SCRIPTS_DIR not in sys.path`
form `scripts/proposal-support.py` carries, whose comment names this exact
case ("covers the case this script is loaded by `spec_from_file_location`
(which the tests do)").

`test_loading_either_tool_by_path_twice_does_not_grow_sys_path` keeps it: three
further loads across both tools must leave the entry count where it was. 198
passed; the manifest validator's five documented modes, both phase-A dry runs
and the leg-1 phase-B run are byte-identical to their output before the guard.

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

scripts/carve_lines.py’s count() currently allocates full record lists via records() and should avoid that to prevent unnecessary memory churn during manifest validation.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/carve_lines.py:104

  • count() currently computes the line count via len(records(content)), which forces a full split() allocation of all records even when callers (e.g. validate-carve-manifest.py’s _check_edit_lines) only need the numeric upper bound. This can create avoidable memory churn on large blobs and is called repeatedly across manifest rows.

Consider implementing count() as a non-allocating scan over the bytes (still exactly matching the floor’s definition) and keep records() for the cases that truly need the record list.

  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit 40d2f82 into main Sep 10, 2026
14 checks passed
brettheap added a commit that referenced this pull request Sep 10, 2026
…g before the ratification encode

MERGED BEFORE THE ENCODE SO EVERY RATIFICATION FIGURE IS TAKEN ON A TREE THAT
ALREADY CARRIES CURRENT MAIN. The branch was frozen at `5dd724f5` when
`origin/main` was `e0638f11` — the tree every figure in the pull request body
and in `tasks.md` § 5 was measured on. `origin/main` has since advanced by two
commits, `40d2f821` (the carve floor's line definition, PR #907) and `bd1c54c6`
(the `lane-line` workflow's lane-key character class widened for uppercase, PR
#909), so this merge comes FIRST and the ratification commit lands on top of
it. The single gate capture `review/verification-2026-09-10.md` is therefore
already a post-merge run and no re-measure is owed at landing.

NOTHING CONFLICTED AND NOTHING OF THIS PACKET'S IS TOUCHED. Main's two commits
move `.github/workflows/lane-line.yml`, `docs/opendox-cutover-runbook.md`,
`scripts/carve_lines.py`, `scripts/validate-carve-manifest.py`,
`scripts/verify-carve-arrival.py`, `tests/carve_arrival/` and
`tests/carve_manifest/` — no `README.md`, nothing under `openspec/`, nothing
under `scripts/doc_health/` and nothing under `tests/doc-health/`. So the
README `## OpenSpec Records` block had no conflict to resolve, the delta is
byte-unmoved, and the `doc-health` corpus this packet measures is unchanged by
the merge.

Refs #856, refs #860

Lane: openxfactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants