From ad4bf4d3c4229cb41667239f1d639fd9b52d36ca Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 14:18:24 +0000 Subject: [PATCH 1/4] build(package.json): guard `postinstall` when `tools/` is absent The weekly `test_published_package` workflow has failed every run since 2026-06-07 with `sh: 1: tools/scripts/apply_patches: not found` (exit 127). Root cause: commit fdbe637007 added a `postinstall` hook running `tools/scripts/apply_patches` to patch dev dependencies, but `.npmignore` has excluded `/tools/` from the published npm package since 2021. Any real `npm install` of `@stdlib/stdlib` therefore fails outright, since the referenced script never exists in the installed tree. This commit guards the hook so it silently no-ops when the script is absent, while preserving the original patch-application behavior for contributors who install from a git checkout. Ref: https://github.com/stdlib-js/stdlib/actions/runs/29173854732 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00fe02e17211..d8873454080b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "clean": "make clean", "check-deps": "make check-deps", "check-licenses": "make check-licenses", - "postinstall": "tools/scripts/apply_patches" + "postinstall": "test -f tools/scripts/apply_patches && tools/scripts/apply_patches || true" }, "homepage": "https://github.com/stdlib-js/stdlib", "repository": { From ddb4ab324d15908b6c1cb5e8bc2ed2dfd0ce00ed Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 14:18:33 +0000 Subject: [PATCH 2/4] fix(@stdlib/_tools/repl-txt/rules/doctest): snapshot captured values The job `Lint Changed Files` on workflow `lint_changed_files` failed on develop with spurious `doctest` errors against `stats/incr/nanmeanvar`'s `docs/repl.txt`, reporting the final example's return value as the "expected" value for every prior step in the chain. Root cause: accumulator-style packages (e.g. `stats/incr/meanvar`) intentionally mutate and return the same output array on every call; the rule captured `actual` values as live references into that shared array, so once the full example had executed, all captured references pointed to the same, already-mutated final state. This commit snapshots each captured value with `@stdlib/utils/copy` at capture time, so earlier steps in a REPL example chain are compared against the value they held when captured rather than the final accumulator state. Ref: https://github.com/stdlib-js/stdlib/actions/runs/29180627893 --- .../@stdlib/_tools/repl-txt/rules/doctest/lib/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js index 64b64e6151ee..5ce4773daa64 100644 --- a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js +++ b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js @@ -25,6 +25,7 @@ var dirname = require( 'path' ).dirname; var replace = require( '@stdlib/string/replace' ); var namespace = require( '@stdlib/namespace' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var copy = require( '@stdlib/utils/copy' ); var compareValues = require( '@stdlib/_tools/doctest/compare-values' ); @@ -135,9 +136,10 @@ function main( context ) { expected.push( current.output ); match = code.match( RE_ASSIGNMENT ); if ( match && match[ 1 ] ) { - actual.push( scope[ match[ 1 ] ] ); + // Snapshot the current value, as accumulator-style examples may return a shared, mutable reference (e.g., a stateful output array) that later statements overwrite in place: + actual.push( copy( scope[ match[ 1 ] ] ) ); } else { - actual.push( out ); + actual.push( copy( out ) ); } } } catch ( err ) { From 2879315443037a3e3b11bc65b876c2bd0256bd75 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 14:20:47 +0000 Subject: [PATCH 3/4] build(package.json): preserve `apply_patches` exit code in `postinstall` Follow-up to ad4bf4d3c per reviewer feedback: `A && B || true` silently swallowed a genuine failure of `apply_patches` itself, not just its absence, hiding real patch-application errors for contributors installing from a git checkout. Switch to a plain `if`/`fi` guard so a present-and-failing script still propagates its exit code, while an absent script (published npm install) still no-ops. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d8873454080b..8be468eb4ff8 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "clean": "make clean", "check-deps": "make check-deps", "check-licenses": "make check-licenses", - "postinstall": "test -f tools/scripts/apply_patches && tools/scripts/apply_patches || true" + "postinstall": "if test -f tools/scripts/apply_patches; then tools/scripts/apply_patches; fi" }, "homepage": "https://github.com/stdlib-js/stdlib", "repository": { From 64bc2bf3ab0cbd07fdc4b7f7906ba9da24ba2a65 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 14:20:52 +0000 Subject: [PATCH 4/4] style(@stdlib/_tools/repl-txt/rules/doctest): wrap long comment line Follow-up to ddb4ab324 per reviewer feedback: wrap the explanatory comment added for the `copy()` snapshot fix to stdlib's usual ~80 column width instead of a single long line. --- .../@stdlib/_tools/repl-txt/rules/doctest/lib/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js index 5ce4773daa64..4cadcb83661c 100644 --- a/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js +++ b/lib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js @@ -136,7 +136,9 @@ function main( context ) { expected.push( current.output ); match = code.match( RE_ASSIGNMENT ); if ( match && match[ 1 ] ) { - // Snapshot the current value, as accumulator-style examples may return a shared, mutable reference (e.g., a stateful output array) that later statements overwrite in place: + // Snapshot the value, as accumulator-style examples may return + // a shared, mutable reference (e.g., a stateful output array) + // that later statements overwrite in place: actual.push( copy( scope[ match[ 1 ] ] ) ); } else { actual.push( copy( out ) );