feat(client): deliver items only to clients with a matching label
- Add internal/labels: parse and validate the optional work-repo file
agent-lib.labels.json (version 1; unlabeled items go to every client;
names match across types)
- Add "labels" to the client config: absent = no filtering, [] = unlabeled
items only; labels from the admin default config are pinned and cannot be
overridden by user, env or flag configs; a broken admin config aborts
- Filter in prepare() before planning; deselected items follow the
upstream-deletion rules (unmodified removed, modified kept + warn,
--force removes) with reason "not selected for this client's labels"
- Abort sync before any change when the labels file does not validate;
names that match no item only warn on the client
- Report the active selection in sync output and status (--json: labels
object with client, source, labels_file, not_selected, unknown_names)
- validate checks the labels file, including that every name resolves to
an own, vendored or MCP item
- Document in README ("Client labels"), fleet handoff and the proposal;
revise the "client-side selection" non-goal
- Tests: labels parser, config precedence, planner deselection, e2e for
filter/remove/keep-modified/abort/unknown names, validate
Refs: agent_lib-fh4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39952ceb02
commit
59735c3b24
16 files changed
+904
-38
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Proposal: client labels — deliver content to a subset of clients
|
||||
|
||||
Status: proposed (14.11.2026)
|
||||
Status: implemented on branch feat/client-labels (14.11.2026) — user docs in the README, section "Client labels"
|
||||
|
||||
## Problem
|
||||
|
||||
@@ -108,8 +108,9 @@ a separately authenticated repository.
|
||||
- Invalid (parse error, bad label form, empty list, unknown key,
|
||||
unknown version) → **sync aborts before any change** with a clear
|
||||
error. Never fall back to "deliver everything".
|
||||
- A name that matches no item → warning in sync log/status, not fatal
|
||||
(the curator-side `validate` is the hard gate).
|
||||
- A name that matches no item → warning on sync output and in
|
||||
`status`, not fatal and no toast (the curator-side `validate` is the
|
||||
hard gate).
|
||||
3. Drop items whose labels do not intersect the client labels before
|
||||
hashing/planning (`internal/client/sync.go`, loop over
|
||||
`inv.Deployable()`).
|
||||
@@ -124,11 +125,16 @@ a separately authenticated repository.
|
||||
`status --json` gains:
|
||||
|
||||
```json
|
||||
"labels": { "client": ["sales"], "source": "admin", "filtered": 12 }
|
||||
"labels": {
|
||||
"client": ["sales"], "source": "admin", "labels_file": true,
|
||||
"not_selected": ["skills/officecli-financial-model"],
|
||||
"unknown_names": []
|
||||
}
|
||||
```
|
||||
|
||||
`source` is `admin` | `user` | `env` | `flag` | `none`. Human output
|
||||
prints one line: `labels: sales (admin) — 12 items not selected`.
|
||||
The object is omitted when the client has no labels. `source` is `admin`
|
||||
| `user` | `env` | `flag`. Human output prints one line:
|
||||
`labels: sales (admin) — 12 item(s) not selected`.
|
||||
|
||||
## Curator side
|
||||
|
||||
|
||||
Reference in new issue
Block a user