Skip to content

fix(scripts): tree-scaled git listings in two gate scripts read past the 1 MiB default buffer - #39027

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-39025-gate-git-maxbuffer
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-39025-gate-git-maxbuffer

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #39025
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:用户无感;仓库的两个检查脚本读取文件清单时不再受 1 MiB 输出上限限制。
  • 为什么做:合并队列里任何新增文件的 PR(几乎都带 changeset)都会让检查崩溃、被踢出队列,这次替全车队解开。
  • 出错会怎样:只影响检查脚本自身,不发布、不改任何检查的结论,可直接撤回。
  • 要你做什么:无。

What changes

Two repo scripts read a git listing that grows with the tree into node's 1 MiB default stdout buffer (maxBuffer). Past it the child is killed with ENOBUFS and the gate dies instead of answering. Both now pass an explicit 64 MiB ceiling, the value and constant name scripts/pm/dispatch-gates.mjs already uses (GIT_MAX_BUFFER_BYTES). There is no shared git-buffer helper in the repo (scripts/git-env.mjs exports none), so each file declares its own constant. Importing the constant from dispatch-gates would make an ordinary gate depend on a governed file.

Site Listing Bytes at 444dce61f2 Fix
scripts/check-closed-ceremony-text.mjs trackedFiles() git ls-files -z -- packages content/docs .changeset 1,048,565 (11 under 1,048,576) maxBuffer: GIT_MAX_BUFFER_BYTES (64 MiB)
scripts/docs-audit/affected-docs.mjs sh() git ls-files packages (in --self-test, i.e. pnpm check:docs-audit-scope) 953,424 (91% of the default) maxBuffer: SH_MAX_BUFFER_BYTES (64 MiB) on the wrapper

sh() is one wrapper with several callers, so the ceiling goes on the wrapper itself. Its git show REF:FILE callers catch the throw, so a file over 1 MiB used to read as absent with no error. The constant sits in the file's hoisted-constants block, because a const beside sh() is in the temporal dead zone when --self-test runs.

Behaviour is otherwise unchanged. On this tree both listings already fit, so no verdict moves.

The sweep: every other git spawn under scripts/ with no maxBuffer

