Build the inbound-library core: store, IMAP intake, registries, notices.

ILIB-WP-0002-T01..T06: append-only item store, read-only IMAP intake with
quarantine, file-backed registries, idempotent hub/pull/digest notices,
run-due with health and the systemd user timer. 14 tests pass. Registers
the intelligence topics and the intelligence-radar subscription.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 1170398@bnt-lap001
Assistant-Session: 622cd705-cb31-4322-ba08-dd42e44fa583
This commit is contained in:
tegwick 2026-10-05 11:21:13 +02:00
parent fe84482730
commit d05d6ed35b
18 changed files with 1168 additions and 6 deletions

View file

@ -29,7 +29,7 @@ Python 3.11+ standard library only. The first consumer is intelligence-radar
```task
id: ILIB-WP-0002-T01
status: todo
status: done
priority: high
state_hub_task_id: "36f19bb9-045f-59fd-9b7c-509cb7dd00f8"
```
@ -43,11 +43,13 @@ with schema versions. Record the install, test and run commands in AGENTS.md
Acceptance: `make check` runs the unit tests on synthetic fixtures. The contracts
document every field that a consumer may rely on.
Done 2026-10-05: package `inbound_library`, CLI, Makefile, `docs/data-contracts.md` and the AGENTS.md commands are in place. `data/` is gitignored because mail can be private.
## Append-only item store
```task
id: ILIB-WP-0002-T02
status: todo
status: done
priority: high
state_hub_task_id: "4bbe176a-b210-5c20-9510-c90029bf2425"
```
@ -61,11 +63,13 @@ never delete. Items without provenance go to quarantine.
Acceptance: the tests prove there is no overwrite, that deduplication works,
that tampering is detected and that quarantine routing works.
Done 2026-10-05: `store.py` is in place. Tests cover no-overwrite, deduplication, tamper detection and quarantine.
## Read-only IMAP intake
```task
id: ILIB-WP-0002-T03
status: todo
status: done
priority: high
state_hub_task_id: "dd06da59-5773-53fa-aba3-dc79dff23c28"
```
@ -81,11 +85,13 @@ read-only IMAP approach of email-connect EMAIL-WP-0002 where that helps.
Acceptance: the tests run against a fixture mailbox. A live run is part of T07.
Done 2026-10-05: `intake.py` is in place. It selects read-only with BODY.PEEK[] and keeps a UIDVALIDITY/UID cursor. UIDs are left out of delivery records so rescans do not duplicate. Attachments are retained as items. Unknown senders are quarantined and re-routed (`requeue_quarantine`) once a source is registered. The tests use a fixture mailbox.
## File-backed registries
```task
id: ILIB-WP-0002-T04
status: todo
status: done
priority: high
state_hub_task_id: "4a2cbba2-55d8-5a0e-bd23-74dbfdb7ae61"
```
@ -101,11 +107,13 @@ other repos.
Acceptance: `check` rejects invalid registries. A source registered by repo A
is matched for repo B through a shared topic.
Done 2026-10-05: `registry.py` validates topics, sources and subscriptions, including the restricted-source leak check. A test shows a source from repo A matched for repo B through a shared topic.
## Matching and notification
```task
id: ILIB-WP-0002-T05
status: todo
status: done
priority: high
state_hub_task_id: "5da65f55-7608-55b6-9378-7bef3ea8e4ca"
```
@ -122,11 +130,13 @@ hub is unreachable, keep the notice pending and retry on the next run.
Acceptance: the tests prove idempotent delivery and recovery when the hub is
unreachable.
Done 2026-10-05: `notify.py` is in place. Notices are deterministic. Hub messages give a pull command that works from any repo. Tests cover the `new`/`show`/`get` commands, digest files, idempotent delivery and a hub outage that stays pending.
## Scheduling, health and source silence
```task
id: ILIB-WP-0002-T06
status: todo
status: done
priority: medium
state_hub_task_id: "01144f1e-b3ea-50b6-bf7c-32e9a29d7213"
```
@ -142,6 +152,8 @@ Health reports:
Acceptance: a silent source is reported, and repeated timer wakes are safe.
Done 2026-10-05: `run-due` runs under a lock. The systemd units are in `ops/systemd/`, and the service reads `~/.config/inbound-library/imap.env`. Tests cover `health`, including silent-source detection. 14 tests pass.
## Provision the dedicated mailbox
```task