GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Route inline BOM strips through formats::text (#905) by mikolalysenko · Pull Request #1117 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Refs #905 (step 3, slice 1). The issue stays open for the inline sites in files that open PRs change.

Summary

This PR moves ten production sites that each spelled out "drop one leading UTF-8 BOM" onto formats::text. It adds a guard test that fails when a new production file spells out its own BOM handling.

Why

  • #905 step 3, register row E64 (living document Part 4, "CRLF/BOM/indent policy"). #909 added formats::text::{split_bom, strip_bom}, but about 50 inline strips remained, some with drifted counts (trim_start_matches strips any number of BOMs). #1057 added two more while this PR was open, which the guard caught.
  • Leverage: B 0, U 0, D ≈ 10 (inline copies collapsed, plus a guard against new ones), S 0, R L. It is the top-scoring candidate that lies entirely in files no open PR changes.

What changed

  • formats::text:
    • New strip_bom_bytes, for the byte decoders.
    • split_bom now returns its BOM half as &'static str. It is always "" or U+FEFF, so callers can store it.
  • Re-pointed to the helpers:
    • patch/redirect/requirements.rs: 4 sites.
    • utils/requirements.rs: 2 sites.
    • manifest/operations.rs
    • hosted/npm_manifest.rs
    • gradle/dsl.rs: decode and the lexer's start offset.
    • policy/socket_yml.rs: decode.
    • formats/yarn/blocks.rs and formats/yarn/stanzas.rs (both from Move all yarn.lock parsing into formats/yarn and stop pinning non-registry copies #1057).
    • The CLI's scan/hosted/python.rs: Pipfile.lock for the stale-install remedy.
  • production_bom_handling_goes_through_the_helpers guard:
    • It scans production code (test modules and test-support files are exempt).
    • PENDING_INLINE_BOMS lists the 26 files still changed by open PRs.
    • OWN_BOM_RULE lists 2 deliberate exceptions, each with a reason: sbt_version skips a BOM on any properties line, which its test pins, and the vlt sniff refuses a BOM lock because vlt can't read one.
    • The guard is one-sided: a pending file that loses its last inline BOM doesn't fail it.
  • Ported from #1118: the ci.yml setup-php pin comment # v2 → # 2.37.2. The Audit GitHub Actions check (zizmor ref-version-mismatch) fails without it, and it no-ops once Label the setup-php pin in ci.yml with its real tag #1118 lands.
  • Merged main (b96a785).

What was deleted

  • Production: about +25 / −40, net ≈ −15. The removals are inline strip_prefix('\u{feff}')/starts_with copies and the hand-built bom selectors in the hosted requirements rewriter and the yarn stanza splitter.
  • Tests: about +147: the guard, the strip_bom_bytes cases, and one-vs-two-BOM coverage for the hosted npm manifest decoder.

Behavior

None for zero or one leading BOM. The one exact change: the hosted Pipenv stale-install remedy read a Pipfile.lock with two leading BOMs as JSON, because it used trim_start_matches. It now treats the second BOM as content, as every other reader does and as #905 requires.

Test evidence

  • CI on f810607: all checks green (192 passed, 8 skipped).
    • test-release first failed in api_retry_e2e::a_refused_connection_is_not_retried, a port-reuse race in that test that this PR doesn't touch. It passed on its one re-run. See the PR comments.
  • cargo clippy --workspace --all-features -- -D warnings: clean, after the merge.
  • cargo test -p socket-patch-core --lib: 5742 passed, 4 failed. The failures are the known root-only tests that also fail on main in this sandbox: copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouched and pypi_requirements::wire_failure_rolls_back_already_written_files.
  • cargo test -p socket-patch-cli --all-features --lib: 875 passed.
  • --test in_process_redirect_pipenv, policy_pypi_names, scan_requirements_lock_only, scan_vendor_requirements_unwired and e2e_socket_yml_policy: all pass.
  • The guard works in CI. On the merge with main it caught formats/yarn/{blocks,stanzas}.rs, which are now migrated. Locally, removing a pending entry fails it as expected.
  • Every former caller keeps its existing BOM test: the requirements lexers, gradle::dsl::bom_is_skipped, the manifest reader's BOM and double-BOM tests, the socket.yml BOM bytes test, and the yarn BOM round-trips. The new reads_past_one_bom_only covers the hosted npm decoder.

Risk

Low. The change is mechanical, apart from the double-BOM Pipfile.lock case above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PQTx5YVAZtPf1S2S5HYdQs


Note

Low Risk
Mostly mechanical refactors plus a guard test; the only intentional behavior change is double-BOM Pipfile.lock parsing in the hosted Python stale-install path.

Overview
Centralizes UTF-8 BOM handling in formats::text (#905 step 3): adds strip_bom_bytes, makes split_bom return a 'static BOM prefix for callers that store it, and replaces inline BOM strips across requirements/manifest/Gradle/policy/yarn/npm hosted paths and the CLI Pipenv stale-install scan with strip_bom / split_bom / strip_bom_bytes.

Adds production_bom_handling_goes_through_the_helpers, which fails CI if new production code spells out BOM bytes/literals instead of the helpers (with allowlists for files still migrating in other PRs and two deliberate exceptions).

Behavior: unchanged for zero or one leading BOM. Pipfile.lock parsing no longer uses trim_start_matches, so a second leading BOM is treated as content and JSON parse fails, matching other readers.

Also updates the setup-php pin comment in ci.yml (# v2 → # 2.37.2) for the zizmor ref-version check.

Reviewed by Cursor Bugbot for commit f810607. Configure here.


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start refactor for #905
1b3f1a1
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) added refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code arch-refactor PR opened by the scheduled architecture refactor routine labels Oct 8, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 8, 2026
Consolidate remaining BOM stripping after the pnpm reader failures were fixed #905
Open
5 tasks
@claude
Route inline BOM strips through formats::text
d261e2a
Eight production sites decided for themselves what a leading UTF-8
BOM is: the hosted and shared requirements lexers, the manifest
reader, the hosted npm manifest decoder, the Gradle DSL decoder and
lexer, the socket.yml decoder and the hosted Pipenv remedy. They now
call formats::text::{split_bom, strip_bom} and a new strip_bom_bytes
for the two byte decoders, so the rule lives in one place.

A guard test fails when a new production file spells out its own BOM
handling. Files still changed by open PRs sit on a pending list.

User impact: none, except that the hosted Pipenv stale-install remedy
now reads a Pipfile.lock with two leading BOMs as unparseable (one
BOM is encoding, the second is content), like every other reader.

Refs #905

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 8, 2026 08:14
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Oct 8, 2026
@claude
refactor: run 2026-10-08T08:15Z (#1117)
dbcc272
Assisted-by: Claude Code:claude-opus-5-5
@claude
Label the setup-php pin with its real tag
592de6b
The Audit GitHub Actions check (zizmor ref-version-mismatch) fails
because the ci.yml pin's comment says v2 while the pinned commit is
tagged 2.37.2. Same one-line change as #1118; it no-ops once that
lands.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

[agent] The Audit GitHub Actions check failed, and the cause isn't this PR. zizmor's ref-version-mismatch flags .github/workflows/ci.yml:1400: the setup-php pin f3e473d… is commented # v2, but that commit is tagged 2.37.2. This PR's diff doesn't touch that line.

I ported the one-line fix from #1118 as 592de6b. It no-ops once #1118 lands.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 8, 2026
View reviewed changes

@cursor cursor Bot left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Claude (claude) added 2 commits October 8, 2026 08:33
@claude
Merge remote-tracking branch 'origin/main' into arch-refactor/905-bom…
41c332c
…-sites
@claude
Route yarn block and stanza BOMs through split_bom
f810607
#1057 added formats/yarn/blocks.rs and stanzas.rs with their own
leading-BOM splits, which the new guard rejects once main is merged.
Both now call formats::text::split_bom, whose BOM half is now
&'static str (it is always "" or U+FEFF) so callers can store it.

No behavior change.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 8, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f810607. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

[agent] test-release failed on f810607 in api_retry_e2e::a_refused_connection_is_not_retried, and the cause isn't this PR.

The test binds 127.0.0.1:0, drops the listener and expects a refused connection. In this run, another mock server in the same test binary picked up the freed port and answered with a retry-pkg-071 search result, so the call succeeded. That's a port-reuse race in the test itself. This PR doesn't touch api/, the retry code or that test, and every other check that ran the same suite passed.

No fix exists yet. A robust version would keep the listener bound and immediately close each accepted connection, or use a reserved unroutable address. That belongs in a separate PR, so I'm not widening this one. I'll re-run the failed job once when the run completes.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 8, 2026
Vendored Pipenv re-serializes the whole Pipfile.lock, so a non-ASCII lock is rewritten throughout and its revert is not byte-identical #1128
Closed
5 tasks
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 8, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review (burn-down agent).

  • Head: f810607aa7085e640b05bc8b003489ccb730aca5
  • CI: 454/454 check runs green (success/skipped/neutral) on this head, mergeable, no conflicts.
  • Bugbot: reviewed this head (Cursor Bugbot check: success), no unresolved review threads.
  • Changelog: untouched.

Nothing specific flagged for the reviewer beyond the PR description.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 8, 2026
View reviewed changes
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit d13657b Oct 8, 2026
636 of 638 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the arch-refactor/905-bom-sites branch October 8, 2026 16:59
Mikola Lysenko (mikolalysenko) pushed a commit that referenced this pull request Oct 8, 2026
@claude
refactor: record #1106/#1110/#1117, open #1153
e40e6b1
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 8, 2026
Move BOM handling in 11 more files onto formats::text (#905) #1160
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

arch-refactor PR opened by the scheduled architecture refactor routine Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review refactor Structural change: duplicated code or logic, missing abstraction, layering, dead code

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Tanmay182003 @claude
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.