Skip to content

fix: correct regex over-matching - #9

Open
NormandErwan wants to merge 9 commits into
mainfrom
claude/fix-xrefmaps-audit-issues-8Tvrf
Open

NormandErwan wants to merge 9 commits into
mainfrom
claude/fix-xrefmaps-audit-issues-8Tvrf

Conversation

@NormandErwan

@NormandErwan NormandErwan commented May 3, 2026 •

Copy link
Copy Markdown
Owner

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 only 0: is problematic (YAML treats it as a mapping key).

For example, a reference like "SomeType.Method(Int32):SomeParam" would have its 2: 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.


Test plan

  • dotnet build --configuration Release compiles without errors
  • dotnet test passes
  • Trigger the unity-xref-maps workflow manually and confirm versions beyond 25 appear in the matrix
  • Verify a DocFX failure now surfaces as a failed CI step

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
@NormandErwan NormandErwan changed the title fix: address P1 audit issues — regex scope, pagination, exit codes fix: correct regex over-matching, missing pagination, and ignored exit codes May 3, 2026
claude added 2 commits May 3, 2026 19:38
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
@bdovaz
bdovaz added this pull request to stack #17 October 15, 2026 09:46
Copilot AI added a commit that referenced this pull request Oct 15, 2026
- Change Utils.RunCommand return type from Task to Task<int> to return process exit code
- Capture exit code from DocFX command in BuildCommand
- Check if exit code is non-zero and skip further processing if DocFX fails
- Log error message with exit code when DocFX fails

Fixes: Extract changes from PR #9

Co-authored-by: bdovaz <950602+bdovaz@users.noreply.github.com>
bdovaz added a commit that referenced this pull request Oct 15, 2026
- Change Utils.RunCommand return type from Task to Task<int> to return process exit code
- Capture exit code from DocFX command in BuildCommand
- Check if exit code is non-zero and skip further processing if DocFX fails
- Log error message with exit code when DocFX fails

Fixes: Extract changes from PR #9

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bdovaz <950602+bdovaz@users.noreply.github.com>
@bdovaz
bdovaz force-pushed the claude/fix-xrefmaps-audit-issues-8Tvrf branch from a72497e to 7ddc8fb Compare October 15, 2026 12:23
claude and others added 5 commits October 15, 2026 14:29
- 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
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
@bdovaz
bdovaz removed this pull request from stack #17 October 15, 2026 12:36
@bdovaz
bdovaz marked this pull request as ready for review October 15, 2026 12:38
@bdovaz bdovaz changed the title fix: correct regex over-matching, missing pagination, and ignored exit codes fix: correct regex over-matching Oct 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants