fix(core): index modules project-wide so import gate covers modules outside sourceRoots - #64
Merged
Merged
Conversation
…utside sourceRoots The module index only scanned sourceRoots, so the import gate silently allowed importing internal files of modules outside those roots (e.g. sibling dirs when sourceRoots defaults to src/). Descriptor files are now discovered across the whole project while enforcement scope stays limited to sourceRoots. Also add the missing src/core/utils/index.ts interface and repoint imports that reached into its internal files.
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.
Problem
The module interface import gate failed to block an external file importing a module's internal file (instead of
index.ts) when the target module directory was outside the configuredsourceRoots. Observed via the Devin CLI hook; affects all bridges equally.Root cause:
buildModuleIndexscanned onlysourceRoots(default["src/"]), so modules outside those roots were never indexed.checkViolationsilently passes whenfindOwningModule(target)returns undefined. Existing behavior tests masked this by mockingloadConfigwithsourceRoots: [""].Fix
node_modules/.git), while edit-time enforcement (readonly, no-new-exports) remains limited tosourceRootsvia the existingisWithinSourceRootcheck.src/core/utils/index.tsinterface and repoint imports that reached into its internal files (config.ts,run-gates.ts,module-index-builder.ts).Tests
sourceRoots; node_modules/.git exclusion covered.sourceRoots: ["src/"]), making the sibling-module case a true regression test.Docs
sourceRootsrow updated in README (en/zh/ja): enforcement roots only; discovery is project-wide.Version bumped to 1.1.4.