fix(core): hash task outputs under scoped directories - #36846
Open
jcaracciolo wants to merge 4 commits into
Open
fix(core): hash task outputs under scoped directories#36846jcaracciolo wants to merge 4 commits into
jcaracciolo wants to merge 4 commits into
Conversation
added 4 commits
August 28, 2026 15:58
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 923b49ad-c037-401e-aaff-a79945209bcd
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 923b49ad-c037-401e-aaff-a79945209bcd
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 923b49ad-c037-401e-aaff-a79945209bcd
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 923b49ad-c037-401e-aaff-a79945209bcd
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
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.
Current Behavior
The native dependent-task output hasher derives an incorrect filesystem root for output globs containing scoped directory segments such as
packages/@acme/producer/dist/**/*.d.ts. The glob parser's invalid-group recovery discards the ungrouped@, causingget_files_for_outputsto walkpackages/acme/...and omit the generated files from the dependent task hash.Expected Behavior
Output-root partitioning preserves literal ungrouped special characters while deriving static path segments, so scoped declarations are discovered and included in dependent task hashes. Normal glob conversion retains its existing invalid-group compatibility behavior, and valid grouped patterns such as
@(foo|bar)continue to be converted normally.The change adds regression coverage for scoped output expansion and verifies that changing a declaration beneath a scoped directory changes the task output hash.
Design Decisions
Why the parser has two behaviors
Nx intentionally discards ungrouped
?,+, and@characters during normal glob conversion. This behavior was introduced in #21027 to tolerate malformed extglob prefixes such as+spec.tsinstead of failing the entire glob. Existing workspaces may depend on that compatibility behavior.Output-root partitioning has a different requirement: it must retain the original path text long enough to identify the directory that should be walked. In a path such as
packages/@acme/producer/dist/**/*.d.ts,@acmeis a literal directory segment rather than malformed extglob syntax.The parser therefore accepts an explicit behavior:
Discardpreserves the existingparse_globbehavior used by glob conversion.Preserveretains ungrouped special characters for static-root partitioning.Both behaviors use the same parser implementation; the mode only controls whether an ungrouped special character is retained in the parse result.
Alternatives considered
parse_globto always preserve these characters was rejected because it would alter the established invalid-group contract and require changing existing compatibility tests.@was rejected because valid forms such as@(foo|bar)must remain extglob expressions.Compatibility and scope
parse_globcontinue to useDiscardbehavior by default.Preservebehavior.Related Issue(s)
Fixes #36845