validation: declare the four codes RULES was missing, and check the surface against the source (#1654) #1662
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1662
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/1116-1205"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1654.
What was wrong.
test/property-validator.test.jsasserted that every codeconnect()returns is invalidation.RULES, butRULESis onlyvalidation.js's own table.E_BIDI_MISMATCHcomes frommedia.js/optical.js, so a legitimate refusal was reported as an unknown code. TheE_PORT_IN_USEexemption beside that check was the same bug, already papered over once. main went red at seed 65 because #1647's five new device specs re-rolled the seeded draw onto the BiDi pairing — the engine did not regress, the assertion was always too narrow. It passes again today only because #1657 re-rolled the draw a second time; the next device spec would move it back.Also found while fixing it. Four codes were emitted by
validation.jswith noRULESentry, so the UI had nothing to render and their severity came from theW_prefix fallback:E_OPTICAL_BUDGET,W_OPTICAL_HEADROOM,E_LINK_UNCHECKABLE,E_NOT_A_TOPOLOGY. Declared now (24 -> 28).Changes
engine/validation.js: the four missingRULESentries, with descriptions.test/validation.test.js: scansengine/validation.jsfor everycode: '...'it emits; fails on an undocumented code, on aRULESentry nothing emits, and on a severity that contradicts theW_/E_prefix.test/property-validator.test.js: the connect() surface isRULESplus the codes declared by the modulesvalidateLinkdelegates to (media.js,optical.js); theE_PORT_IN_USEexemption is gone; malformed codes are rejected; andE_BIDI_MISMATCHbeing on the surface is asserted deterministically instead of waiting for seed 65.docs/CONNECTORS.md: the two missing table rows, and the paragraph no longer claims three codes are outsideRULES.Gates
node --test test/validation.test.js— 22 passed, 0 failednode --test test/property-validator.test.js— 20 passed, 0 failednpm test— 278 suites, 9913 assertions, 0 failednode scripts/syntax-check.js— 348 files, all OKvalidation.test.jsassertion fail, naming exactly those four codes.33f8b433512b221f6f93