instar 1.3.506 → 1.3.507

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,83 @@
1
+ # Side-Effects Review — WS4.1 attention pool-scope (read-side)
2
+
3
+ **Version / slug:** `multi-machine-seamlessness-ws41-attention-pool-read`
4
+ **Date:** `2026-06-12`
5
+ **Author:** `Instar Agent (echo)`
6
+ **Second-pass reviewer:** `not required (read-only observability merge — no block/allow, no mutation, no session/ownership surface)`
7
+
8
+ ## Summary of the change
9
+
10
+ The read-side of WS4.1 (MULTI-MACHINE-SEAMLESSNESS-SPEC §WS4.1): `GET /attention?scope=pool`
11
+ merges every online peer's attention items into one view so the dashboard shows one
12
+ queue across the whole pool. Local items are tagged with this machine's id/nickname
13
+ at read time; remote items with the peer's. Tolerant (per-peer 5s timeout → a
14
+ `pool.failed` marker, never a 500), short-TTL cached (3s, so dashboard polling
15
+ doesn't re-fan-out per request), and P17-coalesced at the merge point (same-key
16
+ NORMAL items across machines collapse to ONE row; HIGH/URGENT never coalesced).
17
+ Plain `GET /attention` stays back-compatible (`{items,count}`), now self-tagged with
18
+ machine identity when the pool is wired. Files: `src/server/routes.ts` (the merge
19
+ helper + the scope branch), `src/messaging/TelegramAdapter.ts` (optional
20
+ `machineId`/`machineNickname` on `AttentionItem`), `src/scaffold/templates.ts` +
21
+ `src/core/PostUpdateMigrator.ts` (Agent Awareness + Migration Parity).
22
+
23
+ **Scope boundary:** this is the READ half only. The durable, operator-bound,
24
+ machine-independent `/ack` (a replicated ack record + mutating mesh verb with its own
25
+ RBAC class + owner revalidation) is the security-sensitive write half and ships as a
26
+ SEPARATE slice under the same approved spec. <!-- tracked: CMT-1416 -->
27
+
28
+ ## Decision-point inventory
29
+
30
+ - `GET /attention?scope=pool` merge — **add** — a read-only aggregation. No
31
+ block/allow; never mutates an item; returns a tolerant merged view.
32
+ - The P17 coalesce key — **add** — a read-side display grouping (collapses duplicate
33
+ rows); the write-side per-machine budgets remain the authoritative bound.
34
+ - `AttentionItem.machineId/machineNickname` — **add (optional, read-stamped)** — no
35
+ persistence change; stamped at read time, absent on single-machine installs.
36
+
37
+ ---
38
+
39
+ ## 1. Over-block
40
+ No block/allow surface — a read-only merge. Not applicable.
41
+
42
+ ## 2. Under-block
43
+ N/A (read-only). The coalesce could in principle hide a distinct-but-same-key item,
44
+ but HIGH/URGENT are exempt and the per-item store is unchanged (every item is still
45
+ individually addressable via `GET /attention/:id`); the merge only affects the
46
+ pool LIST view.
47
+
48
+ ## 3. Level-of-abstraction fit
49
+ Right layer: mirrors the proven `GET /sessions?scope=pool` precedent exactly (route-
50
+ level fan-out + per-peer-timeout + `failed` markers + machine tagging). The store
51
+ (`TelegramAdapter`) stays machine-agnostic; the machine view is composed in the route.
52
+
53
+ ## 4. Signal vs authority compliance
54
+ Compliant — pure read, zero authority. It gates nothing.
55
+
56
+ ## 5. Interactions
57
+ - The plain `GET /attention` path is unchanged except for optional machine tags
58
+ (additive). The PATCH/DELETE/`:id` routes are untouched.
59
+ - The short-TTL cache is keyed by status; a status-filtered pool read and an
60
+ unfiltered one have separate cache entries (no cross-contamination).
61
+ - Coalesce reads `sourceContext`/`category`/`title` — fields the flood guard already
62
+ populates; no new write contract.
63
+
64
+ ## 6. External surfaces
65
+ - New query mode on an existing route. Old callers (no `?scope=pool`) get the
66
+ back-compatible array-shaped... (object `{items,count}`) response unchanged.
67
+ - A peer's `GET /attention` is called with the agent bearer (same pattern as
68
+ sessions pool scope). A peer on an OLD version simply returns its local
69
+ `{items,count}` — merges fine (machine tags filled from the registry).
70
+ - Timing: bounded by the 5s per-peer timeout; a slow/dark peer contributes a
71
+ `failed` marker, never delays past the timeout.
72
+
73
+ ## 7. Multi-machine posture (Cross-Machine Coherence)
74
+ **proxied-on-read** — the merged read fans out to peers per request (cached 3s),
75
+ each item tagged with its owning machine. No replication, no durable cross-machine
76
+ state in this slice (that is the deferred `/ack` write half). The pool registry's
77
+ online flag is consulted to skip a known-dark peer cheaply. Phase-C clean: the
78
+ fan-out is per-online-peer and the coalesce is O(items) — no 2-peer assumption.
79
+
80
+ ## 8. Rollback cost
81
+ Trivial: the scope branch is additive; reverting the PR restores today's local-only
82
+ `GET /attention`. No durable state written, no migration beyond the additive CLAUDE.md
83
+ bullet (idempotent, content-sniffed).