Change feed with named Consumers and ack #8

Closed
opened 2026-11-01 01:59:25 +00:00 by svc-agent-writer · 3 comments

Parent: #1. Records: ADR 0002 §(change feed), GLOSSARY.md Consumer.

What to build

  • people_changes(consumer, limit) returns person-level events add, update, merge, del after the Consumer's position, as pipe rows with the standard footer. interaction is reserved for Phase B and never emitted.
  • people_changes_ack(consumer, cursor) advances the position. The api process writes Consumer positions and nothing else in the store.
  • Consumers are named in config. An unknown Consumer is refused.

Acceptance criteria

  • A named Consumer sees add, update, merge, acks, and sees nothing twice.
  • Two Consumers hold independent positions.
  • A merge emits one merge event naming survivor and loser; a Forget emits del with no Handle in the row.
  • An unacked read returns the same page again.

Blocked by

Filed under: operator word "go. compelling public-facing README.md as A0" sha256:3f9e946994fa

Parent: #1. Records: ADR 0002 §(change feed), GLOSSARY.md Consumer. ## What to build - `people_changes(consumer, limit)` returns person-level events `add`, `update`, `merge`, `del` after the Consumer's position, as pipe rows with the standard footer. `interaction` is reserved for Phase B and never emitted. - `people_changes_ack(consumer, cursor)` advances the position. The api process writes Consumer positions and nothing else in the store. - Consumers are named in config. An unknown Consumer is refused. ## Acceptance criteria - A named Consumer sees `add`, `update`, `merge`, acks, and sees nothing twice. - Two Consumers hold independent positions. - A merge emits one `merge` event naming survivor and loser; a Forget emits `del` with no Handle in the row. - An unacked read returns the same page again. ## Blocked by - #4 Filed under: operator word "go. compelling public-facing README.md as A0" sha256:3f9e946994fa
Collaborator

⏸ SVD architect gate: dev/peoplemind-mcp#8 change-feed-with-named-consumers-and-ack

Status: CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity substrate · dispatch effort high

Run: 20261101T081350Z-e3f9e822

