fix(@stdlib/_tools/repl-txt/rules/doctest): guard against null alias in replaceAliases#13488
Draft
Planeshifter wants to merge 1 commit into
Draft
fix(@stdlib/_tools/repl-txt/rules/doctest): guard against null alias in replaceAliases#13488Planeshifter wants to merge 1 commit into
alias in replaceAliases#13488Planeshifter wants to merge 1 commit into
Conversation
…` in `replaceAliases`
The `lint_changed_files` workflow failed repeatedly on `develop` with
`TypeError: Cannot read properties of null (reading 'split')` at
`replaceAliases` in `lib/main.js:175`. Root cause: `pkg2alias()`
returns `null` when a `docs/repl.txt` file references a sibling
package (via `{{alias:pkg}}`) not yet present in the generated
`@stdlib/namespace` registry; `replaceAliases` called `.split('.')`
on that result unguarded. This commit falls back to the literal
`'ALIAS'` on a falsy return, mirroring the identical guard already
used a few lines above in the same file at
`pkgName = pkg2alias( pkg ) || 'ALIAS';`.
Ref: https://github.com/stdlib-js/stdlib/actions/runs/29372187787
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:
replaceAliases()in@stdlib/_tools/repl-txt/rules/doctest, which crashed thelint_changed_filesjob withTypeError: Cannot read properties of null (reading 'split')whenever adocs/repl.txtfile references a sibling package via{{alias:pkg}}before that package is indexed in the generated@stdlib/namespaceregistry.pkg2alias()returnsnullin that case; the call site called.split('.')on it directly. Falls back to'ALIAS'on a falsy return, matching the identical guard already used a few lines above in the same file atpkgName = pkg2alias( pkg ) || 'ALIAS';.Related Issues
This pull request has the following related issues:
Questions
No.
Other
Failing run: https://github.com/stdlib-js/stdlib/actions/runs/29372187787 (job:
Lint Changed Files, step:Lint REPL help files). Recurred 4 times ondevelopwithin a 20-minute window on 2026-07-14, on 4 different commits touching different packages'docs/repl.txt.Root cause: unguarded call to
pkg2alias(), which returnsnullfor packages not yet present in the generated namespace registry.Note: a prior PR (#13472) proposed this identical one-line fix but was auto-closed on 2026-07-14 without being merged (no review comments; appears to be stale-PR cleanup, not a rejection). The bug was confirmed still present in
developsource before opening this PR.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code as part of an automated CI-failure triage routine, based on live GitHub Actions job log analysis. The fix was reviewed by three independent automated review passes (correctness, regression scope, style/conventions) before being proposed here; all approved with no blocking findings.
@stdlib-js/reviewers
Generated by Claude Code