From 4d35e1693ba19d0482ea832e432e5cd798b38282 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 17 Jun 2026 03:52:59 +0000 Subject: [PATCH] fix(oracle): match .slnx solutions + deepen shallow clone before build The first real oracle dispatch on Dapper (run 27660966107 / 27661...) failed to build for Infer# for two reasons, both fixed here: 1. Dapper's solution is `Dapper.slnx` (the newer XML solution format), which the autodetect `find -name '*.sln'` did not match -> "0 root / 0 total" -> dir fallback -> MSB1050. Now match both `*.sln` and `*.slnx`. 2. Even with the solution named explicitly, the build failed in Nerdbank.GitVersioning ("Shallow clone lacks the objects required to calculate version height"): the target is cloned `--depth 1`, but nbgv walks git history to compute the version. Deepen with `git fetch --unshallow --tags` before building (guarded with `|| true`; harmless when already complete). CodeQL + own-check are unaffected (they read source, no build). docs/notes/oracle.md updated. oracle.yml valid YAML; build-step bash parses; `.slnx` root-match verified. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED --- .github/workflows/oracle.yml | 17 +++++++++++------ docs/notes/oracle.md | 7 ++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml index acf767e6..c506c436 100644 --- a/.github/workflows/oracle.yml +++ b/.github/workflows/oracle.yml @@ -106,7 +106,7 @@ jobs: # Infer# — needs compiled binaries; build the target into one output dir. # `dotnet build ` errors (MSB1050) when a repo root holds more than one # project/solution, so choose a target: explicit `build` input wins; else a - # lone solution (root-preferred); else the dir (continue-on-error -> partial). + # lone solution (root-preferred, .sln or .slnx); else the dir (-> partial). - name: Build the target (for Infer#) env: BUILD: ${{ inputs.build }} @@ -115,19 +115,24 @@ jobs: if [[ -n "$BUILD" ]]; then tgt="target/$BUILD" else - # Prefer a unique solution at the repo root; else a unique solution - # anywhere (covers a lone deep .sln); else fall back to the dir + note. - mapfile -t root_slns < <(find target -maxdepth 1 -name '*.sln' | sort) - mapfile -t all_slns < <(find target -name '*.sln' | sort) + # Prefer a unique solution at the repo root; else a unique one anywhere + # (covers a lone deep solution); else fall back to the dir + note. + # Match both .sln and the newer XML .slnx (e.g. Dapper). + mapfile -t root_slns < <(find target -maxdepth 1 \( -name '*.sln' -o -name '*.slnx' \) | sort) + mapfile -t all_slns < <(find target \( -name '*.sln' -o -name '*.slnx' \) | sort) if [[ ${#root_slns[@]} -eq 1 ]]; then tgt="${root_slns[0]}" elif [[ ${#root_slns[@]} -eq 0 && ${#all_slns[@]} -eq 1 ]]; then tgt="${all_slns[0]}" else tgt="target" - echo "note: ${#root_slns[@]} root / ${#all_slns[@]} total .sln under target; pass the 'build' input to disambiguate" + echo "note: ${#root_slns[@]} root / ${#all_slns[@]} total solution(s) under target; pass the 'build' input to disambiguate" fi fi + # Some repos (e.g. those using Nerdbank.GitVersioning) need git history to + # compute a version at build time; the clone is shallow, so deepen it. + # Harmless (|| true) when the repo is already complete or doesn't need it. + git -C target fetch --unshallow --tags --quiet 2>/dev/null || true echo "Infer# build target: $tgt" if dotnet build "$tgt" -c Release -o _bin -v quiet; then echo "BUILD_OK=1" >> "$GITHUB_ENV" diff --git a/docs/notes/oracle.md b/docs/notes/oracle.md index 27f8112e..93cf8e32 100644 --- a/docs/notes/oracle.md +++ b/docs/notes/oracle.md @@ -37,9 +37,10 @@ Two classes sit **outside** the three-way diff and are reported separately: analyses compiled `.dll`+`.pdb`. So the oracle run can fail where ours doesn't — that asymmetry is the point, and each oracle step is `continue-on-error` so a build failure still yields a partial report. (For Infer#, the workflow - auto-builds a lone solution — a root-level `*.sln` preferred, else a unique one - anywhere; a repo with several needs the `build` input, since `dotnet build - ` is ambiguous otherwise, MSB1050.) + auto-builds a lone solution — a root-level `*.sln`/`*.slnx` preferred, else a + unique one anywhere; a repo with several needs the `build` input. The shallow + clone is deepened before building, since version tools like Nerdbank.GitVersioning + need history.) - **Path/line matching is deliberately loose.** Tools disagree on the exact line (allocation site vs declaration) and on path prefixes. The comparator matches on **basename + a line window** (`--line-tol`, default 3). Robust to prefixes;