feat(dispatch): apply server-pushed agentconfig (VA-130) #135
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VA-130-agentconfig"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Agent-side consumer for VS-67. The agent dropped the server's
agentconfigcontrol frame:dispatch.rs route_jsonhad no arm for it, so on every connect it loggedunhandled JSON action action="agentconfig"and ignored the server's operational config. The node kept registering with the all-zeros defaultgroup_idand built-in tunables. The server half (VS-67) shipped Done; this builds the missing consumer.Surfaced in VA-129 and again in VA-133 macOS validation (
envelope={"action":"agentconfig","group_id":"group//0000..."}). Not macOS-specific:dispatch.rsis one cross-platform tree.How
New
agentconfigarm parses the optional fields and persists them into the two stores the agent reads at startup:group_idto the data store (GROUP_ID_KEY), whereresolve_group_idreads it on the next launch.backoffInitialMs,backoffMaxMs,backoffMultiplier,idleTimeoutSecs),enableMdns, and the self-update flags (disableUpdate,forceUpdate,logUpdate,fakeUpdate) to the config store settings blob, wheresettings::load+ConnectionSettings::from_config+ the flag readers pick them up.Absent fields are left untouched (the server only overrides what it sent). Parsing is a pure
agentconfig::parse(wire JSON ->AgentConfig) split fromagentconfig::apply(store I/O) so the mapping is unit-tested with no I/O.group_iddecodes the server'sgroup//<hex>form (bare and0x-prefixed also accepted);backoff_multiplierarrives as a float and is rounded to the integer the config store holds. Wire field names/types verified against vervain-server'sagent_config.rsstruct.The config store is threaded from
mainthroughrun_reconnecting/run_connectionintoSessionand onto the JSONDispatchContextvia a newwith_config_storesbuilder (ungated fields, independent of the vervain-corestore).Apply-scope note
group_idand the connection tunables are read once at process start, so applied values take effect on the next start/reconnect cycle, not live in the current session (the ticket flagged this as acceptable with a documented note). The dispatcher logs the applied field list so the change is observable, and theunhandled JSON actionlog is gone. A live in-session apply (mutating the runningConnectConfig/ rebinding mDNS) is a possible follow-up.Testing
parsetests: full payload, group_id-only push, prefix handling and rejection of bad hex/length, empty payload.applyround-trip against two real SQLCipher stores: group_id lands in the data store, tunables/flags land in the config blob under the expected camelCase keys, and an operator-set key the server did not send survives.agentconfigframe throughroute_jsonand asserts group_id + tunables persisted and no fall-through to the unhandled arm.--deny warningsand fmt clean; full workspace builds.Closes VA-130.