Skip to content

Fixed build mode false negative from export-star facade#4443

Open
johnfav03 wants to merge 6 commits into
microsoft:mainfrom
johnfav03:build-false-neg-fix
Open

Fixed build mode false negative from export-star facade#4443
johnfav03 wants to merge 6 commits into
microsoft:mainfrom
johnfav03:build-false-neg-fix

Conversation

@johnfav03

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings June 25, 2026 15:27

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.

Pull request overview

Fixes an incremental --build false-negative where a composite project’s emitted .d.ts is text-stable (e.g. export * from ...) while its re-exported API changes via referenced projects, causing downstream projects to not rebuild when they should.

Changes:

  • Extend composite .d.ts emit signature computation to incorporate versions of transitively re-exported declaration files.
  • Add a new tsc -b regression test scenario for an export * facade across composite project references.
  • Update/introduce tsbuild reference baselines reflecting the new emitSignatures behavior in .tsbuildinfo.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/execute/incremental/emitfileshandler.go Updates composite .d.ts signature tracking to account for transitive export ... from declaration dependencies.
internal/execute/tsctests/tscbuild_test.go Adds a new reexportFacade incremental build regression test with edits to a referenced project’s exported type.
testdata/baselines/reference/tsbuild/reexportFacade/export-star-facade-through-composite-project-references.js New baseline capturing the new regression scenario output.
testdata/baselines/reference/tsbuild/projectReferenceRedirect/uses-correct-project-reference-redirect-when-file-belongs-to-multiple-sub-projects.js Baseline update showing new emitSignatures recorded in build info.
testdata/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js Baseline update reflecting emitSignatures inclusion for cross-project specifier scenarios.
testdata/baselines/reference/tsbuild/moduleResolution/resolution-from-d.ts-of-referenced-project.js Baseline update reflecting emitSignatures inclusion for referenced-project .d.ts resolution.

Comment thread internal/execute/incremental/emitfileshandler.go Outdated
@johnfav03 johnfav03 changed the title Fixed false neg from export-star facade Fixed build mode false negative from export-star facade Jun 25, 2026
@johnfav03 johnfav03 requested a review from jakebailey June 25, 2026 15:53
Comment on lines +256 to +263
if newSignature == "" {
newSignature = h.program.snapshot.computeHash(getTextHandlingSourceMapForSignature(text, data))
}
// A composite project's d.ts can re-export another project's API via `export ... from "..."` whose text
// is stable even when that API changes; fold the re-exported d.ts versions in so the signature reflects it.
if reexportSuffix := h.getDeclarationReexportSignatureSuffix(file); reexportSuffix != "" {
newSignature = h.program.snapshot.computeHash(newSignature + "\n" + reexportSuffix)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This double hashes, no?

Is a newline how we actually combine things elsewhere, just a newline? Hopefully this doesn't end up with collisions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good callout on the double hashing. For the newline combining, diagnosticToStringBuilder uses newlines in the same way in snapshot.go.


// Returns versions of declaration (.d.ts) files in the transitive `export ... from` closure of the file.
// Same-project re-exports resolve to .ts sources and are skipped
func (h *emitFilesHandler) getDeclarationReexportSignatureSuffix(file *ast.SourceFile) string {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this correspond to something in Strada I could compare to?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Strada unfortunately has the same behavior for this issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, so this is fresh code?

@johnfav03 johnfav03 requested a review from jakebailey June 29, 2026 16:40
Comment thread internal/execute/incremental/emitfileshandler.go Outdated
@jakebailey jakebailey requested a review from andrewbranch June 29, 2026 20:24
@jakebailey

Copy link
Copy Markdown
Member

In general this seems not unreasonable, though it does seem like a lot of text to go into the key (but it is not saved, I know).

Do want a vibe check by @andrewbranch, however.

# Conflicts:
#	testdata/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js
#	testdata/baselines/reference/tsbuild/projectReferenceRedirect/uses-correct-project-reference-redirect-when-file-belongs-to-multiple-sub-projects.js
@andrewbranch

Copy link
Copy Markdown
Member

This should be marked for post-7.0, right?

@johnfav03

Copy link
Copy Markdown
Contributor Author

This should be marked for post-7.0, right?

I think that would be appropriate - this issue also existed in 6.0, so it doesn't seem super time critical

@jakebailey

Copy link
Copy Markdown
Member

Yes, per microsoft/TypeScript#63579 (comment)

I thought based on this being sent now that it was a new bug

@johnfav03 johnfav03 added this to the Post-7.0 milestone Jun 30, 2026
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.

tsc --build false negative through export star facade project

4 participants