Skip to content

fix(attw): apply profiles to file-based problems - #1108

Merged
sxzz merged 3 commits into
mainfrom
fix/attw-profile-file-problems
Oct 28, 2026
Merged

sxzz merged 3 commits into
mainfrom
fix/attw-profile-file-problems

Conversation

@sxzz

@sxzz sxzz commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

The attw profile filter only looked at problem.resolutionKind. File-based problems (InternalResolutionError, FalseCJS, FalseESM, NamedExports, FalseExportDefault, MissingExportEquals, UnexpectedModuleSyntax, CJSOnlyExportsDefault) don't have that field, so no profile could ignore them. With profile: 'esm-only', a node10-only internal resolution error still failed the build.

This PR uses the same filtering as the attw CLI's summary output (problemAffectsResolutionKind in render/typed.ts). Every problem index is recorded in visibleProblems of the entrypoint resolutions it affects. A problem is kept only if it is visible from at least one resolution kind the profile still requires.

Note that the CLI's exit code (getExitCode.ts) still filters by resolutionKind only, so attw --profile esm-only can print "No problems found" and still exit 1 (see arethetypeswrong/arethetypeswrong.github.io#248). tsdown follows the documented profile semantics instead. The visible indices are collected into a Set once, so a single check covers both resolution-based and file-based problems, with no special case for strict.

Tests in src/features/pkg/attw.test.ts inject a stubbed module with a hand-built checkResult, so they run in milliseconds without packing a tarball. They cover the esm-only, node16 and strict profiles and ignoreRules. I also ran the reproduction from #1096 end to end: before this change it fails with 💥 Internal resolution error … (node10), after it prints No problems found.

The default profile has been esm-only since 9b3cfca, but the JSDoc, schema.json and the lint docs (en and zh-CN) still said strict. This PR updates them to match the code.

This takes over from #1098; thanks @rudycelekli for the initial investigation.

Closes #1096
Closes #1098

Copilot AI balanced review requested due to automatic review settings October 28, 2026 05:12
@netlify

netlify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 61b4ccd
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6ae1852a2dcfd5650c6851dc
😎 Deploy Preview https://deploy-preview-1108--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/rolldown/tsdown@1108 -D
npm i https://pkg.pr.new/rolldown/tsdown@1108 -D
yarn add https://pkg.pr.new/rolldown/tsdown@1108.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/rolldown/tsdown/create-tsdown@1108 -D
npm i https://pkg.pr.new/rolldown/tsdown/create-tsdown@1108 -D
yarn add https://pkg.pr.new/rolldown/tsdown/create-tsdown@1108.tgz -D

@tsdown/css

pnpm add https://pkg.pr.new/rolldown/tsdown/@tsdown/css@1108 -D
npm i https://pkg.pr.new/rolldown/tsdown/@tsdown/css@1108 -D
yarn add https://pkg.pr.new/rolldown/tsdown/@tsdown/css@1108.tgz -D

@tsdown/exe

pnpm add https://pkg.pr.new/rolldown/tsdown/@tsdown/exe@1108 -D
npm i https://pkg.pr.new/rolldown/tsdown/@tsdown/exe@1108 -D
yarn add https://pkg.pr.new/rolldown/tsdown/@tsdown/exe@1108.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/rolldown/tsdown/tsdown-migrate@1108 -D
npm i https://pkg.pr.new/rolldown/tsdown/tsdown-migrate@1108 -D
yarn add https://pkg.pr.new/rolldown/tsdown/tsdown-migrate@1108.tgz -D

commit: 61b4ccd

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the ATTW profile-filtering change.

No open issues 🎉

What changed in this PR

Fixes tsdown’s ATTW profile filtering so file-based problems confined to ignored resolutions no longer fail builds, addressing #1096.

Changes:

  • Collects visible problem indices from resolutions required by the selected profile.
  • Applies visibility filtering alongside ignoreRules to both file-based and resolution-based problems.
  • Adds stub-based tests for esm-only, node16, strict, and ignored rules.
File Description
src/​features/​pkg/​attw.ts Filters problems using entrypoint resolution visibility.
src/​features/​pkg/​attw.test.ts Adds regression tests for profile filtering and ignored rules.

Review effort: Balanced

@sxzz
sxzz merged commit a853d19 into main Oct 28, 2026
17 checks passed
@sxzz
sxzz deleted the fix/attw-profile-file-problems branch October 28, 2026 05:19
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.

attw: the esm-only profile fails the build on a node10 internal resolution error

3 participants