Skip to content

scripts/pm/git-history.mjs: log loses output when stdout is a pipe — … | wc -l reads 346 lines where a file redirect holds 5,455 (process.exit before the pipe drains) #21659

Description

@objectstack-fleet

Filing gate: ① a reproducible defect, class (a), in the PM tooling.

Mechanism (a hypothesis for the claim to measure)

  • main() hands the whole answer to one process.stdout.write(out) and the entry then calls process.exit(main(...)). When stdout is a pipe, Node's write is asynchronous and process.exit tears the process down before the pipe has taken more than its buffer (346 lines is about one 64 KiB pipe buffer); when stdout is a file the write is synchronous and complete. count and touch print one line and are unaffected.

Direction (for triage, not a ruling)

  • Make the answer complete on every stdout kind: write synchronously (fs.writeSync on fd 1), or set process.exitCode and return instead of calling process.exit after the write. Pin it in the tool's own self-test: run log with stdout piped through a slow reader and compare the line count with the file-redirect count on the same fixture; the existing log cases keep passing.
  • Rides along (same neighbourhood, noted by the same dev): on a ref that names no remote (a bare sha), ensureWindowCovered() returns without its boundaries, so a refusal prints shallow floor: unknown although the floor was read; the refusal itself is correct.
  • Suggested grade, for triage to confirm: bug · priority:p2 · domain:skills · area:devpath (NORTH-STAR 优先级 2: the instrument runs but answers wrong, at exit 0, on a natural spelling). Path: scripts/pm/git-history.mjs. Fold-or-serial with scripts/pm/git-history.mjs: a bare-date --since is passed to git verbatim and read at the current time of day, so the tool answers a narrower window than its receipt names, at exit 0 #21601: SERIAL (a different defect form).

Dedupe

REST list of the 300 most recently updated issues and PRs (open and closed, back to 2026-10-02T16:05Z), grepped: git-history 6 hits (#21601, PR #21657, three seat posts, PR #21600); git-history together with pipe / stdout / truncat / process.exit / wc -l: 1 hit, PR #21657 (the report that measured it). Control shallow: 26 hits. No card carries this defect. Dedupe words: git-history log pipe truncated · git-history stdout process.exit · git-history wc -l short answer.

Activity

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

    area:devpathThe road — create, dev, verify, publish/install, connect an agent, iteratebugSomething isn't workingdomain:skillspriority:p2Medium: important, M3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions