Skip to content

fix: resolve imports under a dotted package name - #141

Merged
kvlonge merged 1 commit into
mainfrom
fix/dotted-package-name
Nov 23, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/dotted-package-name

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Why

A rule target may use a dotted package name, such as app.nodes, for a package whose source root is src/app/nodes. Module paths were built with the whole dotted name as one segment, and source roots were found by their last folder name only, so imports of the package never resolved. FFL104 and the other import-ownership checks then silently skipped them.

Changes

  • NativeRuleContext::package_parts splits the package name into segments, and package_root_parent finds the root whose trailing folders spell them.
  • Module paths, ownership positions, public-facade checks and the public-surface import check read the package by its segments.
  • Single-segment package names behave as before.

Verification

  • New test_dotted_package.rs: an import of another domain's private main entry under app.nodes plans the right is_file query and reports FFL104; the same domain's import does not.
  • cargo test -p fensu-native, cargo clippy -p fensu-native --all-targets -- -D warnings, cargo fmt --check and fensu check --target rust pass.

A target whose package name has several segments, such as `app.nodes`,
built module paths with the whole dotted name as one segment and looked
for its source root by the last folder name only. Imports of the package
therefore never matched, so rules that read imported modules (FFL104 and
the other import-ownership checks) silently skipped them.

Package names are now split into segments, and a source root holds the
package when its last folders spell them, as `src/app/nodes` does for
`app.nodes`. Single-segment package names behave as before.
@kvlonge
kvlonge enabled auto-merge (squash) November 23, 2026 16:02
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying fensu with  Cloudflare Pages  Cloudflare Pages

Latest commit: aec95a1
Status: ✅  Deploy successful!
Preview URL: https://fb98740a.fensu.pages.dev
Branch Preview URL: https://fix-dotted-package-name.fensu.pages.dev

View logs

@kvlonge
kvlonge merged commit 573ce88 into main Nov 23, 2026
38 checks passed
@kvlonge
kvlonge deleted the fix/dotted-package-name branch November 23, 2026 16:15
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