test: pin the documented WL label form - #64
Merged
Merged
Conversation
docs/api.md states that generated blank-node labels are "b" followed by 12 hex digits, with an optional numeric collision suffix, and consumers match on that shape rather than merely checking that labels changed: linkml asserts this exact form in three separate modules to confirm its --diff-stable flag reached the serializer. Nothing here defended it. Widening the hash would have passed this suite, silently falsified the documentation, and broken linkml, with the canary as the first signal - an expensive way to learn we changed our own documented format. Add WL-LABEL-FORM with positive evidence for the base form and boundary evidence for the tie suffix. Also drop a parameter two naturalistic-document tests never used, and correct _reordered's docstring, which described the wrong ordering.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #63, from an adversarial review of it.
The gap
docs/api.md(lines 47 and 534) documents generated blank-node labels asbfollowed by 12 hex digits, with an optional numeric collision suffix.Consumers match on that shape rather than merely checking that labels changed -
linkml asserts this exact form in three separate modules to confirm its
--diff-stableflag actually reached the serializer:tests/linkml_runtime/test_utils/test_rdf_canonicalize.pytests/linkml/test_scripts/test_diff_stable.py.github/tests/test_diff_stable_install.pyNothing in this repository defended that form. The wl tests check injectivity,
stability, cardinality and tie-suffix ordering, but never the label shape. So
widening the hash to 16 hex digits would have passed all 1259 tests, silently
falsified the documentation, and broken linkml - with the canary from #61 as the
first signal. That works, but it is an expensive way to discover that we changed
our own documented format.
Change
WL-LABEL-FORMin the requirement catalog, with two tests intests/wl/test_wl_contracts.py:test_labels_have_the_documented_form- every label isb+ 12 hex digits,and an untied label is exactly 13 characters
test_tied_labels_share_one_base_and_add_numeric_suffixes- tied nodes shareone base and differ only by
_1,_2, with the reported labels matching whatwl_relabel_quadsactually emitsAlso
Two cleanups in #63's module, found in the same review: two tests took a
parse_formatparameter they never used (ruff's selected rulesE,F,W,Bdo notflag unused arguments), and
_reordered's docstring said "opposite order" whilethe helper sorts descending.
Verification
1261 passed (2 new), coverage 96.01% against the 95% gate,
check_requirements.pyverifies 50 supported requirements,check_standards.pyclean,ruff check src tests scriptsclean.No
src/change, so no behavior change, no emitted-byte change, and nochangelog entry or release.