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

+7
View File
@@ -35,6 +35,7 @@ type SyncReport struct {
func ExecutePlan(tree *gitsource.GitTree, plan []PlanEntry, manifest *Manifest, paths StatePaths, rev string, stdout io.Writer) (*SyncReport, error) {
report := &SyncReport{Revision: rev, Manifest: paths.Manifest}
var warnings []string
labelSkips := 0
for _, e := range plan {
key := manifestKey(e.Type, e.Name)
@@ -62,6 +63,9 @@ func ExecutePlan(tree *gitsource.GitTree, plan []PlanEntry, manifest *Manifest,
case ActSkip:
warnings = append(warnings, fmt.Sprintf("SKIP %s/%s: %s", e.Type, e.Name, e.Reason))
report.Skipped++
if IsLabelSkip(e) {
labelSkips++
}
case ActLeave:
warnings = append(warnings, fmt.Sprintf("LEAVE %s/%s: %s", e.Type, e.Name, e.Reason))
report.Left++
@@ -79,6 +83,9 @@ func ExecutePlan(tree *gitsource.GitTree, plan []PlanEntry, manifest *Manifest,
}
title := "agent-lib sync"
body := fmt.Sprintf("%d item(s) kept local: modifications blocked company updates. See the sync log for details.", report.Skipped+report.Left)
if labelSkips > 0 && labelSkips == report.Skipped && report.Left == 0 {
body = fmt.Sprintf("%d item(s) kept local: no longer assigned to you, but you modified them. See the sync log for details.", labelSkips)
}
if err := Notifier.Send(title, body); err != nil {
fmt.Fprintf(stdout, "warning: notification failed: %v\n", err)
}