Apply queued Actions on peoplemind sync --once #123

Closed
opened 2026-11-05 12:00:37 +00:00 by svc-agent-writer · 2 comments

Outcome

peoplemind sync --once applies queued Actions, the same as the long-running sync process.

Context

  • #78 adds the outbox and its worker (graph.drain_actions, gate ruling 9 of the #78 spec). The worker runs only inside sync.run_forever (sync.py), because cli.py left the #78 write set to keep it within the 16-file scope ceiling.
  • cli._sync (cli.py:47-64) runs one source pass for sync --once and calls no drain. A manual sync --once therefore leaves Actions queued until the next long-running pass.
  • Both deployments run sync without --once (compose.yaml:5, deploy/k8s/base/deployment.yaml:59), so production is not affected.
  • Decided at the #78 architect gate, 2026-11-05 (spec open risk 10).

Scope

  • In cli._sync, call graph.drain_actions after the source passes, when cfg.auth has at least one write entry. Print the lines it returns.
  • With no write entry configured, sync --once output stays byte-identical.

Acceptance criteria

  • With a write token configured, an Action queued before peoplemind sync --once is applied after it, and the command prints one action=N kind=K state=S line for it.
  • With no write token configured, every existing sync --once output test passes unchanged.

Blocked by

## Outcome `peoplemind sync --once` applies queued Actions, the same as the long-running `sync` process. ## Context - #78 adds the outbox and its worker (`graph.drain_actions`, gate ruling 9 of the #78 spec). The worker runs only inside `sync.run_forever` (`sync.py`), because `cli.py` left the #78 write set to keep it within the 16-file scope ceiling. - `cli._sync` (`cli.py:47-64`) runs one source pass for `sync --once` and calls no drain. A manual `sync --once` therefore leaves Actions `queued` until the next long-running pass. - Both deployments run `sync` without `--once` (`compose.yaml:5`, `deploy/k8s/base/deployment.yaml:59`), so production is not affected. - Decided at the #78 architect gate, 2026-11-05 (spec open risk 10). ## Scope - In `cli._sync`, call `graph.drain_actions` after the source passes, when `cfg.auth` has at least one write entry. Print the lines it returns. - With no write entry configured, `sync --once` output stays byte-identical. ## Acceptance criteria - [ ] With a write token configured, an Action queued before `peoplemind sync --once` is `applied` after it, and the command prints one `action=N kind=K state=S` line for it. - [ ] With no write token configured, every existing `sync --once` output test passes unchanged. ## Blocked by - #78
Collaborator

⏸ SVD architect gate: dev/people-mind-mcp#123 apply-queued-actions-on-peoplemind-sync-once

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 standard · dispatch effort medium

Run: 20261105T202741Z-635439a2

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

Open risks:

  1. Should the sync --once drain run after the source passes, as the issue's Scope says, or before them, as run_forever's startup pass does (sync.py:722-724)? Lean: after. The issue was written from the #78 gate ruling, draining after lets the same run's embed refresh see applied merges and aliases, and it keeps the drain out of the test_mailpeer crash-harness window. Either placement meets both acceptance criteria. [decision]
  2. No test baseline was measured: the Half-A sandbox denied executing .venv/bin/python3. Check: on pristine base 3099b59, before the first edit, run uv run python3 -m pytest -m "not integration" tests/test_vcard_sync.py tests/test_config_cli.py tests/test_carddav.py tests/test_mailmind.py tests/test_mailpeer.py tests/test_embed.py tests/test_actions.py and record the failure set. After the change, assert the set is unchanged and that both new -k sync_once tests pass. make check must be green in CI. [verification]

Change: In cli._sync (src/people_mind_mcp/cli.py:47-64), after the source loop (ends line 58) and before sync.load_embedder (line 59), add the guarded drain mirroring sync.run_forever's startup drain at src/people_mind_mcp/sync.py:722-724: if cfg.auth and cfg.auth.write_entries(): for action_line in drain_actions(conn, cfg, salt, now=now()): print(action_line). Extend the name import at cli.py:19 with drain_actions. Add no try: StoreError/sqlite3.Error reach main's existing handlers (cli.py:149-154). Replace README.md:79's "sync --once does not drain them" clause. Add two CLI tests to tests/test_actions.py: one uses seeded_store (auth=True) plus the alias() helper and expects one action=N kind=link.alias state=applied line and state applied; one uses make_config() with no auth and expects no action= line and state queued.

Files: src/people_mind_mcp/cli.py · README.md · tests/test_actions.py