I found these with a scanner that reads each execFileSync / spawnSync / execSync / spawn of git to its closing parenthesis, so multi-line calls count. I then checked every wrapper (git(), run(), sh(), runGit()) that is called with ls-files, ls-tree -r, diff --name-only or grep. 29 direct execFileSync('git', ['ls-files'… sites exist; all the others already pass a ceiling of 16 MiB or more.

I left these alone, with the reason:

  • Fixture or temp-repo listings (self-test victims): git-env.mjs 322/344/350/369/372, check-nul-bytes.mjs:1067, check-system-context-census.mjs:2463, check-bash32-floor.mjs:1414, check-gitlink-declared.mjs:424, overlap-check.mjs:429, tenant-audit-census-replay.mjs:148.
  • Small, fixed-path listings, measured at 444dce61f2:
    • changeset-changelog.mjs:175 (*CHANGELOG.md): 5,078 bytes
    • pm/release-rehearsal-clone.mjs:144 (.changeset/*.md): 78,763 bytes
    • pm/check-prior-rulings.mjs:2179 (docs/adr/): 9,243 bytes
    • pm/write-pace.mjs:1822 (scripts/pm): 1,936 bytes
    • check-regen-pending.mjs:1558 (package.json): 13 bytes
    • git-merge-regen.mjs:1093: 0 bytes for each of the 6 declared-untracked paths
  • Diff-scaled, not tree-scaled: the output grows with one change set, not with the tree.
    • check-test-source-alias.mjs:4103-4104
    • checklist-select.mjs:542
    • pm/check-harness-current.mjs:124
    • pm/git-history.mjs:662
    • pm/overlap-check.mjs:148/160
    • gen-upgrade-harness-fixture.mjs:104

For scale: the whole-tree git ls-files -z is 1,902,552 bytes and ls-files --stage -z is 3,377,652 bytes. Every gate that reads either one already passes a ceiling of 64 MiB or more.

Tests

  • node scripts/check-closed-ceremony-text.mjs --self-test: 38 assertion(s) passed. The new cases stage 16,000 paths under packages/ into an index-only fixture repo (update-index --index-info, about 1.3 MB of listing). The CONTROL reads that listing at the default buffer and must die with ENOBUFS. trackedFiles() must then read every path, including the first and last, and the ceiling must stay finite and above the fixture.
  • node scripts/docs-audit/affected-docs.mjs --self-test: 607 cases pass. The new cases use a child that prints 2 MiB. The CONTROL is execSync at the default buffer and must answer ENOBUFS; sh() must then return all 2,097,152 bytes.
Ablation (maxBuffer removed on disk, then restored from HEAD)
check-closed-ceremony-text, the trackedFiles maxBuffer line deleted:
  ✗ trackedFiles reads the whole listing instead of dying with ENOBUFS
  ✗ …first and last path included
check-closed-ceremony-text --self-test: 2 of 38 assertion(s) FAILED.   exit 1

affected-docs, the sh() maxBuffer option deleted:
  ✗ self-test "sh() reads stdout past the 1 MiB default whole instead of dying with ENOBUFS": sh(2 MiB) → expected sh=2097152, got "ENOBUFS"
✗ affected-docs self-test failed (1 case(s)).   exit 1

Acceptance notes

  • Changeset: none. Neither file ships in any package's files[], and the root package is private. This PR carries skip-changeset, which is the convention check-empty-changeset.mjs names.
  • check-governed-merges --branch reports 0 of 2 paths governed, 95 changed lines: ordinary queue landing.
  • Not this card: the git show REF:FILE readers in affected-docs.mjs turn every failure into "absent", not only ENOBUFS. This PR does not change that shape; it only stops a large file from tripping it.

Verification

Local subset at 4b802eaf2b (dispatch-gates --commands, 36 families derived from this diff): 35 exit 0, 1 NOT MEASURED. --ran reconciliation: 36 derived, 35 run, 1 NOT-MEASURED, 0 UNRUN.

  • pnpm check:closed-ceremony-text: exit 0, 6622 shipped file(s) read; none says the ownership ceremony is closed.
  • pnpm check:docs-audit-scope: exit 0
  • pnpm check:nul-bytes: exit 0
  • pnpm check:entry-guard: exit 0
  • pnpm check:scripts-symbol-anchors: exit 0
  • node scripts/check-self-test-wired.mjs: exit 0
  • NOT MEASURED: pnpm check:pm-dispatch-gates, reason: it exited 124 when it hit the local 280 s per-command timeout on the shared container. It does not read either changed file, so CI owns the verdict.

Every other family, including the full Lint & Repo Gates farm, is CI's to run on this head.

Two-minute check: node scripts/check-closed-ceremony-text.mjs --self-test prints 38 assertion(s) passed. Delete the maxBuffer: GIT_MAX_BUFFER_BYTES, line and the same command prints 2 of 38 assertion(s) FAILED.


Generated by Claude Code

check-closed-ceremony-text read `git ls-files -z -- packages content/docs
.changeset` into node's 1 MiB default stdout buffer; the listing is
1,048,565 bytes on main, so one added path kills the gate with ENOBUFS.
Spawn it with the 64 MiB ceiling dispatch-gates already uses, and pin a
fixture index past 1 MiB in --self-test with an ENOBUFS control.

affected-docs' sh() wrapper had the same default; its self-test's
`git ls-files packages` is 953,424 bytes, and its `git show` readers
caught ENOBUFS as "file absent". Same ceiling, same pin shape.

Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Dec 2, 2026
@github-actions github-actions Bot added the size/s label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 444dce61f2fa4889b57d080f2fec2c6123490e0d → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

L1 ACCEPT · PR #39027 (#39025) · head 4b802eaf2b60fe9998167ce2d96ce3398ca899a8 · read 2026-12-02T04:22Z

席位核对 · ACCEPT

ACCEPT · repo:objectstack@os-justin · head 4b802eaf2b60fe9998167ce2d96ce3398ca899a8

  1. Shape. Draft, base main, Fixes #39025 first; branch matches the claim (7334081710). Two scripts; skip-changeset (tooling only).
  2. Premise measured. check-closed-ceremony-text.mjs read a 1,048,565-byte git ls-files listing into Node's 1 MiB default buffer; PR fix(lint): say when an unconditional out-edge beside guarded ones runs #39020's and PR fix(automation): a branch whose subflow or map child parks, where the run cannot park, fails the run instead of dropping work #39030's checks died with spawnSync git ENOBUFS. Seat's own reading of the diff (+90/−5): trackedFiles() passes maxBuffer: GIT_MAX_BUFFER_BYTES (64 MiB, the same name and value as the dispatch-gates precedent of tooling(pm): dispatch-gates git maxBuffer for the merged tree; register matchers proven on the nested ui/ rows (4b PR 1, inert) #25732; not imported from the governed dispatch-gates.mjs on purpose); scripts/docs-audit/affected-docs.mjs's sh() (a 953,424-byte git ls-files packages in its self-test, and git show readers that mapped ENOBUFS to "absent") gets the same ceiling. The other 19 git spawns under scripts/ were measured and left (fixture repos, fixed small listings — largest 78,763 bytes — or diff-scaled), each named in the body.
  3. Gates (check-runs at this head). 27 success · 27 expected skip · 0 failed; Lint & Repo Gates (incl. Lint · repo & tooling gates, which runs check:closed-ceremony-text) and TypeScript Type Check success. Self-tests: 38 assertions (a ~1.3 MB index-only fixture; the CONTROL at the default buffer gets ENOBUFS) and 607 cases (2 MiB child output); ablation (maxBuffer removed) reds both. L2: none owed (tooling scripts, not governed) — the seat's own review, PASS.
  4. Accepted deviations. None.
  5. Out of scope. affected-docs.mjs's git show readers map every failure, not only ENOBUFS, to "absent" — this PR removes only the size trigger; recorded in the PR's Acceptance notes, not filed.
  6. Landing. Not governed (check-governed-merges --pr 39027: 0 of 2 paths, +90/−5); no narrowing. git merge-tree against current main clean. Ready + auto-merge now; it unblocks every PR that adds a path, including this seat's fix(lint): say when an unconditional out-edge beside guarded ones runs #39020 and fix(automation): a branch whose subflow or map child parks, where the run cannot park, fails the run instead of dropping work #39030.

Clause-②: no · Metadata-protocol: none

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 04:23
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit c748e7d Dec 2, 2026
55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39025-gate-git-maxbuffer branch December 2, 2026 04:44
os-support-ai pushed a commit that referenced this pull request Dec 2, 2026
…nout-judge

Brings in the ENOBUFS fix for check:closed-ceremony-text (#39027).

Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

2 participants