Move onto the plugin surface: Application, Suggestion, suggest and Contact are on it now #2

Closed
opened 2026-09-21 15:20:19 +00:00 by tiagoagueda · 0 comments
Owner

The surface it was waiting for landed in the core (postulo/postulo#229, 1d6cdd7e0):
postulo.plugins.api now carries the notifier contract, the records a sync works on, the
calls that write to a timeline, the details that hang off a contact, and the calendar text.
The core also publishes the check itself as postulo.plugins.testing, so a plugin can
assert the same thing about its own source that Postulo asserts about the ones it ships.

What moves

REACHING_PAST in tests/test_surface.py has three entries and all three are answered:

Reached past for Now on the surface as
postulo.applications.models Application, Suggestion
postulo.applications.suggestions suggest
postulo.jobs.models Contact

sync.py and matching.py import them from postulo.plugins.api instead, and
REACHING_PAST goes empty — which is the point of it: the list was the map of what the
core still had to move, and there is nothing left on it.

EventKind is on the surface too, if the rules are naming event kinds as bare strings.

Also

  • Pin the core to 1d6cdd7e0 or later; the names do not exist before it.

Run the published check

Replace this repository's hand-written copy of the AST check with the core's:

from pathlib import Path

from postulo.plugins.testing import assert_imports_only_the_surface


def test_the_plugin_imports_only_the_surface():
    assert_imports_only_the_surface(
        Path(__file__).resolve().parents[1] / "src" / "postulo_imap", package="postulo_imap"
    )

One check rather than several near-copies that can drift apart, and it resolves relative
imports, which the copy here does not.

The surface it was waiting for landed in the core (postulo/postulo#229, `1d6cdd7e0`): `postulo.plugins.api` now carries the notifier contract, the records a sync works on, the calls that write to a timeline, the details that hang off a contact, and the calendar text. The core also publishes the check itself as `postulo.plugins.testing`, so a plugin can assert the same thing about its own source that Postulo asserts about the ones it ships. ## What moves `REACHING_PAST` in `tests/test_surface.py` has three entries and all three are answered: | Reached past for | Now on the surface as | | --- | --- | | `postulo.applications.models` | `Application`, `Suggestion` | | `postulo.applications.suggestions` | `suggest` | | `postulo.jobs.models` | `Contact` | `sync.py` and `matching.py` import them from `postulo.plugins.api` instead, and `REACHING_PAST` goes empty — which is the point of it: the list was the map of what the core still had to move, and there is nothing left on it. `EventKind` is on the surface too, if the rules are naming event kinds as bare strings. ## Also - Pin the core to `1d6cdd7e0` or later; the names do not exist before it. ## Run the published check Replace this repository's hand-written copy of the AST check with the core's: ```python from pathlib import Path from postulo.plugins.testing import assert_imports_only_the_surface def test_the_plugin_imports_only_the_surface(): assert_imports_only_the_surface( Path(__file__).resolve().parents[1] / "src" / "postulo_imap", package="postulo_imap" ) ``` One check rather than several near-copies that can drift apart, and it resolves relative imports, which the copy here does not.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Postulo/postulo-imap#2
No description provided.