fix: correct regex over-matching, missing pagination, and ignored exit codes#9
Draft
NormandErwan wants to merge 4 commits into
Draft
fix: correct regex over-matching, missing pagination, and ignored exit codes#9NormandErwan wants to merge 4 commits into
NormandErwan wants to merge 4 commits into
Conversation
- XrefMapService: narrow ZeroStringsRegex from `(\d):` to `\b0:` so
only the YAML-crashing `0:` pattern is stripped, not every digit
before a colon; update replacement from "$1" to "0" (no capture group)
- Utils.RunCommand: return process.ExitCode so callers can observe
non-zero results
- BuildCommand: check DocFX exit code and log/continue on failure
- unity-xref-maps.yml: paginate Unity Releases API with offset loop to
avoid silent truncation at limit=25; propagate dotnet tool exit code
with `if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }`
https://claude.ai/code/session_0145GzJVvweE69KcFn9j1WWB
…codes" This reverts commit ee77abc.
XrefMapServiceTests: - Load_ZeroColonAtWordBoundary_IsStripped: verifies `0: value` (which would crash the YAML deserializer) is pre-processed correctly - Load_NonZeroDigitColon_IsPreserved: verifies that `data1:field` in a string value keeps its colon; the old `(\d):` regex stripped it UtilsTests: - RunCommand_SuccessfulProcess_ReturnsZero / _FailingProcess_ReturnsNonZero: verify that RunCommand surfaces the process exit code; both tests fail to compile against the unfixed code because RunCommand returned void https://claude.ai/code/session_0145GzJVvweE69KcFn9j1WWB
- XrefMapService: narrow ZeroStringsRegex from `(\d):` to `\b0:` so
only the YAML-crashing `0:` pattern is stripped, not every digit
before a colon; update replacement from "$1" to "0" (no capture group)
- Utils.RunCommand: return process.ExitCode so callers can observe
non-zero results
- BuildCommand: check DocFX exit code and log/continue on failure
- unity-xref-maps.yml: paginate Unity Releases API with offset loop to
avoid silent truncation at limit=25; propagate dotnet tool exit code
with `if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }`
https://claude.ai/code/session_0145GzJVvweE69KcFn9j1WWB
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.
What was wrong and what changed
Regex stripping too many characters from xref map files
The code was removing the colon from any digit-colon sequence (
0:,1:,2:, …) in the raw YAML before parsing, even though only0:is problematic (YAML treats it as a mapping key).For example, a reference like
"SomeType.Method(Int32):SomeParam"would have its2:silently stripped to"SomeType.Method(Int32)SomeParam", producing a wrong href.Fix: the regex now only matches
0:, leaving all other digit-colon sequences untouched.Unity Releases API silently returning only the first 25 versions
The workflow fetched Unity versions with a hard-coded
limit=25and no paging, so any releases beyond the first 25 were silently ignored — no error, no warning, just missing xref maps.For example, if Unity has 40 supported versions, only the 25 most recent ones would ever get an xref map generated.
Fix: the fetch now loops with an increasing
offsetuntil the API returns an empty page, collecting every version before processing.DocFX exit code was never checked
RunCommandreturned nothing, so a DocFX failure (non-zero exit code) was invisible to the caller. The code only noticed something went wrong if the output file happened to be missing afterwards — a much weaker signal.For example, DocFX could fail mid-run, produce a partial file, and the tool would happily try to parse and publish it.
Fix:
RunCommandnow returns the process exit code. If DocFX exits non-zero, the error is logged immediately and that version is skipped.PowerShell step not propagating the tool's exit code
In the GitHub Actions workflow, the
dotnet … UnityXrefMaps.dllcommand runs inside a PowerShell script. PowerShell does not automatically fail the step when a command inside it exits non-zero, so a tool failure would be silently swallowed and the step would appear green.Fix: added
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }right after the dotnet command so a failure correctly marks the CI step as failed.Test plan
dotnet build --configuration Releasecompiles without errorsdotnet testpassesunity-xref-mapsworkflow manually and confirm versions beyond 25 appear in the matrixhttps://claude.ai/code/session_0145GzJVvweE69KcFn9j1WWB