Scripts: validate GDK table GUIDs before generation #2724

Open
github-bot wants to merge 2 commits from github-bot/gh-2724 into main AGit
Owner

@⁠luckyteagirl on GitHub · 2026-11-26 08:52 UTC · original
luckyteagirl:codex/gdk-table-validate-guids → main · +48 −1 · 2 files · 2 commits · draft

gen_gdk_table.py previously trusted any 36-character mixture of hex digits and hyphens as a GUID and silently skipped a malformed shorter row. A bad source table could therefore generate an out-of-range Rust integer or omit an API entry without naming the bad row. Validate both identifiers before replacing the generated table.

What is in it

  • scripts/gen_gdk_table.py: capture quoted class and interface fields, then require the canonical 8-4-4-4-12 hexadecimal GUID form for each row before opening the Rust output. A failure names the row and field.
  • scripts/test_gdk_table_guids.py: exercise oversized, short, misplaced-hyphen, and quoted // inputs and confirm that a rejected row leaves the previous output intact.

Tested

  • On current main b49be183, the original three malformed-row cases failed the new fixture because the generator exited successfully instead of rejecting the input. The expanded fixture passes on head aae8e433.
  • python -B -m unittest discover -s scripts -p 'test_*.py': 26 passed, 0 failed, exit 0.
  • Reconstructing all 396 checked-in GDK table rows into a canonical temporary input and regenerating in a temporary workspace reproduced the checked-in Rust table byte for byte.
  • A temporary composition with #2658 and the quote-aware #2681 follow-up passed all 28 Python script tests; commented malformed rows were skipped, while an active malformed bad//guid row was rejected without overwriting the output.
  • git diff b49be183 HEAD --check: passed.

Regression run

  • Not applicable to this generator-only change; no runtime source or generated table changed.

Not tested

  • A newly extracted GDK SDK table, the Rust workspace/GPU suite, or a retail title. Open #2658 and #2681 edit adjacent generator lines and may need a small conflict resolution if either merges first.

AI use

  • OpenAI Codex (GPT-6.2 Sol) implemented the generator validation and initial failing-first fixture. OpenAI Codex (GPT-6.2 Astra) reviewed the diff, extended the fixture for quoted //, and tested the combined branches.
**@⁠luckyteagirl** on GitHub · 2026-11-26 08:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2724) `luckyteagirl:codex/gdk-table-validate-guids` → `main` · +48 −1 · 2 files · 2 commits · draft `gen_gdk_table.py` previously trusted any 36-character mixture of hex digits and hyphens as a GUID and silently skipped a malformed shorter row. A bad source table could therefore generate an out-of-range Rust integer or omit an API entry without naming the bad row. Validate both identifiers before replacing the generated table. **What is in it** - `scripts/gen_gdk_table.py`: capture quoted class and interface fields, then require the canonical `8-4-4-4-12` hexadecimal GUID form for each row before opening the Rust output. A failure names the row and field. - `scripts/test_gdk_table_guids.py`: exercise oversized, short, misplaced-hyphen, and quoted `//` inputs and confirm that a rejected row leaves the previous output intact. **Tested** - On current main `b49be183`, the original three malformed-row cases failed the new fixture because the generator exited successfully instead of rejecting the input. The expanded fixture passes on head `aae8e433`. - `python -B -m unittest discover -s scripts -p 'test_*.py'`: **26 passed, 0 failed**, exit 0. - Reconstructing all 396 checked-in GDK table rows into a canonical temporary input and regenerating in a temporary workspace reproduced the checked-in Rust table byte for byte. - A temporary composition with #2658 and the quote-aware #2681 follow-up passed all **28 Python script tests**; commented malformed rows were skipped, while an active malformed `bad//guid` row was rejected without overwriting the output. - `git diff b49be183 HEAD --check`: passed. **Regression run** - Not applicable to this generator-only change; no runtime source or generated table changed. **Not tested** - A newly extracted GDK SDK table, the Rust workspace/GPU suite, or a retail title. Open #2658 and #2681 edit adjacent generator lines and may need a small conflict resolution if either merges first. **AI use** - OpenAI Codex (GPT-6.2 Sol) implemented the generator validation and initial failing-first fixture. OpenAI Codex (GPT-6.2 Astra) reviewed the diff, extended the fixture for quoted `//`, and tested the combined branches.
Reject malformed class and interface identifiers before opening the Rust output. A malformed row could previously emit an out-of-range integer or silently disappear.

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:58:40 +00:00
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-26 09:45 UTC · original · edited 2026-11-26 09:57 UTC

I tested aae8e43308dad4df7c9fefd00c4250cd637e2f72 alongside #2681 at 499738640791. This head reports an invalid GUID from a disabled row. Integration candidate a6dd26db4ea5 applies luckyteagirl’s comment handling from #2681 before this PR’s active-row validation. On python -B scripts/gen_gdk_table.py <synthetic-table>, the candidate preserved the source URL, slot order and exact generated bytes after I inserted disabled entries. A malformed active class and a malformed active interface each produced a field-specific diagnostic and left the output unchanged.

python -B -m unittest discover -s scripts -p "test_*.py" passed all 27 tests on the integration commit. Windows build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) wrote and ran the synthetic tests. Codex prepared the integration and added the interface fixture. The Windows GDK library and Rust runtime were outside this run.

**@⁠RavenCurseBurg** on GitHub · 2026-11-26 09:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/2724#issuecomment-7188439687) · edited 2026-11-26 09:57 UTC I tested `aae8e43308dad4df7c9fefd00c4250cd637e2f72` alongside #2681 at `499738640791`. This head reports an invalid GUID from a disabled row. Integration candidate [a6dd26db4ea5](https://github.com/RavenCurseBurg/xcl/commit/a6dd26db4ea579c66adbaef9e0d73eb7c5699133) applies luckyteagirl’s comment handling from #2681 before this PR’s active-row validation. On `python -B scripts/gen_gdk_table.py <synthetic-table>`, the candidate preserved the source URL, slot order and exact generated bytes after I inserted disabled entries. A malformed active class and a malformed active interface each produced a field-specific diagnostic and left the output unchanged. `python -B -m unittest discover -s scripts -p "test_*.py"` passed all 27 tests on the integration commit. Windows build 26100, Core i7-13700, Python 3.14.3. OpenAI Codex (GPT-6) wrote and ran the synthetic tests. Codex prepared the integration and added the interface fixture. The Windows GDK library and Rust runtime were outside this run.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2724/head:github-bot/gh-2724'
git switch 'github-bot/gh-2724'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2724'
git switch 'github-bot/gh-2724'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2724'
git switch 'github-bot/gh-2724'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2724'
git switch 'main'
git merge --squash 'github-bot/gh-2724'
git switch 'main'
git merge --ff-only 'github-bot/gh-2724'
git switch 'main'
git merge 'github-bot/gh-2724'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.