fix(build-tools): normalize paths and reject backslash globs - #28216
Alex Villarreal (alexvy86) merged 9 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (227 lines, 8 files), I've queued these reviewers:
How this works
|
There was a problem hiding this comment.
🟡 Changes recommended
The shared normalization can miss additionalConfigFiles paths containing backslashes and needs a path-specific fix or explicit validation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request updates build-tools path handling to reject backslash globs and produce normalized POSIX Dockerfile paths.
Changes:
- Validate POSIX separators in task globs.
- Limit
${repoRoot}normalization. - Normalize Dockerfile package paths and add regression tests.
File summaries
| File | Summary |
|---|---|
build-tools/packages/build-tools/src/test/taskDefinitions.test.ts |
Tests rejection of invalid glob separators. |
build-tools/packages/build-tools/src/test/repoRootToken.test.ts |
Updates repository-root token expectations. |
build-tools/packages/build-tools/src/fluidBuild/fluidTaskDefinitions.ts |
Adds input/output glob separator validation. |
build-tools/packages/build-tools/src/fluidBuild/fluidBuildConfig.ts |
Narrows token normalization; moderate issue remains for additionalConfigFiles paths containing backslashes (2 votes). |
build-tools/packages/build-cli/src/test/library/repoPolicyCheck/dockerfilePackages.test.ts |
Tests Dockerfile path normalization; nit requests coverage through the policy resolver (1 vote). |
build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts |
Normalizes relative paths for POSIX Dockerfile COPY output. |
Review details
Suppressed comments (1)
build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts:56
- This regression test exercises only
getDockerfileCopyText; it never invokes the policyresolveror verifies the Dockerfile write. The caller-side normalization added here could therefore regress without this test failing. Add the temporary-Dockerfile resolver case described in the PR so the actualflub check policy --fixpath is covered.
TscUtils.normalizeSlashes(path.relative(gitRoot, file)).replace(serverPath, ""),
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>;
🔭 PR Review Fleet ReportNote This report is generated by an experimental AI review fleet and is provided as a beta feature. Findings are a starting point for discussion, not a gate. Use your own judgement. Verdict: 0 Spicy, 1 Pungent, 2 Smelly Findings
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
[Agent-generated] Added an unreleased
This follows the build-tools release-group changelog process; no client changeset is required. |
There was a problem hiding this comment.
🔵 Needs a closer look
One or more issues must be addressed before approval.
Review details
Suppressed comments (2)
build-tools/packages/build-tools/src/fluidBuild/fluidBuildConfig.ts:32
- The new separator checks cover only
normalizeGlobalTaskDefinitionsand package task overrides.fluidBuild.declarativeTasksis a second supported source ofDeclarativeTaskobjects (taskFactory.ts:101-107), and package-local declarations are passed directly there, so${repoRoot}\\src\\**\\*.tsstill reachesreplaceRepoRootTokensunchanged and is handed to fast-glob as an escaped path. Validate both repo-level and package-leveldeclarativeTasksbefore task creation, with regression coverage, so every declarative glob gets the new invariant.
return pathOrGlob.replace(REPO_ROOT_REGEX, normalizedRepoRoot);
build-tools/packages/build-tools/src/fluidBuild/fluidBuildConfig.ts:32
- The
@remarksabove still says the result is safe for fast-glob, but this return now deliberately preserves backslashes inpathOrGlob. A direct caller can therefore receive an unsafe glob; update the contract to say that onlyrepoRootis normalized and callers must provide or validate POSIX globs.
return pathOrGlob.replace(REPO_ROOT_REGEX, normalizedRepoRoot);
- Files reviewed: 8/8 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
[Agent-generated] Addressed the latest review findings in commit
Validation: the build-tools release-group build passed, and the targeted task-definition and repo-root token tests passed (35 tests total across the two runs). The changelog entry already documents the intentional runtime behavior change. |
There was a problem hiding this comment.
🔵 Needs a closer look
A moderate review comment requests replacement regression coverage for repo-root-only normalization; a helper export also has a minor nit.
Review details
Suppressed comments (2)
build-tools/packages/build-cli/src/library/repoPolicyCheck/dockerfilePackages.ts:13
- The new regression test exercises
handler.resolverand does not import this helper, and there are no other callers that require it to be exported. Keepingexportunnecessarily widens the module's API and can make this implementation detail part of the contract; keep the helper private.
export function getDockerfileCopyText(packageFilePath: string): string {
build-tools/packages/build-tools/src/fluidBuild/fluidBuildConfig.ts:33
- This change intentionally removes full-string normalization, but the direct regression test for
${repoRoot}\\...suffixes was deleted. Without a replacement assertion that the repo root is normalized while a backslash in the configured suffix remains unchanged, a future refactor could silently restore glob normalization and bypass the new validation contract.
return pathOrGlob.replace(REPO_ROOT_REGEX, normalizedRepoRoot);
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
[Agent-generated] Addressed both follow-up review comments in
Validation: Biome passed, the build-tools test project compiled, and the updated repo-root token suite passed with 18 tests. |
There was a problem hiding this comment.
🔵 Needs a closer look
The Dockerfile regression test is always skipped by the Linux build-tools CI pipeline.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
build-tools/packages/build-cli/src/test/library/repoPolicyCheck/dockerfilePackages.test.ts:29
- This regression test never runs in the build-tools CI:
build-build-tools.yml:94-109usesbuild-npm-package.yml, whose build/test pool is Linux (build-npm-package.yml:148-150). Consequently, removing the resolver normalization would still leave CI green. Please add a platform-independent seam that feeds a backslash-containing relative path into the COPY-text generation (while retaining this Windows integration test) so the regression is exercised on Linux CI.
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
[Agent-generated] Addressed the CI coverage gap in
Validation: Biome passed for the changed test file, the build-cli test project compiled, and |
There was a problem hiding this comment.
🟢 Approval recommended
The changes consistently enforce POSIX globs and preserve normalization for non-glob paths with appropriate regression coverage.
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bundle size comparisonBase commit: could not be determined; will be reported when the comparison runs Pending — |
Description
AB#45159
Build-tools task globs are configuration values and must use POSIX separators. Previously, backslash-containing globs were accepted and could be interpreted inconsistently across operating systems. This change validates declarative input/output globs with an actionable error while preserving repo-root-only normalization for token substitution.
The Dockerfile package policy resolver now normalizes relative paths before generating
COPYtext, matching the validator and preventingflub check policy --fixfrom writing OS-specific paths. It also reverts the incorrect full-string normalization introduced by PR #28214.Validation includes real build-graph evidence: the pre-fix build accepted
src\\**\\*.ts, while the fixed build rejects it during graph construction. A real resolver run against a temporary Dockerfile wrote the expectedCOPY packages/foo/package*.json packages/foo/line after the fix.Reviewer Guidance
The review process is outlined in the pull request guidelines.
Please review the scope of the path audit, especially the decision to validate configured globs rather than normalize them silently.
Validated with the build-tools compile flow, targeted build-tools tests (34 passing), and the isolated Dockerfile policy regression (1 passing).