You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: key the is_manufactured() exemption on the name shape, not on two file paths #879
Follow-up from #878's review. That PR exempts two files from test_const_enum_no_mint.py's is_manufactured() sweep so the preserved hex-suffixed names pass:
HEX_SUFFIXED_NAME_EXEMPT_PATHS=frozenset({...}) # :1160, consulted at :1290
The exemption is keyed on file path, so it is shape-blind inside those two files. Measured — mutating one branch in a scratch copy of f210ddc71, asserting the line's content first:
'Xyplex_%d' % value is exactly the value-derived shape the predicate exists to flag, and the sweep passes because exempt_hits stays at 53.
Not a defect in #878, and deliberately not blocked on there: all 53 exempted sites share one identical suffix expression, 0 manufactured names outside those two files are exempted, and the harm is_manufactured() names — a __members__ collision between minted members — cannot occur at all now, because _unregistered_member is three statements that touch neither _member_map_ nor _value2member_map_. So the widened area is structurally unable to cause the defect.
The fix: key the exemption on the name-expression shape (… _0x%s' % hex(value)[2:].upper().zfill(4)) rather than on two paths. That needs no path list, covers exactly the 53 intended sites, and would fail the mutant above. Keep assertEqual(exempt_hits, 53) as the bound either way.
Worth doing while the reasoning is fresh; it is a test-only change.
PR is up: #881 — #881, head df62008ce, one commit, one file.
Stacked on #878 (base fix/775-ethertype-socket-no-mint), since the code this guards exists only there; GitHub retargets it to main once #878 merges, and it must not merge first.
HEX_SUFFIXED_NAME_EXEMPT_PATHS is gone. The exemption now matches the name-expression shape by AST structural comparison against hex(value)[2:].upper().zfill(4), which hits exactly the 53 intended sites — every one shares that suffix verbatim, and no other call site in pcapkit/const/ contains 0x%s at all.
I verified the fix rather than taking the report: mutating const/reg/ethertype.py:540 to 'Xyplex_%d' % value — the mutation that passed before — now fails with AssertionError: 52 != 53 : expected exactly 53 hex-suffixed-name exemptions to fire, found 52. Unmutated the file is 69/0/0, and a value-derived name in an unrelated file (const/arp/hardware.py:163) is still flagged.
Activity
JarryShaw commentedon Sep 28, 2026
PR is up: #881 — #881, head
df62008ce, one commit, one file.Stacked on #878 (base
fix/775-ethertype-socket-no-mint), since the code this guards exists only there; GitHub retargets it tomainonce #878 merges, and it must not merge first.HEX_SUFFIXED_NAME_EXEMPT_PATHSis gone. The exemption now matches the name-expression shape by AST structural comparison againsthex(value)[2:].upper().zfill(4), which hits exactly the 53 intended sites — every one shares that suffix verbatim, and no other call site inpcapkit/const/contains0x%sat all.I verified the fix rather than taking the report: mutating
const/reg/ethertype.py:540to'Xyplex_%d' % value— the mutation that passed before — now fails withAssertionError: 52 != 53 : expected exactly 53 hex-suffixed-name exemptions to fire, found 52. Unmutated the file is 69/0/0, and a value-derived name in an unrelated file (const/arp/hardware.py:163) is still flagged.test(const): key the manufactured-name exemption on the name shape, n…
test(const): key the manufactured-name exemption on the name shape, n…