Repository navigation
JS --related follows export { a as b } from and namespace re-exports to their importers - #317
Open
calvin-archastro wants to merge 1 commit into
Open
calvin-archastro wants to merge 1 commit into
calvin-archastro wants to merge 1 commit into
Conversation
Contributor
Author
|
ArchDev is watching this pull request. State: watching (cycle 2 of 2 for head 3a9aa51).
Paused by the |
…re-exports to their importers
calvin-archastro
force-pushed
the
factory/tsk_1aGmlpT2Nh8HncWI0LFfUl-dc89170e-1699-4d3c-8b46-
branch
from
November 1, 2026 16:50
8dfed37 to
3a9aa51
Compare
This branch has not been deployed
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.
Review on ArchCode
Epic: Aster bug bash fixes
Task: JS --related follows
export { a as b } fromand namespace re-exports to their importersProblem and author intent
--relatedmissed JS/TS importers that reached a changed export only through a renaming source re-export or a re-exported namespace. Reported against aster 0.30.1 (GitHub issue 240): withexport { orig as renamed } from "./orig.js",import * as o from "./orig.js"; export { o }, and a direct importer, editingorigplanned onlytest/direct.test.js. Without that direct test, the rename barrel was selected and the namespace barrel still was not.export { default as X } fromfailed the same way. Same-nameexport { orig } from,export * as oo from, andimport { orig }; export { orig as renamed2 }already worked.Before,
Walker::exporttreated an export with a module source as a unit edge only (reexports) and dropped specifier names and aliases. Symbol matching is by imported name, so a test ofrenamedorodoes not match a change toorig. The unit edge is not enough once a named direct importer exists, because that suppresses theusers(unit)fallback. Localexport { a as b }already created aConstdefinition ofbwhoserefshelda. A bare localexport { o }created nothing, and the namespace import alone was not a unit edge, so importers of that binding never matched.Intent is to add the missing name edges without changing same-name or star re-exports, and without touching dynamic imports.
What changed
Source
export { name as alias } from spec, includingdefault as X, now also records aConstdefinition of the alias.refsholds the source name (origordefault) andusesholds the module spec.reexportsis unchanged. A same-name source re-export still adds no alias definition.Local
export { … }clauses are walked through a sharedexport_specifiershelper. Each specifier is stored as anExported(local,exported, span) and resolved after imports are bound. If that local name is a namespace import (importedis none), the file gains areexportsedge for the namespace spec. An existing alias definition getsuses; a bareexport { o }(which previously created no definition) gets aConstdefinition of the name importers use, withrefscontaining that name andusescontaining the spec. Export-before-import is covered because resolution happens after binding.export * asstays reexport-only.Scope
src/related/js.rs— export fact extraction and binding resolutiontests/related.rs— selection regressionRisk assessment
Medium. Selection widens only for importers of renaming re-exports and of re-exported namespaces. Namespace matching is an accepted over-approximation: any changed export of the namespace module selects importers of the namespace binding, even if the test never names that export. Barrel files are common, so affected-test sets can grow; this change does not include a large barrel fixture. Same-name and
export *edges are intentionally unchanged.User impact
aster --relatedon JS/TS projects selects tests that import throughexport { a as b } from,export { default as X } from, andimport * as o; export { o }(including a rename of that namespace). Direct importers are still selected. Tests of unrelated modules are not selected by these edges.Testing
The diff adds, but does not prove execution of:
source_reexports_that_rename_are_definitions_of_the_aliasanda_reexported_namespace_is_a_definition_of_that_bindinginsrc/related/js.rs(alias defs,default as X, same-name and star re-exports stay definition-free, namespace re-export including export-before-import)js_renamed_and_namespace_reexports_reach_their_importersintests/related.rs(issue layout with direct/rename/namespace tests, the no-direct variant,default as X, and an unrelated export selecting the namespace importer but not another module)Pipeline checks
format,lint,test,fix,reformat,verify-lint,verify-test, andcommitare reported succeeded with exit 0. Check excerpts are truncated and do not name these functions, so that success is not evidence the new tests ran. Author-reportedcargo test --lib related::,cargo test --test related, clippy, and fmt are advisory only and are not confirmed here.Follow-ups and known issues