fix(settings): align agent-fetcher config to the VS-37 wire contract #44
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/vapp-agent-fetcher-settings-contract"
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?
Problem
Clicking the agent download button in "+ New Device" 404s, and the Settings "Agent binaries" card shows "no settingsget reply from vervain-server (the action may require admin rights)". This is not a
VERVAIN_SERVER_URLproblem - the control channel connects and the site-admin gate passes.Root cause: the card and the download were written against an assumed VS-37 settings-overlay contract (there's a comment admitting it) that didn't match what vervain-server shipped, so an admin can neither read nor save the
agentbinaryfetcherconfig. The fetcher stays unconfigured, and vervain-server returns 404 from/vervainagents/<id>when no fetcher is configured (crates/vervain-web/src/lib.rs:1257,1309), so every download 404s.What was wrong (verified against the live server source)
{"action":"settingsget"}, butSettingsGet { section: String }(user_session.rs:1212) requires asection. The request couldn't deserialize, no reply came, and the card timed out.{"action":"settingsupdate","key":"agentbinaryfetcher",...}, but the server wants the fieldsection(notkey), avalueblock with the sourcetypediscriminant (forgejo/http), and acks a successresultofok:installed=N,failed=M/saved:refresh-failed:<e>(settings_overlay.rs:215-227), not the bare"ok"the appsrequest_ackrequired.Fix (apps-side,
src/server_fns/mod.rs+ model docs)get_agent_fetcher_config: sendsection: "agentbinaryfetcher"; read the block from the reply'sdata.update_agent_fetcher_config: sendsection(notkey) withtype: "forgejo"in the value; acceptok:/saved:ack prefixes as success, mapnot-authorized/error:<msg>to the inline error.parse_fetcher_config: deriveenabledfrom a configured source (no server enable flag) andtoken_setfrom the redacted__redacted__token.AgentFetcher*model docs to the pinned contract.After this, an admin can configure the Forgejo fetcher in Settings; the server fetches the binaries on save (
settingsupdaterunsrefresh_now), and the download serves instead of 404ing.Known follow-up
Preserving an already-stored token across an edit that blanks the token field needs the server's
__redacted__echo-back; omit-on-blank (correct for first-time config) is kept here and the refinement is documented onAgentFetcherUpdate.Verification
just checkpasses: fmt, clippy, server build, wasm build, 21 unit tests.Closes VAPP-32.