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
This pull request can be merged automatically.
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.