Let a connection's form offer what its service has, several chosen with a mode each (#332) #1089
No reviewers
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo!1089
Loading…
Reference in a new issue
No description provided.
Delete branch "332-connection-discovery"
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?
A connection's form was drawn from FieldSpecs whose choices were fixed when
config_fields() ran, so a plugin like DAV could not offer the address books,
calendars and task lists only the server knows about (postulo/postulo-dav#13).
modesand adiscoveredtype. DiscoveredOption (value,label, group, modes, note) is on postulo.plugins.api. A connected plugin may
have an optional
discover(config)that returns options keyed by field name."Look up", it posts the whole form to connections:discover, which works
without scripts. That view calls discover with the configuration as last
saved and draws the form back as it was typed. It never runs on page load
or on Save. It shares Test's allowance (POSTULO_CONNECTION_TEST_RATE), its
consent check and its error handling, now one helper used by both views,
and calls the server outside any transaction. A failure is shown in the
plugin's words and keeps what was found before.
"postulo:discovered", with when it was found. The field stores option value
to mode for the chosen options only.
grouped. Each option has one select labelled by its name, with "Not used"
first and then the modes that option allows. A chosen option that is no
longer found keeps its row and last label, marked "No longer on the
server", until it is set to Not used. validate() sees the choice.
type gets a disabled field with a sentence and stores nothing.
Tests: tests/test_connection_discovery.py, page coverage, the isolation
sweep and an accessibility walk of the form showing found options.
Closes #332
Notes for review
discovered(withFieldSpec.modes), for connections only, plusDiscoveredOptionon the plugin surface. A connected plugin may implementdiscover(config).discoverreturns (plugins/discovery.py): bad items and undeclared modes are dropped, duplicates kept once, at most 200 options of up to 500 characters. The result is kept in the connection'sconfig(postulo:discovered), so no migration.{value: mode}. An option that is no longer found stays visible, marked gone.connections:discover) that never saves. It shares the test button's guard: the same allowance (POSTULO_CONNECTION_TEST_RATE), the consent check, and errors in the plugin's words. It runs outside the request's transaction.requiredis ignored on a discovered field;validateproblems on it are form-wide.🤖 Generated with Claude Code
d08598980e39c4e9756039c4e9756046252480cf