test(filesystem_dacl): broaden network_path_rejected_e2e matcher#401
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Broadens the filesystem_dacl end-to-end test matcher for UNC paths to avoid CI flakes caused by environment-dependent fs::canonicalize failures, without changing production behavior.
Changes:
- Updated
network_path_rejected_e2eto acceptDaclError::Win32 { .. }in addition toNetworkPathRejectedandPathNotFound. - Replaced
matches!assertion with amatchthat panics with the observed variant for better diagnostics. - Added an explanatory comment documenting why different error variants can occur on different hosts.
Show a summary per file
| File | Description |
|---|---|
| src/wxc_common/src/filesystem_dacl.rs | Broadens the UNC-path E2E test’s accepted error variants and improves mismatch diagnostics to reduce CI flakiness. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 1
The `network_path_rejected_e2e` test (added in #295 / Phase 3) calls `grant_appcontainer_access` on `\\someserver\share\foo` and previously asserted the error was `NetworkPathRejected` or `PathNotFound`. On CI agents whose DNS resolves `someserver` (or returns a non-`NotFound` Win32 error such as `ERROR_BAD_NETPATH` or `ERROR_LOGON_FAILURE`), `fs::canonicalize` lands in our `Win32 { reason: "canonicalize: …" }` fallback, which the matcher did not accept — flaking the test. Broaden the matcher to accept `Win32 { .. }` as well, and convert the assertion into a `match` that prints the actual variant on failure so future flakes are diagnostic. The test's intent ("we never silently succeed on a UNC path") is preserved — the deterministic verification of the classifier itself lives in `ensure_local_canonical_prefix_rejects_unc_namespace` and `ensure_local_canonical_prefix_rejects_raw_unc` above, both unaffected. No production behavior change. Discovered while shepherding #389 (Phase 3.5) through CI on an agent that hit this code path differently than the dev-box agents used during Phase 3's CI run. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6ff6eb8 to
1924883
Compare
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.
Summary
Broadens the matcher in
filesystem_dacl::tests::network_path_rejected_e2e(added in #295 / Phase 3) so the test no longer flakes on CI agents whose network environment causesfs::canonicalize("\\someserver\\share\\foo")to error with a non-NotFoundWin32 code such asERROR_BAD_NETPATHorERROR_LOGON_FAILURE.Why
The test asserts that
grant_appcontainer_accesson a UNC path errors out cleanly. It previously accepted onlyNetworkPathRejected | PathNotFound:PathNotFoundlands whenfs::canonicalizereturnsio::ErrorKind::NotFound— the common case on dev boxes / agents wheresomeserverdoes not resolve.NetworkPathRejectedlands when canonicalize succeeds and ourensure_local_canonical_prefixrejects the UNC namespace.Win32 { reason: "canonicalize: …" }is the third reachable variant: on agents in a corporate network, DNS may resolvesomeserverto an unreachable host, or the Win32 layer may returnERROR_BAD_NETPATH/ERROR_LOGON_FAILURE, neither of which maps toio::ErrorKind::NotFound. This is what an MXC Phase 3.5 CI run hit while Phase 3.5: --prepare-system-drive flag for AppContainer host setup #389 was in flight (build 147648700).The deterministic verification of the UNC classifier itself lives in
ensure_local_canonical_prefix_rejects_unc_namespaceandensure_local_canonical_prefix_rejects_raw_unc(both unaffected and unchanged).What changed
network_path_rejected_e2enow acceptsWin32 { .. }in addition to the prior two variants — the test's intent ("we never silently succeed on a UNC path") is satisfied by any well-typed error variant.assert!(matches!(...))to amatcharm that prints the actual error variant on mismatch, so future flakes are diagnostic.No production code paths change.
Validation
All clean on the CI-matched toolchain (1.93.1; once #399 lands, this will be the default for everyone). Test passes locally — it falls into the
PathNotFoundbranch on a dev box (no DNS resolution forsomeserver).Microsoft Reviewers: Open in CodeFlow