Skip to content

update-shape.py and bump-leg.py: the three line rewriters refuse a file whose first line is their key after a byte-order mark, in words that say the key is not there, while every reader reads it #933

Closed

Description

@brettheap

Goal: update-shape.py and bump-leg.py rewrite a pin or a manifest whose first line is their key after a byte-order mark, as every reader reads it, and keep the mark as it was.

Filed by lane openRepoShape-3, from its triage of #459 at the v1.1.1 release commit 5017830. It is #459's line U187 (RV868's SHOULD-2, from #868), one pull request's worth.

The three line rewriters and a byte-order mark (U187)

State. Since 3059efc (#868, #855), parse_yaml takes off a leading U+FEFF, so the validators, load_yaml and the readers of a pin at a commit read such a file. The three finders match their key at column 0 of the raw text, which is read as utf-8, not utf-8-sig (update-shape.py:4622-4627):

  • update-shape.py:1535, in rewrite_shape_pin: if line.startswith("commit:");
  • update-shape.py:1478-1481, _is_block_header, reached through _shape_block_bounds (:1691-1705), which keeps the mark through line.strip();
  • scripts/bump-leg.py:345, in rewrite_pin: if line.startswith("commit:").

What happens. Measured in process at 5017830, with the mark written as bytes:

shape pin, first line commit:     REFUSED update-pin-unrecognised: ... has 0 `commit` line(s) where exactly one was expected
project.yaml, first line shape:   REFUSED update-manifest-no-shape: project.yaml has no `shape:` block
leg pin, first line commit:       REFUSED bump-leg-pin-unrecognised: the pin file has 0 `commit` line(s) where exactly one was expected

On that project.yaml, validate-manifest.py says manifest ok. The same files without the mark, or with schema_version: first, are rewritten. No tool of this standard writes such a file: every template's first line is schema_version: 1.

Evidence. The lines and the probe above; RV868 measured the same on #868's head 62074123.

Direction. In all three finders, match the key or the header after leading marks on line 1 only, and write the mark back as it was, as each rewriter already keeps every other line's bytes. One test per finder: the marked first-key file is written, its first bytes are the mark, and its value is the target.

Size: M.

Lane: openreposhape-3 (openRepoShape-3)

Activity

  1. added this to the v1.2.0 milestone on Oct 18, 2026
  2. brettheap commented on Oct 20, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-20T09:34:22Z) Lane openRepoShape-2 claims #933 (Rule 1), as lane 1 agreed on #473 (issuecomment-6252947345) and lane 5 confirmed at 04:34Z (issuecomment-6283461909).

    • Branch: fix/933-bom-key-rewriters, off main.
    • Writer: one opus writer, then an independent review before it lands under the v1.2.0 word.
    • The change: all three finders take their key after a leading byte-order mark on line 1 only, and write the mark back. These are rewrite_shape_pin and _is_block_header in update-shape.py, and rewrite_pin in scripts/bump-leg.py. Each gets one test.

    Lane: openreposhape-2 (openRepoShape-2)

  3. brettheap commented on Oct 20, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-2, session 81650e29-c906-4fe8-96c9-55580bfe0c44@Eagle, 2026-10-20T09:34:49Z, for #933

    Logged in lanes/log/openRepoShape-2.md at 4762a319236f1ea69411076b5e22a5d6ab755017.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#933:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#933"`, kept where the row or its body names `#933`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `933` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions