Move onto the plugin surface: the records, the services and the calendar text are on it now #4

Closed
opened 2026-09-21 15:20:18 +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

Every # #229 marker in src/postulo_dav/sync.py goes, and the import block with it:

Reached past for Now on the surface as
postulo.applications.models Interview, InterviewOutcome
postulo.applications.services get_or_create_company, record_event, reschedule_interview, settle_interview
postulo.jobs.models Contact
postulo.plugins.models SyncLink
postulo.core.phone_numbers primary_phone_number, save_phone_number, phone_number_is_taken
postulo.core.web_links primary_web_link, save_web_link, LinkKind
postulo.applications.ical event_lines, calendar_status

event_text gets shorter. ical.escape and ical.STATUS_OF are deliberately not on
the surface: event_lines(interview, alarm=True) now writes the reminder as a VALARM
itself, so the hand-assembled alarm block goes, and calendar_status(interview) answers
what STATUS_OF[interview.outcome] answered — without this plugin keeping a private copy
of a table that goes stale the day a fifth outcome is added.

Also

  • Pin the core to 1d6cdd7e0 or later; the names do not exist before it.
  • This repository has no surface check at all. Add one.

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_dav", package="postulo_dav"
    )

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 Every `# #229` marker in `src/postulo_dav/sync.py` goes, and the import block with it: | Reached past for | Now on the surface as | | --- | --- | | `postulo.applications.models` | `Interview`, `InterviewOutcome` | | `postulo.applications.services` | `get_or_create_company`, `record_event`, `reschedule_interview`, `settle_interview` | | `postulo.jobs.models` | `Contact` | | `postulo.plugins.models` | `SyncLink` | | `postulo.core.phone_numbers` | `primary_phone_number`, `save_phone_number`, `phone_number_is_taken` | | `postulo.core.web_links` | `primary_web_link`, `save_web_link`, `LinkKind` | | `postulo.applications.ical` | `event_lines`, `calendar_status` | **`event_text` gets shorter.** `ical.escape` and `ical.STATUS_OF` are deliberately not on the surface: `event_lines(interview, alarm=True)` now writes the reminder as a `VALARM` itself, so the hand-assembled alarm block goes, and `calendar_status(interview)` answers what `STATUS_OF[interview.outcome]` answered — without this plugin keeping a private copy of a table that goes stale the day a fifth outcome is added. ## Also - Pin the core to `1d6cdd7e0` or later; the names do not exist before it. - This repository has no surface check at all. Add one. ## 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_dav", package="postulo_dav" ) ``` 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-dav#4
No description provided.