Repository navigation
[TAG-04] Derive TWS tags with explicit stale and revoked states #14
Description
ID: TAG-04 (TAG-002). Priority: P1. Blocked by: #9, #11. Backlog: #1.
Scope
Derive source-owned workspace/feature tags from authoritative T3 TWS context.
Add a stack-node tag only when current exact execution-node association is
proven. Binding IDs determine derived identity; names are display labels.
TWS-02 grouping UI is an ordering preference, not a hard backend dependency.
Exact lifecycle
| Observation | Result |
|---|---|
| Valid complete positive association | Create/refresh active derived assignment; preserve its opaque identity. |
| Failed, partial, truncated, ambiguous or unsupported scope | Keep last-known assignment stale; reset any pending absence confirmation. Never count this as absence. |
| First successful complete absence for its covered scope | Mark stale and record one negative observation. |
| Second distinct consecutive successful complete absence | Revoke active assignment, preserving identity/history. |
| Positive observation before the second absence | Clear negative evidence and reactivate/refresh the same assignment. |
| Explicit authoritative T3 context clear/reassign or thread deletion | Revoke no-longer-applicable assignments immediately through its event; no artificial two-scan grace. |
| Same binding/context returns | Reactivate the same assignment, not a duplicate. |
Consecutive means separate actual server refresh observations with no
intervening failure/partial result for that scope. Concurrent requests coalesce
to one observation; replaying its receipt cannot count twice. One successful
empty read is not enough. There is no scheduled second scan: until another
explicit/trusted refresh, retain stale evidence. Wall-clock age never revokes.
Acceptance criteria
- Source coverage is scope-specific. A missing feature in a truncated or
partially decoded result never removes tags outside proven coverage. - Project membership alone does not tag every feature. Ambiguity produces no
new assignment; conflicting old context becomes stale rather than retargeted. - Material revision increments only when semantic state/label/provenance
changes. A positive re-observation may advance last-confirmed observation
metadata without churning all assignment revisions/deltas. - Renames with proven same binding update labels, never IDs. Reused names or
paths without identity continuity cannot inherit old assignments. - Derived state cannot modify manual tags. A failed refresh never looks like
successful deletion. A source cannot acquire client routing authority. - Revoked assignments and unused derived definitions remain history; default
active lists hide them. No automatic hard deletion or unproven global
"unused definition" sweep in this slice. - Web/desktop/mobile receive the same compact source/stale/revoked changes and
lazy provenance. Manual UI slices expose source and local hide/unhide controls. - Tests cover the complete transition table, per-scope partials, replay,
concurrent/stale refreshes, multiple features per project, exact-node rules,
context changes and stable-ID reactivation.
Coverage and non-goals
Provider-independent server behavior and shared client state, all environment
modes. UI adapters integrate through TAG-02/TAG-03; derived behavior is not
declared user-complete until those surfaces can show its state.
No TWS mutation, periodic CLI polling, inferred content tags, global definitions,
worktree-only tags, branch-only matching or automatic same-label merge.
Activity