FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rebuild source dependencies when package output settings change by cknitt · Pull Request #8540 · rescript-lang/rescript · GitHub

Rebuild source dependencies when package output settings change - #8540

Open
cknitt wants to merge 1 commit into
rescript-lang:masterfrom
cknitt:codex/fix-rewatch-package-spec-invalidation
Open

Rebuild source dependencies when package output settings change#8540
cknitt wants to merge 1 commit into
rescript-lang:masterfrom
cknitt:codex/fix-rewatch-package-spec-invalidation

Conversation

cknitt commented Aug 10, 2026
edited
Loading

Copy link
Copy Markdown
Member

Summary

Rewatch now records the effective package output settings in each package's compiler-info.json. When the consuming project's module format, in-source setting, or resolved suffix changes, affected source dependencies are cleaned and rebuilt.

This follows the existing invalidation mechanism for root source-map arguments.

A regression test covers rebuilding a shared source dependency after switching from CommonJS to ES modules.

Fixes #8539

cknitt force-pushed the codex/fix-rewatch-package-spec-invalidation branch from dc1214d to a33b3b4 Compare August 10, 2026 07:30
cknitt requested a review from jfrolich August 10, 2026 07:42
cknitt marked this pull request as ready for review August 10, 2026 07:43

cknitt commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a33b3b4855

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread rewatch/src/build/compiler_info.rs Outdated

pkg-pr-new Bot commented Aug 10, 2026
edited
Loading

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8540

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8540

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8540

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8540

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8540

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8540

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8540

commit: a8a69e0

cknitt force-pushed the codex/fix-rewatch-package-spec-invalidation branch from a33b3b4 to 0bfbbbd Compare August 10, 2026 07:58

cknitt commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bfbbbd36c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +63 to +64
source_files
.keys()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Remove outputs for sources missing from discovery

When a dependency loses a source file in the same update that changes the root package specs, source_files contains only the dependency's current files, so the previous output for the removed module is never visited here. Verification subsequently calls clean_package, deleting the old AST/compiler state before cleanup_previous_build can discover that removed module; the build then emits the remaining modules under the new spec but leaves the removed module's old .cjs/.mjs output behind. Use the previous build manifest or scan the previous output locations rather than limiting removal to current source keys.

Useful? React with 👍 / 👎.

Comment on lines 102 to +105
let parsed: Result<CompilerInfoFile, _> = serde_json::from_str(&contents);
let parsed = match parsed {
Ok(p) => p,
Err(_) => return true, // unknown or invalid format -> treat as mismatch
Err(_) => return Some((package, None)), // unknown or invalid format -> treat as mismatch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Migrate compiler-info files from the previous schema

When the first build with this version both upgrades Rewatch and changes package-specs, every compiler-info.json written by the previous version lacks the newly required package_output_specs field, so deserialization deterministically takes this branch and records no previous specs. The later cleanup therefore skips generated-output removal while deleting compiler assets, and recompilation leaves the old suffix or output directory alongside the new one. Fresh evidence beyond the earlier stale-output comment is the newly required schema field, which makes this path unavoidable for all pre-change metadata; deserialize it as optional or perform conservative output cleanup during migration.

Useful? React with 👍 / 👎.

Signed-off-by: Christoph Knittel <ck@cca.io>
cknitt force-pushed the codex/fix-rewatch-package-spec-invalidation branch from 0bfbbbd to a8a69e0 Compare August 10, 2026 12:49

cknitt commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

@jfrolich could you have a look? I think the Codex findings above are edge cases that we can skip.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rebuild source dependencies when package output settings change

1 participant


Back | FazBrowse Home | New Git URL