Held because: CLEAN but 4 open risk(s) (2 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim:

Open risks:

  1. D1 'never backwards' semantics. The lean refuses a past-end ack (cursor-ahead). It treats an ack at or below the held position as a no-op that writes nothing and returns consumer | <held position>, so retries and racing runs are safe. test_write_token_reaches_read_tools relies on this through ack cursor "0". Question: accept the no-op, or refuse backwards acks with cursor-behind? Refusing would mean the TOOL_ARGS ack args change and the write-token dump comparison excludes consumers rows. [decision]
  2. D2 config shape and ack parameter name. The lean adds [feed] consumers = [...] with LABEL_PATTERN names, an empty default and duplicates refused. The ack parameter is named cursor, as in the issue, carrying the footer's ack_seq; ADR 0001 Amendment 1 calls it seq. Ack returns consumer | position. Question: accept [feed] consumers (rather than [api] consumers or [[consumers]] name=) and cursor, or align with mailmind's change-feed vocabulary once V1 is read? [decision]
  3. V1 mailmind's change feed was unreadable in this sandbox (/Users/piers/src/imap-mailmind-mcp: Operation not permitted), so the lean derives from ADR 0001 Amendment 1 and README:46 alone. Check at dispatch: search the read-only mailmind checkout's src/imap_mailmind_mcp/ for ack_seq and read its change-feed and ack implementation before writing feed.py and rows.feed_footer. Record in the PR body every divergence in footer order, empty-page ack_seq, backwards-ack handling and consumer config shape. The peoplemind Amendment 1 contract wins. Never write to that checkout. [verification]
  4. V2 the set_authorizer allow-list was prototyped only on Python 3.14.7 with SQLite 3.53.3, in a $TMPDIR scratch DB. Check: test_positions_connection_writes_only_consumers passes under uv run on the project interpreter (>=3.12). If the consumers upsert is refused there, add only the missing action code for table consumers and report it in the PR body. Never broaden the allow-list to other tables. [verification]

Change: 1. Add a FeedConfig [feed] consumers list after ApiConfig (config.py:78-92). Mirror unique_sources (config.py:132-137) and LABEL_PATTERN (config.py:63).
2. Add store.open_positions beside open_reader (store.py:119-137). It opens mode=rw with busy_timeout, refuses a behind or ahead schema and never migrates. A set_authorizer allow-list permits only SELECT/READ/FUNCTION/TRANSACTION plus INSERT/UPDATE on consumers. A prototype ran this session: other-table writes, PRAGMA writes, DDL and ATTACH were all refused.
3. Add rows.feed_footer(ack_seq, more) next to footer (rows.py:29-30).
4. Create feed.py:

  • changes(): refuses an unknown consumer, reads seq > position limited to limit+1, returns seq | kind | person_id | other_id | at rows and an ack_seq=N more=bool footer, and never writes.
  • ack(): runs parse_cursor, then BEGIN IMMEDIATE. It refuses a cursor past MAX(seq) with cursor-ahead. It upserts only when the cursor is ahead of the position, and otherwise writes nothing. It returns consumer | position.
  1. Mount people_changes and people_changes_ack in server.py with the existing require_scopes(SCOPE_READ) plus _render stack (server.py:66-138). Add a _positions helper mirroring _read (server.py:40-46). _render at server.py:56 skips ack_seq= footer lines when counting rows.
  2. Tests:
    • conftest: make_config gains a consumers override; seeded_store uses consumers ["grok","batch"].
    • test_server: TOOL_ARGS goes from six tools to eight, with ack cursor "0" as a no-op.
    • New test_feed.py over real localhost HTTP.
  3. Add the [feed] key to the README quick-start config.
    graph.py already emits every event and is untouched. There is no schema change.

Files: src/peoplemind_mcp/config.py · src/peoplemind_mcp/store.py · src/peoplemind_mcp/rows.py · src/peoplemind_mcp/feed.py · src/peoplemind_mcp/server.py · tests/conftest.py · tests/test_server.py · tests/test_feed.py · README.md

Decision: accept the 4 open risk(s) above and dispatch this spec (svd:go), or park (svd:skip) / re-spec (svd:respec)?

Your call (when this issue is held at the gate via svd:hold):

  • add label svd:go — approve; Half-B dispatch accepts exactly this spec (open risks accepted)
  • add label svd:fire beside svd:go — approve AND authorise the Half-B fire from the phone; never on its own
  • add label svd:skip — park it; dispatch refuses it and the issue stays for a human
  • add label svd:respec — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context

Spec: /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-change-feed-with-named-consumers-and-ack.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-change-feed-with-named-consumers-and-ack.md

### ⏸ SVD architect gate: dev/peoplemind-mcp#8 change-feed-with-named-consumers-and-ack **Status:** CLEAN after 0 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity `substrate` · dispatch effort `high` **Run:** `20261101T081350Z-e3f9e822` **Held because:** CLEAN but 4 open risk(s) (2 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. D1 'never backwards' semantics. The lean refuses a past-end ack (cursor-ahead). It treats an ack at or below the held position as a no-op that writes nothing and returns `consumer | <held position>`, so retries and racing runs are safe. test_write_token_reaches_read_tools relies on this through ack cursor "0". Question: accept the no-op, or refuse backwards acks with `cursor-behind`? Refusing would mean the TOOL_ARGS ack args change and the write-token dump comparison excludes consumers rows. [decision] 2. D2 config shape and ack parameter name. The lean adds `[feed] consumers = [...]` with LABEL_PATTERN names, an empty default and duplicates refused. The ack parameter is named `cursor`, as in the issue, carrying the footer's ack_seq; ADR 0001 Amendment 1 calls it `seq`. Ack returns `consumer | position`. Question: accept `[feed] consumers` (rather than `[api] consumers` or `[[consumers]] name=`) and `cursor`, or align with mailmind's change-feed vocabulary once V1 is read? [decision] 3. V1 mailmind's change feed was unreadable in this sandbox (/Users/piers/src/imap-mailmind-mcp: Operation not permitted), so the lean derives from ADR 0001 Amendment 1 and README:46 alone. Check at dispatch: search the read-only mailmind checkout's src/imap_mailmind_mcp/ for `ack_seq` and read its change-feed and ack implementation before writing feed.py and rows.feed_footer. Record in the PR body every divergence in footer order, empty-page ack_seq, backwards-ack handling and consumer config shape. The peoplemind Amendment 1 contract wins. Never write to that checkout. [verification] 4. V2 the set_authorizer allow-list was prototyped only on Python 3.14.7 with SQLite 3.53.3, in a $TMPDIR scratch DB. Check: test_positions_connection_writes_only_consumers passes under `uv run` on the project interpreter (>=3.12). If the consumers upsert is refused there, add only the missing action code for table `consumers` and report it in the PR body. Never broaden the allow-list to other tables. [verification] **Change:** 1. Add a FeedConfig `[feed] consumers` list after ApiConfig (config.py:78-92). Mirror unique_sources (config.py:132-137) and LABEL_PATTERN (config.py:63). 2. Add store.open_positions beside open_reader (store.py:119-137). It opens `mode=rw` with busy_timeout, refuses a behind or ahead schema and never migrates. A set_authorizer allow-list permits only SELECT/READ/FUNCTION/TRANSACTION plus INSERT/UPDATE on `consumers`. A prototype ran this session: other-table writes, PRAGMA writes, DDL and ATTACH were all refused. 3. Add rows.feed_footer(ack_seq, more) next to footer (rows.py:29-30). 4. Create feed.py: - changes(): refuses an unknown consumer, reads seq > position limited to limit+1, returns `seq | kind | person_id | other_id | at` rows and an `ack_seq=N more=bool` footer, and never writes. - ack(): runs parse_cursor, then BEGIN IMMEDIATE. It refuses a cursor past MAX(seq) with `cursor-ahead`. It upserts only when the cursor is ahead of the position, and otherwise writes nothing. It returns `consumer | position`. 5. Mount people_changes and people_changes_ack in server.py with the existing `require_scopes(SCOPE_READ)` plus `_render` stack (server.py:66-138). Add a `_positions` helper mirroring `_read` (server.py:40-46). `_render` at server.py:56 skips `ack_seq=` footer lines when counting rows. 6. Tests: - conftest: make_config gains a `consumers` override; seeded_store uses consumers ["grok","batch"]. - test_server: TOOL_ARGS goes from six tools to eight, with ack cursor "0" as a no-op. - New test_feed.py over real localhost HTTP. 7. Add the `[feed]` key to the README quick-start config. graph.py already emits every event and is untouched. There is no schema change. **Files:** `src/peoplemind_mcp/config.py` · `src/peoplemind_mcp/store.py` · `src/peoplemind_mcp/rows.py` · `src/peoplemind_mcp/feed.py` · `src/peoplemind_mcp/server.py` · `tests/conftest.py` · `tests/test_server.py` · `tests/test_feed.py` · `README.md` **Decision:** accept the 4 open risk(s) above and dispatch this spec (`svd:go`), or park (`svd:skip`) / re-spec (`svd:respec`)? **Your call** (when this issue is held at the gate via `svd:hold`): - add label `svd:go` — approve; Half-B dispatch accepts exactly this spec (open risks accepted) - add label `svd:fire` **beside** `svd:go` — approve AND authorise the Half-B fire from the phone; never on its own - add label `svd:skip` — park it; dispatch refuses it and the issue stays for a human - add label `svd:respec` — discard this spec; the next Half-A run re-produces it with this record as prior-attempt context <sub>Spec: `/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-change-feed-with-named-consumers-and-ack.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-01-change-feed-with-named-consumers-and-ack.md`</sub>
Owner

Architect gate: CLEAN, rulings recorded, released for dispatch

Spec 2026-11-01-change-feed-with-named-consumers-and-ack.md (Half-A run 20261101T081350Z-e3f9e822, batch faebc8b77de84e938c3fd543da6ddf33 with #14). The rulings are appended to the spec under ## Agent Adjustments.

  1. D1: no-op on a backwards ack. An ack at or below the held position writes nothing and returns the held position. A seq past the end is refused. This matches ADR 0001 Amendment 1 and mailmind's mail_wakes_ack.
  2. D2: [feed] consumers = [...] accepted. The ack parameter is seq: int, not cursor: str. ADR 0001 Amendment 1 and mailmind's mail_wakes_ack(consumer, seq) both name it seq. The ack row is <consumer> | <ack_seq>.
  3. V1 resolved at the gate. Mailmind's feed vocabulary was read on the architect host and recorded in the spec, so dispatch does not need the mailmind checkout.
  4. V2 kept. The set_authorizer allow-list test runs under uv run (Python 3.14.5, SQLite 3.50.4 on the architect host). Never widen the allow-list.

Riders: pytest only as uv run python3 -m pytest … --basetemp "$(mktemp -d "${TMPDIR:-/var/tmp}/svd.XXXXXX")/x"; no nested .git; baseline on pristine dffd39d first; pyproject.toml stays untouched; the sibling unit's files (#14: sync.py, sources/carddav.py, their tests) stay untouched.

Write set: 9 files, under the 16-file ceiling. Disjoint from #14.

Operator: paste svd:go to release Half-B. Dispatch runs as codex-svd dispatch-batch with CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000.

## Architect gate: CLEAN, rulings recorded, released for dispatch Spec `2026-11-01-change-feed-with-named-consumers-and-ack.md` (Half-A run `20261101T081350Z-e3f9e822`, batch `faebc8b77de84e938c3fd543da6ddf33` with #14). The rulings are appended to the spec under `## Agent Adjustments`. 1. **D1: no-op on a backwards ack.** An ack at or below the held position writes nothing and returns the held position. A seq past the end is refused. This matches ADR 0001 Amendment 1 and mailmind's `mail_wakes_ack`. 2. **D2: `[feed] consumers = [...]` accepted. The ack parameter is `seq: int`, not `cursor: str`.** ADR 0001 Amendment 1 and mailmind's `mail_wakes_ack(consumer, seq)` both name it `seq`. The ack row is `<consumer> | <ack_seq>`. 3. **V1 resolved at the gate.** Mailmind's feed vocabulary was read on the architect host and recorded in the spec, so dispatch does not need the mailmind checkout. 4. **V2 kept.** The `set_authorizer` allow-list test runs under `uv run` (Python 3.14.5, SQLite 3.50.4 on the architect host). Never widen the allow-list. Riders: pytest only as `uv run python3 -m pytest … --basetemp "$(mktemp -d "${TMPDIR:-/var/tmp}/svd.XXXXXX")/x"`; no nested `.git`; baseline on pristine `dffd39d` first; `pyproject.toml` stays untouched; the sibling unit's files (#14: `sync.py`, `sources/carddav.py`, their tests) stay untouched. Write set: 9 files, under the 16-file ceiling. Disjoint from #14. Operator: paste `svd:go` to release Half-B. Dispatch runs as `codex-svd dispatch-batch` with `CODEX_SVD_STAGE_TIMEOUT_SECONDS=9000`.
Collaborator

spec-verify-dispatch Half B for dev/peoplemind-mcp#8 change-feed-with-named-consumers-and-ack completed integration verify.

  • PR: dev/peoplemind-mcp#19
  • Branch: feat/svd-dev-peoplemind-mcp-8-change-feed-with-named-consumer-46c82a6e
  • Commit: efa70db446
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check commit statuses on PR head efa70db: absent
  • Checks: PR #19 head efa70db: no CI statuses (absent). Local: 164 passed, 3 skipped; mypy and ruff clean.
  • Warning: No remote CI statuses exist on the PR head, so remote CI gave no integration evidence.
  • Warning: Bare python3 -m pytest lacks phonenumbers outside uv. I ran collection and tests under uv run, which provisions the dependencies.
  • Warning: no CI for commit statuses on PR head efa70db: Forgejo returned an empty statuses list for the PR head; no CI context has ever reported. No tracking pointer found. — reported as absent, not blocking (gh#633)
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261101T084721Z-46c82a6e --confirm-merge)
spec-verify-dispatch Half B for dev/peoplemind-mcp#8 change-feed-with-named-consumers-and-ack completed integration verify. - PR: https://git.groupthink.asia/dev/peoplemind-mcp/pulls/19 - Branch: feat/svd-dev-peoplemind-mcp-8-change-feed-with-named-consumer-46c82a6e - Commit: efa70db4468da9bfa337d9f4b38cb2fb34b5a381 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check commit statuses on PR head efa70db: absent - Checks: PR #19 head efa70db: no CI statuses (absent). Local: 164 passed, 3 skipped; mypy and ruff clean. - Warning: No remote CI statuses exist on the PR head, so remote CI gave no integration evidence. - Warning: Bare `python3 -m pytest` lacks phonenumbers outside uv. I ran collection and tests under `uv run`, which provisions the dependencies. - Warning: no CI for commit statuses on PR head efa70db: Forgejo returned an empty statuses list for the PR head; no CI context has ever reported. No tracking pointer found. — reported as absent, not blocking (gh#633) - Decision: review the PR and merge? (`codex-svd ship --run-id 20261101T084721Z-46c82a6e --confirm-merge`)
piers closed this issue 2026-11-01 09:40:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
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
dev/people-mind-mcp#8
No description provided.