Plugin policy: the 'switched off for the instance' step compares a plugin's name with package names #596
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#596
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, readingplugins/policy.pyagainst the plugins record.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atplugins/policy.py:109-115(_switched_off_for_the_instance), called atplugins/policy.py:175in_decide;disabled_namesmoved toplugins/record.py:208-210(#248) and is still imported throughplugins/installing.py. The registry's filter and the test attests/test_plugin_policy.py:100are where they were.Step 1 of the order the
policymodule documents ("Switched off for the instance") is implemented by_switched_off_for_the_instance, which checkscanonicalise(name) in disabled_names().decide()is asked about plugin names (imap,apprise), butdisabled_names()holds the record's distribution names (postulo-imap,postulo-apprise). For every official plugin the step can never match. Nothing breaks today, because the registry already leaves out every plugin from a disabled distribution, and every caller ofdecide()asks about a plugin it found in the registry. Still, the guard the docstring promises is not the one doing the work, and the test that covers it passes only because it uses one string for both names.plugins/policy.py:104-110(_switched_off_for_the_instance), called atplugins/policy.py:184in_decide;plugins/installing.py:316-318(disabled_names, built fromentry.name, the distribution name); the filter that really applies is inplugins/registry.py(_disabledand_distribution_of, which compare entry-point distributions); testtests/test_plugin_policy.py:100(test_switched_off_for_the_instance_beats_everything) writes a record line named"schema.org"and asksdecide("schema.org", …).postulo-imapdisabled,policy._decide("imap", person)skips step 1 and goes on to the policy rows. The answer comes out right today only because a disabled plugin never reachesdecide(). A future caller that asks about a plugin by a stored name (aConnectionrow'splugin, for example) would get "available" for a plugin the administrator switched off. The opposite also holds: a plugin whose name happens to equal a disabled package's canonical name is reported "Switched off for this whole instance" though it is loaded.Done when
tests/test_plugin_policy.pydisables a record line namedpostulo-examplethat provides a plugin namedexample, and asserts thatdecide("example", person)answersdecided_by == "instance"(if the step is kept), or the step is removed along with the docstring's claim and the test is rewritten to show the registry hiding the plugin.Landed on main with a green Forgejo CI run. Its entry in the CHANGELOG's Unreleased section ends in (#596).