Identifiers: the format error reads 'a ORCID identifier', and its code exists twice #645
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#645
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, runningcleanwith a malformed value for every shipped scheme and comparing the two identifier modules.Checked again on 2026-10-01 against
mainat0a5cad587: still present.accounts/identifiers.pyandjobs/identifiers.pyare unchanged;core/identifiers.pygained the rows' one-of-each-kind rule (#307) and still holds none of the four functions.The message for a malformed identifier puts the scheme's label after a fixed article and before the word "identifier". Several shipped labels do not fit that sentence. The sentence, and the four functions around it, exist in two modules that are the same code with
PERSONswapped forCOMPANY, although both module docstrings say the second copy of the machinery is gone.Where:
accounts/identifiers.py:81andjobs/identifiers.py:82(the message);accounts/identifiers.py:63-100andjobs/identifiers.py:65-101(normalise,validate,clean,url_for); the docstrings ataccounts/identifiers.py:12-16andjobs/identifiers.py:8-12.What happens: run against the snapshot, a value of the wrong shape gives:
A person meets the first five by mistyping an ORCID on Your details or an LEI on a company's form. Every catalogue translates the same frame, so a translator can move the label but cannot make it agree with an article or a case.
The four functions in the two modules compare equal once the subject constant is replaced (checked by comparing their syntax trees). A change to the message or to the order of the checks has to be made twice, and nothing fails when it is made once.
Why it matters: the sentence a person reads when they mistype their ORCID is ungrammatical, and the duplication is the kind the registry of #109 was written to remove. #311 lets an administrator define schemes with labels of their own, which will go through the same frame.
Fix: word the message so the label needs neither an article nor a trailing noun, for example
_("%(scheme)s: that is not the usual form (for example %(example)s)."), or giveSchemeaformat_messagebeside itschecksum_message. Movenormalise,validate,cleanandurl_forintocore/identifiers.pywith asubjectargument, and leave the two modules as the views they describe: each passesPERSONorCOMPANY.tests/test_identifiers.py:261asserts the words "does not look like a" and changes with the message. The reworded string changes one entry in every catalogue.Done when
tests/test_identifier_registry.pychecks, for every scheme in the registry and both subjects, that the format error contains neither "a " followed by the label nor the label followed by " identifier", and that it names the scheme and its example.accounts/identifiers.pyandjobs/identifiers.pyhold noValidationErrorof their own; a test intests/test_identifier_registry.pyasserts that both modules'validateraise the same message for the same malformed ISNI.