Fix flaky "Test export mpr-v2" CI job and lint job clobbering resources/rules - #154
Merged
Merged
Conversation
resolveOriginalPath iterated over the path map in Go's randomized order and derived a directory's original path from whichever mapped child it saw first. A child whose original path does not preserve the disk directory depth (e.g. Module2/_/Constant_2...) could hijack the prefix, which made the 'Test export mpr-v2' CI job fail intermittently. Scan candidates in sorted order and prefer structure-preserving mappings, falling back to depth-changing ones only when no aligned child exists. Co-authored-by: Xiwen Cheng <xiwenc@users.noreply.github.com>
The lint job's config set rules.path to ./resources/rules while inheriting the default remote ruleset, so SyncRulesets deleted the checked-in rules fixtures on the runner and replaced them with the downloaded bundle. Point rules.path at .ci/rules so the sync cannot overwrite repository files. Co-authored-by: Xiwen Cheng <xiwenc@users.noreply.github.com>
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
xiwenc
marked this pull request as ready for review
September 10, 2026 20:31
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
Investigation of recent CI runs found two issues in the pipeline; this PR fixes both.
1. Flaky "Test export mpr-v2" job (nondeterministic
app.yaml)CI run 34118183591 on PR #153 failed because the freshly exported
resources/modelsource-v2/app.yamlcontainedoriginalName: Constant_2.Constants$Constant.yamlforModule2instead oforiginalName: Module2— while the exact same commit passed after merge tomain.Root cause:
resolveOriginalPathinmpr/mpr.goderived a directory's original path by iterating over the path map withfor ... range, whose order is randomized in Go.Module2has one mapped child (Module2/_/Constant_2.Constants$Constant.yaml→Constant_2.Constants$Constant.yaml) whose original path does not preserve the disk directory depth; whenever the iteration happened to visit that entry first, its prefix hijackedModule2's derived original name (~1-in-11 chance per run).Fix: scan candidate children in sorted order and prefer structure-preserving mappings (same depth on disk and in the original path), falling back to depth-changing mappings only when no aligned child exists. Added regression tests;
TestResolveOriginalPathIsDeterministicreliably fails against the old code with exactly the value seen in the CI failure.2. "Test lint" job silently wipes
resources/ruleson the runnerThe lint job's generated config set
rules.path: ./resources/ruleswhile inheritingrules.rulesets(the published mxlint-rules v3.3.0 zip) from the embedded default config. Thelintsubcommand then runsSyncRulesets, which deletesresources/rulesand replaces it with the downloaded bundle — so the job lints against the remote bundle (matching its skip entries), but destroys the checked-in rules fixtures in the runner's workspace as a side effect.Fix: point
rules.pathat a.ci/rulesscratch directory so the sync cannot overwrite repository files. Behavior is otherwise unchanged (still lints with the published bundle plus the skip list).Verification
go test ./...passes.mpr-v1andmpr-v2) run 30 times back-to-back with zero diffs against the checked-in modelsource fixtures.Other pipeline observations (no change needed)
mainand the Release workflow (v3.17.2) are green.