Decision: accept the 2 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-05-apply-queued-actions-on-peoplemind-sync-once.md — next: codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-05-apply-queued-actions-on-peoplemind-sync-once.md

### ⏸ SVD architect gate: dev/people-mind-mcp#123 apply-queued-actions-on-peoplemind-sync-once **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 `standard` · dispatch effort `medium` **Run:** `20261105T202741Z-635439a2` **Held because:** CLEAN but 2 open risk(s) (1 verification · 1 decision) — HOLD-ALL parks everything. The risks, verbatim: **Open risks:** 1. Should the sync --once drain run after the source passes, as the issue's Scope says, or before them, as run_forever's startup pass does (sync.py:722-724)? Lean: after. The issue was written from the #78 gate ruling, draining after lets the same run's embed refresh see applied merges and aliases, and it keeps the drain out of the test_mailpeer crash-harness window. Either placement meets both acceptance criteria. [decision] 2. No test baseline was measured: the Half-A sandbox denied executing .venv/bin/python3. Check: on pristine base 3099b59, before the first edit, run `uv run python3 -m pytest -m "not integration" tests/test_vcard_sync.py tests/test_config_cli.py tests/test_carddav.py tests/test_mailmind.py tests/test_mailpeer.py tests/test_embed.py tests/test_actions.py` and record the failure set. After the change, assert the set is unchanged and that both new -k sync_once tests pass. make check must be green in CI. [verification] **Change:** In cli._sync (src/people_mind_mcp/cli.py:47-64), after the source loop (ends line 58) and before sync.load_embedder (line 59), add the guarded drain mirroring sync.run_forever's startup drain at src/people_mind_mcp/sync.py:722-724: `if cfg.auth and cfg.auth.write_entries(): for action_line in drain_actions(conn, cfg, salt, now=now()): print(action_line)`. Extend the name import at cli.py:19 with drain_actions. Add no try: StoreError/sqlite3.Error reach main's existing handlers (cli.py:149-154). Replace README.md:79's "sync --once does not drain them" clause. Add two CLI tests to tests/test_actions.py: one uses seeded_store (auth=True) plus the alias() helper and expects one `action=N kind=link.alias state=applied` line and state applied; one uses make_config() with no auth and expects no action= line and state queued. **Files:** `src/people_mind_mcp/cli.py` · `README.md` · `tests/test_actions.py` **Decision:** accept the 2 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-05-apply-queued-actions-on-peoplemind-sync-once.md` — next: `codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-05-apply-queued-actions-on-peoplemind-sync-once.md`</sub>
Collaborator

spec-verify-dispatch Half B for dev/people-mind-mcp#123 apply-queued-actions-on-peoplemind-sync-once completed integration verify.

  • PR: #129
  • Branch: feat/svd-dev-people-mind-mcp-123-apply-queued-actions-on-peop-08261838
  • Commit: cee336e0e7
  • Build: none
  • Test: green
  • Reader audit clean: True
  • Spec fidelity: True
  • Ready for merge: True
  • Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/78/1
  • Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll
  • Warning: Remote CI (Woodpecker validation) was still pending when this lens returned; the runner must re-poll.
  • Warning: make check (ruff, mypy) was not run locally; only the spec's AC2 pytest set was run.
  • CI wait: ci/woodpecker/pr/validation -> pass
  • Decision: review the PR and merge? (codex-svd ship --run-id 20261105T204446Z-08261838 --confirm-merge)
spec-verify-dispatch Half B for dev/people-mind-mcp#123 apply-queued-actions-on-peoplemind-sync-once completed integration verify. - PR: https://git.groupthink.asia/dev/people-mind-mcp/pulls/129 - Branch: feat/svd-dev-people-mind-mcp-123-apply-queued-actions-on-peop-08261838 - Commit: cee336e0e7844d906316f8c19b3f58f23b668f09 - Build: none - Test: green - Reader audit clean: True - Spec fidelity: True - Ready for merge: True - Check ci/woodpecker/pr/validation: green https://ci.groupthink.asia/repos/73/pipeline/78/1 - Checks: required ci/woodpecker/pr/validation resolved pass by CI-wait poll - Warning: Remote CI (Woodpecker validation) was still pending when this lens returned; the runner must re-poll. - Warning: make check (ruff, mypy) was not run locally; only the spec's AC2 pytest set was run. - CI wait: ci/woodpecker/pr/validation -> pass - Decision: review the PR and merge? (`codex-svd ship --run-id 20261105T204446Z-08261838 --confirm-merge`)
svc-svd-writer 2026-11-05 20:59:39 +00:00
  • closed this issue
  • removed the
    svd:go
    label
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#123
No description provided.