fix(client): harden label pinning and close review findings

- Resolve the Windows admin config via the ProgramData known folder
  instead of the user-controlled ProgramData variable, so a user cannot
  redirect the admin lookup and drop pinned labels
- vendor rename rewrites matching agent-lib.labels.json entries, so a
  renamed item keeps its labels instead of going to every client
- validate checks the labels file in repositories without a lockfile
- A kept modified copy of a deselected item is no longer drift in status,
  and the toast explains it as "no longer assigned to you"
- Labels parser rejects trailing data such as an extra closing brace
- Tests: admin pin wiring (config chain, --repo, admin as chosen config),
  reselect redeploy with byte-level no-op, status labels JSON, validate
  without lockfile, rename keeps labels
- README: document unreadable admin config, drift semantics, rename

Refs: agent_lib-fh4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
m3ta-chironandClaude Opus 5.5 committed 2026-11-14 11:00:41 +01:00
1 parent 59735c3b24
commit ae316860e5
17 files changed
+296 -17

No files matched your search

+11 -5
View File
@@ -328,16 +328,22 @@ Clients opt in through `labels` in their config:
**Admin-pinned:** when the admin default config exists and sets `labels`,
that value applies no matter which config supplied `repo_url` — a user-level
config, `AGENT_LIB_CONFIG` or `--config` can neither widen nor drop it. An
admin config that exists but cannot be parsed aborts the run.
config, `AGENT_LIB_CONFIG` or `--config` can neither widen nor drop it. On
Windows the admin location is resolved through the ProgramData known folder,
not the user-controlled `ProgramData` variable. An admin config that exists
but cannot be read (including permission denied) or parsed aborts the run —
the admin's selection is unknown, so none is guessed.
Sync filters before planning. An item that is no longer selected follows
the upstream-deletion rules: unmodified copies are removed, locally modified
copies are kept with a warning (`--force` removes them); the reason reads
"not selected for this client's labels". A labels file that does not
"not selected for this client's labels". Such a kept copy blocks no
repository update and therefore does not count as drift in `status`. A labels file that does not
validate **aborts the sync before any change** — it never falls back to
delivering everything. Names that match no item only warn on the client;
`agent-lib validate` treats them as errors on the curator side.
delivering everything. Names that match no item only warn on clients that
carry labels; `agent-lib validate` treats them as errors on the curator side
(also in repositories without a lockfile). `vendor rename` rewrites matching
labels entries so a renamed item keeps its labels.
`sync` and `status` print the active selection
(`labels: sales (admin) — 12 item(s) not selected`); `status --json` adds a