Skip to content

Commit 771bca5

Browse files
PhysShellclaude
andcommitted
feat(extractor): P-014 PROD0 opt-in --binding-coverage sidecar (observation only)
One CSharpCompilation per project from the existing project.assets.json, local targeting packs and the packages folder (project references as compilation references; dotnet/sdk conflict order; fail-closed statuses), written to a separate file after the facts. Facts, findings, SARIF and exit codes are unchanged; directory/.sln/unrestored inputs are recorded UNSUPPORTED. CI step in wpf-extractor asserts byte-identical facts and the fail-closed status. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TFkNAFFQz9KoTzpPws8vYG
1 parent 6ec551f commit 771bca5

5 files changed

Lines changed: 874 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,6 +2132,50 @@ jobs:
21322132
<(jq -S . "$RUNNER_TEMP/proj-facts-norefs.json") \
21332133
|| { echo "FAIL: --no-project-refs changed the facts for an unbuilt sample project"; exit 1; }
21342134
echo "OK: --help renders the option list; --no-project-refs is accepted"
2135+
# P-014 PROD0: the opt-in --binding-coverage sidecar is OBSERVATION ONLY. The facts are byte-identical with
2136+
# and without it; a directory or an unrestored project is recorded UNSUPPORTED (never measured by substitution);
2137+
# a restored copy of the sample is measured per project with no foreign binding, deterministically.
2138+
# Evidence: docs/evidence/p014-prod0-2026-10.
2139+
- name: P-014 PROD0 — --binding-coverage sidecar (observation only)
2140+
run: |
2141+
x="dotnet run --project frontend/roslyn/OwnSharp.Extractor --"
2142+
proj=frontend/roslyn/project-input-sample/ProjectInputSample.csproj
2143+
$x "$proj" -o "$RUNNER_TEMP/bc-off.json"
2144+
$x "$proj" -o "$RUNNER_TEMP/bc-on.json" --binding-coverage "$RUNNER_TEMP/bc-unrestored.json"
2145+
cmp "$RUNNER_TEMP/bc-off.json" "$RUNNER_TEMP/bc-on.json" \
2146+
|| { echo "FAIL: --binding-coverage changed the facts document"; exit 1; }
2147+
$x frontend/roslyn/samples -o "$RUNNER_TEMP/bc-dir-off.json"
2148+
$x frontend/roslyn/samples -o "$RUNNER_TEMP/bc-dir-on.json" --binding-coverage "$RUNNER_TEMP/bc-dir.json"
2149+
cmp "$RUNNER_TEMP/bc-dir-off.json" "$RUNNER_TEMP/bc-dir-on.json" \
2150+
|| { echo "FAIL: --binding-coverage changed the facts document (directory input)"; exit 1; }
2151+
# a restored COPY of the sample (the sample itself stays unbuilt for the parity checks above)
2152+
cp -r frontend/roslyn/project-input-sample "$RUNNER_TEMP/bc-sample"
2153+
dotnet restore "$RUNNER_TEMP/bc-sample/ProjectInputSample.csproj"
2154+
for run in 1 2; do
2155+
$x "$RUNNER_TEMP/bc-sample/ProjectInputSample.csproj" -o "$RUNNER_TEMP/bc-r$run-facts.json" \
2156+
--binding-coverage "$RUNNER_TEMP/bc-restored-$run.json"
2157+
done
2158+
cmp "$RUNNER_TEMP/bc-restored-1.json" "$RUNNER_TEMP/bc-restored-2.json" \
2159+
|| { echo "FAIL: the binding-coverage sidecar is not deterministic"; exit 1; }
2160+
python - "$RUNNER_TEMP" <<'PY'
2161+
import json, sys
2162+
t = sys.argv[1]
2163+
def units(name):
2164+
return json.load(open(f"{t}/{name}.json"))["units"]
2165+
[u] = units("bc-unrestored")
2166+
assert u["unit_status"] == "UNSUPPORTED" and u["reasons"]["unsupported"] == ["no-assets"], u
2167+
[u] = units("bc-dir")
2168+
assert u["unit_status"] == "UNSUPPORTED" and u["reasons"]["unsupported"] == ["input-kind:directory"], u
2169+
[u] = units("bc-restored-1")
2170+
assert u["reference_status"] == "COMPLETE", u["reasons"]
2171+
assert u["foreign_binding"] == 0 and u["invariants_failed"] == [], u
2172+
# fail closed: COMPLETE only with no reason on any axis
2173+
reasons = u["reasons"]["reference"] + u["reasons"]["source_set"] + u["reasons"]["unsupported"]
2174+
assert (u["unit_status"] == "COMPLETE") == (not reasons), (u["unit_status"], reasons)
2175+
assert u["sites"]["event_assign"]["event"] >= 1, u["sites"]
2176+
print("OK: PROD0 sidecar —", u["unit_status"], u["tfm"], u["tfm_status"], "reasons:", reasons)
2177+
PY
2178+
echo "OK: --binding-coverage leaves facts byte-identical; UNSUPPORTED inputs recorded; restored sample measured"
21352179
# explain: the diagnostic-catalogue CLI surface lives in the core (one checker). Smoke
21362180
# it end-to-end — explain a code, and harvest+explain every code in a real findings file.
21372181
- name: explain command (code + --json harvest)

‎docs/proposals/P-014-semantic-resolution.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
**Still deferred:** the heavier auto-discovery of a project's *full transitive closure* from a
1818
`.csproj`/`.sln` without a prior build (`MSBuildWorkspace`, open question Q3), monorepo scoping
1919
(Q1), and a general check-selection surface (Q2).
20+
**PROD0, opt-in, observation only (2026-10):** `--binding-coverage FILE` writes a per-project
21+
binding-coverage record for one restored `.csproj`. It builds one compilation per project from
22+
`obj/project.assets.json` and the packs, with the dotnet/sdk conflict order and fail-closed
23+
statuses, and it never changes facts or verdicts. Evidence chain:
24+
`docs/evidence/p014-reference-coverage-2026-10` → `p014-bounded-design-2026-10` →
25+
`p014-tiny-poc-2026-10` → `p014-prod0-2026-10`. Feeding the new symbols to diagnostics (PROD1)
26+
is **not** authorised.
2027
- **Depends on:**
2128
- [P-001](P-001-csharp-extractor.md) — the seam this deepens. P-001 defines the
2229
Roslyn-extractor → OwnIR → Python-core pipeline (P-001:71-77) *and* owns the

0 commit comments

Comments
 (0)