Skip to content

test: pin the hex redaction outside operand positions in a refusal reason - #1993

Merged
R0Y00 merged 1 commit into
R0Y00:mainfrom
ChazY11:test/pin-refusal-hex-redaction
Nov 24, 2026
Merged

R0Y00 merged 1 commit into
R0Y00:mainfrom
ChazY11:test/pin-refusal-hex-redaction

Conversation

@ChazY11

@ChazY11 ChazY11 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What

normalize_refusal in tools/startup/gfx2hlsl.py redacts a bare 0x… literal with the generic rule at line 2130:

reason = re.sub(r'(?<!\w)[+-]?0x[0-9a-f]+\b', 'N', reason, flags=re.IGNORECASE)

The operand-position rule that follows (2132–2133) only covers labelled positions such as offset 0x10 or dmask:0xf, so a literal
in free text is covered only by the generic line. The check added by #1978 never feeds such a reason, so removing that line leaves
the suite green:

# tools/startup/gfx2hlsl.py: delete the line above
out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_refusals_check.py    # exit 0 before this change

Change

Two rows in the existing table in check_normalization(), one for a literal in prose and one for a NaN pattern:

('word_0xdeadbeef', 'word_N'),
# A bare literal outside an operand position: the operand rule above does not reach it.
('v_mov_b32 with literal 0x3f800000', 'v_mov_b32 with literal N'),
('unexpected value 0x7fc00000 in source', 'unexpected value N in source')):

tests/startup_gfx2hlsl_refusals_check.py only. No production change, no new file, no CMake change.

Why it matters

Two properties of a census key are at stake, and both are stated in that function's own comment:

  • a report that people paste into an issue should not carry input-derived values, and a literal like 0x7fc00000 is exactly that;
  • two refusals that differ only in a literal must collapse to one site, or the count is inflated — the overcount this diagnostic
    exists to reduce.

Tested

out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_refusals_check.py    # exit 0
out/pe-env/Scripts/python.exe -B tests/startup_translator_check.py           # exit 0

Fail-first, with the redaction line removed and restored:

normalization of v_mov_b32 with literal N: MISMATCH
normalization of unexpected value N in source: MISMATCH
exit 1

and with the line back, exit 0.

Notes

  • AI-assisted.

…ason

normalize_refusal redacts a bare 0x literal with the generic rule at line
2130; the operand rule that follows only covers positions such as offset 0x10.
Removing the generic rule left the suite green, so the case it exists for was
unpinned.
@R0Y00
R0Y00 merged commit e893cba into R0Y00:main Nov 24, 2026
5 checks passed

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of head 46303c0a114be4fa6de3598fc923eea5b71c7062.

Change: adds two normalization cases to tests/startup_gfx2hlsl_refusals_check.py (bare hex literal outside an operand position, redacted to N). Test-only, one file, no CMake change, no new dependency. Clean-room: only synthetic strings.

Commands executed locally:

  • git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts
  • python3 tests/startup_gfx2hlsl_refusals_check.py: PASS (both new cases ok)
  • python3 tests/docs_links_check.py: PASS (18 files, 388 links)
  • python3 tests/bidi_controls_check.py: PASS (1382 files)
  • git diff --check origin/main...HEAD: clean
  • Win2025 (Build 26100, MSVC 14.44, WARP), full build: Debug --preset dev ctest ^startup_gfx2hlsl_refusals$ 1/1 passed; Release /O2 1/1 passed
  • CI: Windows, Linux Python checks, gfx1013 fixtures all pass

Mutation check (in tools/startup/gfx2hlsl.py, reverted afterwards):

  • Disabling the bare-hex rule in normalize_refusal (0x[0-9a-f]+ -> 0xZ[0-9a-f]+): KILLED. Both new cases report MISMATCH.
  • Dropping the (?<!\w) lookbehind: survives. Not covered by this PR's cases; not a blocker.

P1: 0. P2: 0.

AI-assisted; commands listed were executed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants