Skip to content

feat: warn about namespace references that vendorPackage cannot rename - #75

Open
ehennestad wants to merge 2 commits into
mainfrom
warn-unrenamed-vendor-references
Open

ehennestad wants to merge 2 commits into
mainfrom
warn-unrenamed-vendor-references

Conversation

@ehennestad

Copy link
Copy Markdown
Owner

matbox.tasks.vendorPackage renames the source namespace only in .m files, and only where "." and a letter or "*" follow the name. Some references do not have that form and stay unchanged without notice:

  • namespace names that code builds at run time, such as "webprogress." + name, feval("webprogress." + m), meta.package.fromName("webprogress") or startsWith(class(obj), "webprogress.")
  • references in files other than .m files, such as .mlx, .mlapp and resources/functionSignatures.json

In the copy, such a reference resolves to the original namespace. It fails when that namespace is not installed, and runs another version of the code when it is.

Change

After renaming, the copied files are searched for the source namespace name as a whole word. The new function matbox.tasks.internal.findNamespaceReferences uses the same lookbehind as renameNamespaceInText, so renamed references, longer names and paths are not reported. If any places are found, vendorPackageFromFolder issues one warning, MatBox:VendorPackage:UnrenamedReferences, that lists them:

Warning: References to the namespace "webprogress" in "…/+mytoolbox/+external/+webprogress"
were not renamed to "mytoolbox.external.webprogress", so they still resolve to "webprogress".
Change them in the source repository, or check that they are not namespace references:
    createMonitor.m:2
    resources/functionSignatures.json:3
  • Text files are listed as path:line. Binary files (any file with a NUL byte) are listed by path only.
  • .mlx and .mlapp files are zip archives and are searched in the files they hold.
  • Error identifiers (the name followed by ":") and full-line comments in .m files are not reported. A comment cannot refer to a namespace at run time, and help text often names its package.
  • The search runs before the license file and vendorinfo.json are added, because both name the namespace without referring to it.
  • The warning is issued after the target folder is replaced, so it is only given for a copy that is in place.
  • There is no option to turn the warning off. It can be turned off by its identifier with warning.

The help text of vendorPackage describes the warning.

Limitations

  • A name in compressed binary data, such as a MAT-file saved in the default format, or in a .p file, is not found.
  • Prose mentions in trailing comments, %{ %} blocks and non-.m files are reported.

🤖 Generated with Claude Code

vendorPackage renames the source namespace only in .m files, and only
where "." and a letter or "*" follow the name. A namespace name built at
run time, such as "webprogress." + name or
meta.package.fromName("webprogress"), and every reference in another
file, such as an .mlx file or functionSignatures.json, was left
unchanged without notice. In the copy, such a reference resolves to the
original namespace: it fails when that namespace is not installed, and
runs another version of the code when it is.

After renaming, the copied files are now searched for the source
namespace name as a whole word, and the warning
MatBox:VendorPackage:UnrenamedReferences lists each place found: file
and line for text files, the file alone for binary files. .mlx and
.mlapp files are searched in the files their zip archive holds. Error
identifiers and comment lines of .m files are not reported, and the
license file and vendorinfo.json are added after the search.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

99 tests   99 ✅  35s ⏱️
 7 suites   0 💤
 1 files     0 ❌

Results for commit d86f788.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant