tooling: report GDK knowledge coverage #3291

Manually merged
github merged 2 commits from github-bot/gh-3289 into main 2026-11-28 08:31:54 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-11-28 05:25 UTC · original
lambirou:gdk/knowledge-report → main · +2241 −0 · 4 files · 2 commits · merged 2026-11-28 08:24 UTC

The GDK knowledge plan ends with a merged report: total facts, per-category coverage, conflicts between sources, and shim exports that have no fact behind them. This adds that report and keeps the knowledge tree outside the repository.

tools/gdk_knowledge_report.py normalizes layouts, ABI facts, exports, runtime observations, platform profiles and shader cases into module, kind, name, value, source and confidence. It reports size conflicts (including layout versus ABI sizeof), cross-module type-size differences, ordinal conflicts, enum conflicts and other value conflicts with deterministic ordering. It also reads the shim .def files, ignores the local x2w_* and X2W* helpers, follows the xcrdapi -> dstorage_xs alias, and lists shim functions with no matching fact.

Measured on 28 November 2026 from the current knowledge tree:

  • 28,785 normalized facts.
  • Layouts: 11,834 facts from four headers.
  • ABI: 9,677 sizeof facts from four headers.
  • Exports: 8,035 rows from 89 modules.
  • Behavior: 12 runtime observations.
  • Platform: 3 profiles.
  • Shaders: 6 corpus cases.
  • 0 size, ordinal, enum or value conflicts.
  • 0 shim functions without an export fact after the alias and local-filter rules.

Commands:

python -B tests/gdk_knowledge_report_check.py
python -B tools/gdk_knowledge_report.py report --root D:\gdk-oracle\knowledge --json D:\gdk-oracle\knowledge\coverage.json --markdown D:\gdk-oracle\knowledge\report.md --defs src

The check passed on Windows and runs on Linux without the GDK. The real coverage and report were written next to the knowledge index, and the index now records the six present categories, 28,785 facts, zero conflicts and zero shim gaps.

The report records limits rather than treating counts as proof: a layout is one compiler and macro set, an export name is not a signature or a test, and a runtime observation is one host and one runtime build.

**@⁠lambirou** on GitHub · 2026-11-28 05:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3289) `lambirou:gdk/knowledge-report` → `main` · +2241 −0 · 4 files · 2 commits · merged 2026-11-28 08:24 UTC The GDK knowledge plan ends with a merged report: total facts, per-category coverage, conflicts between sources, and shim exports that have no fact behind them. This adds that report and keeps the knowledge tree outside the repository. tools/gdk_knowledge_report.py normalizes layouts, ABI facts, exports, runtime observations, platform profiles and shader cases into module, kind, name, value, source and confidence. It reports size conflicts (including layout versus ABI sizeof), cross-module type-size differences, ordinal conflicts, enum conflicts and other value conflicts with deterministic ordering. It also reads the shim .def files, ignores the local x2w_* and X2W* helpers, follows the xcrdapi -> dstorage_xs alias, and lists shim functions with no matching fact. Measured on 28 November 2026 from the current knowledge tree: - 28,785 normalized facts. - Layouts: 11,834 facts from four headers. - ABI: 9,677 sizeof facts from four headers. - Exports: 8,035 rows from 89 modules. - Behavior: 12 runtime observations. - Platform: 3 profiles. - Shaders: 6 corpus cases. - 0 size, ordinal, enum or value conflicts. - 0 shim functions without an export fact after the alias and local-filter rules. Commands: python -B tests/gdk_knowledge_report_check.py python -B tools/gdk_knowledge_report.py report --root D:\gdk-oracle\knowledge --json D:\gdk-oracle\knowledge\coverage.json --markdown D:\gdk-oracle\knowledge\report.md --defs src The check passed on Windows and runs on Linux without the GDK. The real coverage and report were written next to the knowledge index, and the index now records the six present categories, 28,785 facts, zero conflicts and zero shim gaps. The report records limits rather than treating counts as proof: a layout is one compiler and macro set, an export name is not a signature or a test, and a runtime observation is one host and one runtime build.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 05:27:45 +00:00
github-bot force-pushed github-bot/gh-3289 from 9a5bb201f7 to 4942e55715 2026-11-28 05:37:45 +00:00 Compare
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-28 08:02 UTC · original

Thanks for this. I reviewed head 4942e557 by reading it and running the new check (no Windows build, Wine or GPU; a stdlib-only tool doesn't need them). It merges cleanly into main c3204a9c (git merge-tree --write-tree rc=0), and tests/gdk_knowledge_report_check.py prints gdk_knowledge_report_check: ok on the merged tree. The Linux CI job shows tests/gdk_knowledge_report_check.py (ok, 1.2s) and all 248 checks passed. --defs src reproduces the body's 70 shims. It looks ready from our side, and nothing below is blocking.

Suggestions:

  1. Shim coverage is looser than the doc's "matched an export fact" and the body's "0 shim functions without an export fact". _associate_shims builds exact = {fact["name"] for fact in facts}, so a fact of any kind in any module counts, and so does the .def internal name. With one layout class XMemAlloc in module other and one shader case XMemFree, 4 of the 13 xmem shims count as covered (XMemAllocDefault and XMemFreeDefault through their internal names). A mutant that matches only same-module export facts still passes the check, so the test pins neither rule. Either match kind == export facts in the shim's module (plus an explicit alias table), or reword both sentences to "matched a fact name".
  2. The body says the tool "follows the xcrdapi -> dstorage_xs alias", but grep -c -i 'dstorage\|xcrdapi' gives 0 for the tool, the test and the doc. The XCRDAPI shim is covered only by the module-blind match in 1.
  3. On main, tools/gdk_abi_probe.py parse writes {"facts": {"sizeof(Shared)": 32}}, and the report rejects that file with error: abi/alpha.json facts must be a JSON array (rc=2). The probe landed after this branch's merge-base. If a hand conversion to an array keeps the sizeof(X) names, nothing is compared: layout Shared=16 against an ABI fact sizeof(Shared)=32 gives --check rc=0 and 0 conflicts. Accepting the probe's mapping form (stripping sizeof(...)) and reporting how many ABI sizes were compared with a layout would tell "0 conflicts" apart from "0 overlap".
  4. Nits: no test case covers the <unnamed-tag> exclusion or the missing-ordinal rule (a mutant of each still passes). --require counts files, not facts, so empty classes, facts and exports arrays pass --require layouts,abi,exports --check with 0 facts. The .def parser's startswith("LIBRARY") and startswith("EXPORTS") would also match an export named like LibraryX (no repo .def has one). exports-all.json is silently ignored once exports/ holds any file, and the input table doesn't say so.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-28 08:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3289#issuecomment-7236321515) Thanks for this. I reviewed head `4942e557` by reading it and running the new check (no Windows build, Wine or GPU; a stdlib-only tool doesn't need them). It merges cleanly into `main` `c3204a9c` (`git merge-tree --write-tree` rc=0), and `tests/gdk_knowledge_report_check.py` prints `gdk_knowledge_report_check: ok` on the merged tree. The Linux CI job shows `tests/gdk_knowledge_report_check.py (ok, 1.2s)` and `all 248 checks passed`. `--defs src` reproduces the body's 70 shims. It looks ready from our side, and nothing below is blocking. Suggestions: 1. Shim coverage is looser than the doc's "matched an export fact" and the body's "0 shim functions without an export fact". `_associate_shims` builds `exact = {fact["name"] for fact in facts}`, so a fact of any kind in any module counts, and so does the `.def` internal name. With one layout class `XMemAlloc` in module `other` and one shader case `XMemFree`, 4 of the 13 xmem shims count as covered (`XMemAllocDefault` and `XMemFreeDefault` through their internal names). A mutant that matches only same-module export facts still passes the check, so the test pins neither rule. Either match `kind == export` facts in the shim's module (plus an explicit alias table), or reword both sentences to "matched a fact name". 2. The body says the tool "follows the xcrdapi -> dstorage_xs alias", but `grep -c -i 'dstorage\|xcrdapi'` gives 0 for the tool, the test and the doc. The XCRDAPI shim is covered only by the module-blind match in 1. 3. On `main`, `tools/gdk_abi_probe.py parse` writes `{"facts": {"sizeof(Shared)": 32}}`, and the report rejects that file with `error: abi/alpha.json facts must be a JSON array` (rc=2). The probe landed after this branch's merge-base. If a hand conversion to an array keeps the `sizeof(X)` names, nothing is compared: layout `Shared`=16 against an ABI fact `sizeof(Shared)`=32 gives `--check` rc=0 and 0 conflicts. Accepting the probe's mapping form (stripping `sizeof(...)`) and reporting how many ABI sizes were compared with a layout would tell "0 conflicts" apart from "0 overlap". 4. Nits: no test case covers the `<unnamed-tag>` exclusion or the missing-ordinal rule (a mutant of each still passes). `--require` counts files, not facts, so empty `classes`, `facts` and `exports` arrays pass `--require layouts,abi,exports --check` with 0 facts. The `.def` parser's `startswith("LIBRARY")` and `startswith("EXPORTS")` would also match an export named like `LibraryX` (no repo `.def` has one). `exports-all.json` is silently ignored once `exports/` holds any file, and the input table doesn't say so. This comment was AI-assisted.
github manually merged commit 863b1ae346 into main 2026-11-28 08:31:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.