The four plugins that already ship in the box declare who they are #98
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Depends on
Reference
Postulo/postulo#98
Loading…
Add table
Add a link
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?
Observation
The first half, and the easy half. #97 says every plugin declares a short name, a full name,
an author, a version, a description and a source link. The plugins Postulo ships must be the
first to do it, or the requirement is one this project asks of other people and not of
itself.
There are four, not two
Easy to miscount, because they are registered in three different places:
SchemaOrgSourceplugins/builtin.py->BUILTIN_SOURCESPageMetadataSourceplugins/builtin.py->BUILTIN_SOURCESEmailNotifiernotifications/apps.py->register_builtinLocalStoredocuments/apps.py->register_builtinBetween them they declare
name,version, and -- for the two connected ones --kindandlabel. That is the whole of it:No full name, no description, no author, no source link.
version = "1.0"has meant 1.0since it was written and will go on meaning 1.0 through every change to the parser, so it
identifies nothing -- which matters, because
base.pysays the source name is "recordedagainst every capture this source produced" and the version is "so a capture can be traced
to the code that made it". It cannot be traced to anything.
What they should say
Author: this project. Licence: AGPL-3.0-or-later. Source link: this repository. Version:
Postulo's own, because that is the truth -- these ship with the application and change
when it does. A built-in claiming an independent version number is inventing a fact.
EmailNotifier's own docstring already argues for exactly this:The one thing that is not a rename
nameis written into every capture'ssourcefield. Changingschema.orgorpage-metadataorphans the history of every capture anybody has made. Raised in #97 andrepeated here because this is the issue where somebody would be tempted to do it in passing:
if the identifiers change, a data migration comes with them.
Scope
postulo.__version__rather than a literal.fifth built-in added later cannot skip it.
Classification
Enhancement. Small, and blocked only by #97 settling what the fields are.
Done in
81c894b, built around your suggestion: the facts live in one manifest rather than one attribute each.Your instinct was right for a reason the issue had not spotted. A loose attribute per fact can never be made required —
runtime_checkableprotocols check data members, andregistry.pydrops anything failingisinstance, so addinglabeltoSourcePluginwould silently unload every source anybody has already written. That is why #97 leftlabelanddescriptionoptional and read them through helpers, and it does not scale: every new fact is a new optional attribute for every plugin author to learn about. One optional attribute carrying any number of facts has neither problem, and a field added later costs a plugin that has not heard of it nothing.@declaresalso setsname,version,kind,labelanddescriptionon the class from the manifest, so the identifier the registry keys on and the one in the manifest cannot disagree — the day they do is the day a capture is filed against a plugin that does not exist. All of it is optional; a plugin that declares nothing still loads and shows its identifier where a name goes.manifest_of()looks in three places, earlier winning: the manifest, the loose attributes, and the wheel the plugin was installed from. That third one is what makes "one place to look" true rather than aspirational — a third-party plugin that never heard of manifests still has an author and a licence in its packaging, and #97 already taught Postulo to read them.label_ofanddescription_ofsurvive as shorthands over it, so no call site had to change.Two corrections to the issue.
There are six built-ins, not four — it was written before Europass (#99) and SMTP (#104) landed. The test walks
registry.builtins()rather than naming them, which is the point: a seventh cannot skip the declaration, and miscounting by hand is exactly what happened here. There is a second test asserting the set of six, so losing one to a bad import is a failure rather than a quiet absence.And the identity is now shown, which the scope did not ask for but #97's whole complaint required: Server settings → Plugins prints version, author, licence and a Source link for every plugin, built-in or installed, on one line. Declaring facts nothing renders would have been the same bug in a new place. The mail transport is the one plugin that page does not list — transports are not governed per person (#104) — so the same line went on the Email page beside it.
logois in the manifest with nothing rendering it. Deliberate: that is #106's work, and having the slot means #106 becomes "ship the mark and point at it" rather than "invent somewhere to put it".The identifiers did not move.
schema.organdpage-metadataare in thesourcefield of every capture anybody has made; a test pins them, in the file somebody would be editing when they were tempted.docs/PLUGINS.md's Saying who you are is rewritten around the manifest, including why none of it can be required. 10 tests intests/test_plugin_manifests.py; 4 new strings, translated into all 24 catalogues and flaggeddraft.