Skip to content

merge queue: merged #70: lane-worktrees report never blocks on a FIFO or aborts on a NUL path - #86

Closed
mergify[bot] wants to merge 6 commits into
mainfrom
mergify/merge-queue/b2cc442f88
Closed

mergify[bot] wants to merge 6 commits into
mainfrom
mergify/merge-queue/b2cc442f88

Conversation

@mergify

@mergify mergify Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Note

This is a merge queue draft opened by Mergify. Its pull request has merged, and nobody needs to act on it.
Mergify opened it for batch wise-thym-e8747d of the openrepotools-code queue, to test #70 before it merged into main.

🎉 What landed

Mergify merged its pull request into main, then closed this draft:

  • #70 lane-worktrees report never blocks on a FIFO or aborts on a NUL path (brettheap), as c9c65cc

This draft's code was built in this order:

  1. main at 4967100
  2. #70, the pull request of this batch
Metadata for CI tooling, read by mergify ci
---
all_scopes: false
checking_base_sha: 496710053e287d8771fa41be02375dd5bceb0f68
previous_check_retries: []
previous_failed_batches: []
pull_requests:
  - number: 70
    scopes: []
scopes: []
...
Required conditions of queue rule openrepotools-code for merge
Required conditions to stay in the queue

brettheap and others added 6 commits November 12, 2026 14:39
…ecause a plain open() of a FIFO held two daily reports in wait_for_partner for most of a day

Two `sweep --all --dry-run --report` runs that lane-start detached, from
2026-11-11T21:27Z and 2026-11-12T01:32Z, sat in `wait_for_partner` - the
kernel holding an open() of a FIFO until its other end opens - with no
child and no regular file open, so nothing timed them out. Every file the
report opens itself was a plain open(): sweep.conf, a `.git` pointer,
`commondir`, a git config, `alternates`, a lane's snapshot and inventory
records, a sandbox's `.lock` and run marker, an archive's MANIFEST.sha256,
the workspace's `.gitignore` and the `--post` target. On a scratch estate a
FIFO at each one of them held the report there until `timeout` ended it.

`open_regular` refuses what `stat` says is a FIFO, a socket or a device
before any open, and opens the rest O_NONBLOCK and asks `fstat` again, so
one swapped in between cannot hold it either. The refusal is an OSError,
which each of those readers already takes as a read that failed and never
as a file that is absent, and every path refused is a row of "Records the
report could not read". A directory, or a path `stat` cannot answer, still
goes to open() and fails exactly as before. A `--post` target that is a
FIFO is the documented exit 1, with the report printed.

Test: tests/test_lane_worktrees_report.py::test_a_fifo_where_the_report_reads_a_file_is_skipped_and_named_never_waited_on
- passed by a direct `python3 -m pytest <node id>` (1 passed).

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s a NUL-byte path as unreadable, because past its FIFOs the real estate's first such `.git` made the whole report an INTERNAL ERROR, exit 2, with no report

With the FIFOs skipped (af9bcd4), a read-only replay of the report's walk and
pointer reads over the real estate went on to repository #37875 of 60,968,
whose `.git` reads `gitdir: ../m<NUL>x`, and stopped there with "ValueError:
embedded null byte" - the OS refuses a path holding a NUL with a ValueError,
not an OSError, so no reader caught it, and `main` turns it into "INTERNAL
ERROR, nothing was changed". The replay met 20 such records: `gitdir:` lines
and `commondir` files, test fixtures left in the estate.

Each place in the report's path where a path read out of a file meets the OS
now takes that ValueError as a record it could not read, named by
`_nul_record` in SKIPPED (a row of "Records the report could not read") and
in `unread` where one is kept, so a leaning it may hide is unknown, never
none:

- `git_common_dir`: a `gitdir:` line naming such a path is no pointer, and
  unreadable;
- `dependents_map`: such a path in `commondir`, in an alternates line or in a
  remote's URL leaves the repository's leaning unknown;
- `archive_ledger`: a rescues.tsv row holding a NUL is not origin, branch,
  sha, so the archive is kept, as any malformed row keeps it;
- `Report._record`: an inventory record whose path holds a NUL is a record
  not read, where `os.path.isdir`'s False read as a tree that is gone.

And the workspace hygiene row: a `.gitignore` that is not a regular file is
said to be one, and no `printf ... >> .gitignore` is offered, which onto a
FIFO would hang whoever pasted it.

The replay over the real estate, run again with this code, completed:
60,984 repositories, 6 FIFOs and 20 NUL-byte records skipped, no exception.

Tests, run by node id with a direct `python3 -m pytest`:
- tests/test_lane_worktrees_report.py::test_a_git_pointer_naming_a_nul_byte_path_is_unreadable_never_an_internal_error
  (new): passed.
- tests/test_lane_worktrees_report.py::test_a_fifo_where_the_report_reads_a_file_is_skipped_and_named_never_waited_on
  (now also holds the `.gitignore` row): passed.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…resh its base for the code queue

Code main's tip is a15a6b5 (#74). The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299 at code 908d815, unchanged at a15a6b5). The merge is clean, and the pull request's own diff against main is unchanged: its patch-id is 956b970ef978932a6da4c0bde2008150de942894 before and after.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nswer, manifest row, recorded dir or lane log holding a NUL byte, because one such workspace-root answer still ended it INTERNAL ERROR, exit 2

The review of #70 at 62fe17f found one BLOCKING
finding, one SHOULD and one NIT. Each is fixed here. Line numbers are this
commit's unless they say "at 62fe17f".

