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:
1 parent
59735c3b24
commit
ae316860e5
17 files changed
+296
-17
No files matched your search
@@ -37,6 +37,10 @@ type prepared struct {
|
||||
labels *LabelSelection
|
||||
}
|
||||
|
||||
// adminConfigPath locates the admin default config for label pinning;
|
||||
// tests swap it to exercise the pin end to end.
|
||||
var adminConfigPath = DefaultConfigPath
|
||||
|
||||
// LabelSelection describes an active label filter for one run: the client
|
||||
// labels, where they came from, which items were left out and which names
|
||||
// in the labels file match no item. nil when the client carries no labels.
|
||||
@@ -171,7 +175,7 @@ func resolveRunConfig(opts SyncOptions) (*ClientConfig, error) {
|
||||
return nil, err
|
||||
}
|
||||
cfg.FillTokenAuth()
|
||||
if err := ApplyAdminLabels(cfg, DefaultConfigPath()); err != nil {
|
||||
if err := ApplyAdminLabels(cfg, adminConfigPath()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cfg, nil
|
||||
@@ -188,7 +192,7 @@ func resolveRunConfig(opts SyncOptions) (*ClientConfig, error) {
|
||||
cfg.Ref = opts.Ref
|
||||
}
|
||||
cfg.FillTokenAuth()
|
||||
if err := ApplyAdminLabels(cfg, DefaultConfigPath()); err != nil {
|
||||
if err := ApplyAdminLabels(cfg, adminConfigPath()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cfg, nil
|
||||
|
||||
Reference in new issue
Block a user