fix(@stdlib/_tools): disambiguate path in changelog/parse-commits git log - #13891
Draft
Planeshifter wants to merge 1 commit into
Draft
fix(@stdlib/_tools): disambiguate path in changelog/parse-commits git log#13891Planeshifter wants to merge 1 commit into
changelog/parse-commits git log#13891Planeshifter wants to merge 1 commit into
Conversation
…git log` The `standalone_push_changes` workflow crashed publishing a batch of 19 packages: `git log ... "$dir"` in `commits.sh` was invoked without a `--` pathspec separator. When `$dir` no longer exists in the working tree (e.g. a package deleted from the monorepo in an earlier commit), `git log` fails hard with "ambiguous argument ... unknown revision or path not in the working tree", exiting non-zero with no stdout. The Node.js caller discards stderr and never checks the exit code, so this silently returns zero commits, which then throws `Unable to parse commits for package` uncaught, crashing the whole publish batch instead of just the affected package. This commit adds `--` before the path argument so `git log` always treats it as a pathspec rather than attempting to also resolve it as a revision, matching standard Git usage. Verified this returns the deleted package's history correctly while producing byte-identical output for existing package directories (including the root `lib/node_modules/@stdlib` case) and the "unresolvable directory" test case. Ref: https://github.com/stdlib-js/stdlib/actions/runs/30804159359
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This pull request:
git logpathspec-disambiguation bug in@stdlib/_tools/changelog/parse-commitsthat crashed thestandalone_push_changesCI workflow.Failing run: https://github.com/stdlib-js/stdlib/actions/runs/30804159359 (workflow
standalone_push_changes, job "Push changes", develop commitb7a8f64e).Symptom:
An uncaught throw with no surrounding
try/catch, so the entire Node.js process exited and all 19 packages in the batch failed to publish, not just the one package.Root cause:
ml/base/sgd-classification/learning-rate-enum2strwas created and then deleted from the monorepo in an earlier commit.lib/node_modules/@stdlib/_tools/changelog/parse-commits/scripts/commits.shrunsgit log ... "$dir"without a--pathspec separator. When$dirno longer exists in the working tree,git logfails hard (fatal: ambiguous argument ... unknown revision or path not in the working tree) instead of returning the directory's commit history. The Node.js wrapper (commits.js) discards stderr and never checks the exit code, so this silently returns zero commits, which then throwsUnable to parse commits for packageuncaught.Fix: Add
--before the path argument in thegit loginvocation, so it is always treated as a pathspec, never as a revision. One-line change, single file.Related Issues
This pull request has the following related issues:
Questions
No.
Other
Validation:
git logwithout--against the deleted package directory fails with the documented "ambiguous argument" error (exit 128, empty stdout); with--it correctly returns the package's 2 historical commits.--for existing package directories, including the rootlib/node_modules/@stdlibchangelog case, and for the "unresolvable directory" test case (dir: 'beepboop'inparse-commits/test/test.js), which still returns an empty array.tapetest suite in this environment (nonode_modulesinstalled / no network fornpm install); relied on directgit/bashreproduction of both the failing and fixed behavior, plus three independent reviewer passes (correctness, regression scope, style/conventions) — all three approved.Reviewer notes:
publish_packages.jsstill has notry/catcharoundgenerateChangelog(), and downstream steps (e.g.rsyncfrom a non-existent source directory) could still fail for a deleted package. A maintainer may want a follow-up to either skip already-deleted packages earlier in the pipeline, or hardenpublish()with a try/catch per package so one failure doesn't abort the whole batch. Left out of this PR to keep the fix minimal and scoped to the one root cause.commits.jsalso silently swallows the spawned script's exit code (masking failures like this one). Fixing that more foundational gap is a separate, larger change and was intentionally left out of scope here.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was investigated, written, and validated by an automated Claude Code CI-triage routine, in response to a nightly CI failure. Root cause was identified and independently reproduced against the actual repository history; the fix was reviewed by three independent Claude Code review passes (correctness, regression scope, style) before being opened here.
@stdlib-js/reviewers
Generated by Claude Code