BLOCKING (lane-worktrees:5632 at 62fe17f). `lanes-edit.sh workspace-root`'s
answer went unchecked to `real()` and `git -C`. The OS refuses a path holding
a NUL with a ValueError, not an OSError, so no reader caught it, and the
report ended "INTERNAL ERROR", exit 2. On 62fe17f the first to raise is
`register_lane_dirs`' `git -C`, before line 5632. `Helper.workspace_root`
(lane-worktrees:707-724) now asks the helper once and checks the answer before
any caller makes a path of it. An answer holding a NUL is dropped, the root
is '' (the workspace not found, which every caller already reads), and
`_nul_record` names it in "Records the report could not read". `_foreign`,
`_closed_lanes`, `_workspace_hygiene`, `register_lane_dirs`,
`MergeEvidence.landed` and `fetch_register` all read that one checked root.

The rest of the report's path, searched for any other value from outside
that can reach a path operation holding a NUL:
- `project_legs` (2139-2144): a NUL in the helper's answer makes the manifest
  one not read. Before, `Leg`'s `real()` raised it to INTERNAL ERROR.
- `archive_ledger` (5283-5286): a NUL in a MANIFEST.sha256 row keeps the
  archive, with a reason. Before, the row was printed with its raw NUL.
- `Report._recorded_parents` (5466-5472): a lane's recorded `dir` holding a
  NUL is named. Before, it was dropped in silence.
- `Report._closed_lanes` (5744-5752): a lane log git grep reads as binary is
  named. Before, its ENDED line was missed in silence.
The `gitdir:`, `commondir`, alternates, remote-URL, rescues.tsv and inventory
path cases were already handled at 62fe17f (f12e8d4).

NIT (lane-worktrees:382). "skipped, never opened" is false for a FIFO swapped
in after the stat, which is opened O_NONBLOCK for its `fstat` alone. The row
now says "skipped, never read"; `open_regular`'s docstring (399-412) and the
existing FIFO test's assertion (tests/test_lane_worktrees_report.py:805)
match it.

SHOULD (tests/test_lane_worktrees_report.py:751 at 62fe17f). New tests, from
tests/test_lane_worktrees_report.py:850:
- the race: a hook (REPORT_SEAM) on `open_regular`'s own `os.stat` call swaps
  a FIFO in after the stat. It is deterministic, with no timing loop;
- a socket, a link to /dev/null, a link to a block device (skipped, named,
  where the host has none) and a FIFO held open with bytes in it, each at
  four files the report reads; the FIFO's bytes must survive unread;
- `open_regular` against plain `open` for every read mode and path kind the
  report meets, and `--post`'s write;
- the whole report over regular files against one where every
  `open_regular` is given back the plain `open()`;
- a workspace root holding a NUL, asked once;
- eight NUL-bearing record sources, one at a time.

Verification, every run through tests/run.sh:
- 62fe17f, -k 'lane_worktrees or repo_hygiene': 382 passed, 18 skipped,
  5020 deselected
- this commit, same selector: 397 passed, 19 skipped, 5020 deselected; the
  16 new items are the +15 passed and the +1 skip (no block device on the
  host)
- the new tests on 62fe17f's code: 10 failed, 6 passed, 1 skipped. The 10 are
  the socket, character-device and FIFO-with-data cases, the race, the
  workspace root, the project-legs, manifest-row, register-dir and
  register-binary-log cases, and the existing FIFO test on its new wording.
  The 6 that pass are the two parity tests and the four NUL cases 62fe17f
  already handled; the skip is the block device
- ten mutants of this commit, each removing one guard, in three runs: all
  ten killed, none survived. Batch A: M1 (no O_NONBLOCK) by the race test,
  which timed out in the open(); M3 (no socket check) and M4 (no
  character-device check) by their own cases; M6 (no NUL catch on the
  alternates read) by the alternates case and by the existing git-pointer
  test, whose commondir NUL meets that read first; M7 (remote URL), M8
  (inventory path) and M9 (rescues.tsv row) by their own cases. Batch B: M2
  (no fstat check) by the race test, which found no row; M5 (descriptor left
  non-blocking) by the open_regular parity test. Batch C: C1 (every text
  read forced to surrogateescape) by both parity tests

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…resh its base for the code queue

Code main's tip is c62ba9c, the merge of #69 at 2026-11-14T17:17:27Z. The code queue's check needs the pull request's base to be main's tip and main to be an ancestor of its head (.github/ci/delivery_verify.py:296 and :299, the same blob at code eff8459 and c62ba9c). The merge is clean: the 13 files main changed since a15a6b5 do not include lane-worktrees or tests/test_lane_worktrees_report.py, so the pull request's change is unchanged from 7d2b3ee.

Lane: openRepoTools-3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Update the estate report’s file-reading and path-handling logic so special files and NUL-bearing paths are reported as unreadable rather than blocking or causing an internal error.

  • lane-worktrees L367-438, L707-724, L1397-1410 (+24 small edits)

Tests

Add regression and parity tests for special files, races, NUL-bearing records, workspace roots, and regular-file behavior.

  • tests/test_lane_worktrees_report.py L28-33, L750-1298

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

@sonarqubecloud

Copy link
Copy Markdown

@mergify mergify Bot changed the title merge queue: checking #70 on main (4967100) merge queue: merged #70: lane-worktrees report never blocks on a FIFO or aborts on a NUL path Nov 15, 2026
@mergify mergify Bot closed this Nov 15, 2026
@mergify
mergify Bot deleted the mergify/merge-queue/b2cc442f88 branch November 15, 2026 01:32
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.

1 participant