fix(@stdlib/_tools/repl-txt/rules/doctest): guard against null alias in replaceAliases#13472
Closed
Planeshifter wants to merge 1 commit into
Closed
fix(@stdlib/_tools/repl-txt/rules/doctest): guard against null alias in replaceAliases#13472Planeshifter wants to merge 1 commit into
alias in replaceAliases#13472Planeshifter wants to merge 1 commit into
Conversation
…` in `replaceAliases`
The job `Lint Changed Files` on workflow `lint_changed_files` failed on
develop with `TypeError: Cannot read properties of null (reading
'split')` in `replaceAliases`. Root cause: `pkg2alias()` returns `null`
when a referenced package is not yet indexed in the generated
`@stdlib/namespace` registry, which happens when a `repl.txt` file
references a sibling package added in the same commit, before the
`namespace_declarations` workflow regenerates the registry. The
unguarded call site called `.split('.')` directly on that `null`. This
commit falls back to `'ALIAS'` on a falsy return, mirroring the
identical guard already used earlier in the same file (`pkgName =
pkg2alias( pkg ) || 'ALIAS';`) and the resolvable-aliases rule's null
handling, so the lint job no longer crashes on newly added
cross-referencing sibling packages.
Ref: https://github.com/stdlib-js/stdlib/actions/runs/29314039197
kgryte
requested changes
Jul 14, 2026
kgryte
left a comment
Member
There was a problem hiding this comment.
Closing, as I am already working on a fix which is more general.
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 (e.g. two sibling packages added in the same commit).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 earlier in the same file atpkgName = pkg2alias( pkg ) || 'ALIAS';.Related Issues
None.
Questions
No.
Other
Failing run: https://github.com/stdlib-js/stdlib/actions/runs/29314039197 (job:
Lint Changed Files, step:Lint REPL help files)Symptom:
TypeError: Cannot read properties of null (reading 'split')atlib/node_modules/@stdlib/_tools/repl-txt/rules/doctest/lib/main.js:175.Root cause: unguarded call to
pkg2alias(), which returnsnullfor packages not yet present in the generated namespace registry.Checklist
AI Assistance
Yes
No
Code generation (e.g., when writing an implementation or fixing a bug)
Test/benchmark generation
Documentation (including examples)
Research and understanding
Disclosure
This PR was written by Claude Code as part of an automated CI-failure triage routine: identified the failing job from Actions logs, traced the root cause to the unguarded
pkg2alias()call, and validated the fix against the existing guard pattern in the same file. Reviewed by three independent passes (correctness, regression scope, style/conventions); all approved with no blocking findings.@stdlib-js/reviewers
Generated by Claude Code