Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: move the accounts concern into its own module

Refs #6897
This commit is contained in:
atlas 2026-11-27 13:13:28 +01:00
commit 9b2ba275d8
13 changed files with 22 additions and 15 deletions

View file

@ -706,7 +706,7 @@ in
Also the swarm-wide default homeserver for `PUT Also the swarm-wide default homeserver for `PUT
.../matrix-accounts/{account}` requests that omit their own .../matrix-accounts/{account}` requests that omit their own
`homeserver` — see that route's own doc comment `homeserver` — see that route's own doc comment
(`swarm-controller/src/matrix_account.rs`) for why the field is (`swarm-controller/src/accounts/matrix_account.rs`) for why the field is
optional in token mode and what omitting it currently resolves to. optional in token mode and what omitting it currently resolves to.
That route does not consult it yet. That route does not consult it yet.
''; '';
@ -1083,7 +1083,7 @@ in
SWARM_CONTROLLER_STALE_AFTER_SECS = toString cfg.staleAfterSeconds; SWARM_CONTROLLER_STALE_AFTER_SECS = toString cfg.staleAfterSeconds;
# The accounts the operator admin sync never revokes. Whitespace- # The accounts the operator admin sync never revokes. Whitespace-
# separated: a matrix user id cannot contain a space. Consumed by # separated: a matrix user id cannot contain a space. Consumed by
# swarm-controller/src/matrix_account/operator_admin.rs. # swarm-controller/src/accounts/matrix_account/operator_admin.rs.
SWARM_CONTROLLER_MATRIX_ADMIN_SYNC_IGNORE_USERS = lib.concatStringsSep " " deployCfg.swarm-controller.matrixAdminSync.ignoreUsers; SWARM_CONTROLLER_MATRIX_ADMIN_SYNC_IGNORE_USERS = lib.concatStringsSep " " deployCfg.swarm-controller.matrixAdminSync.ignoreUsers;
# Where `GET /api/alerts` reads alerts (swarm-controller/src/alerts.rs). # Where `GET /api/alerts` reads alerts (swarm-controller/src/alerts.rs).
# Every swarm has one Grafana, reached by name wherever it runs. The # Every swarm has one Grafana, reached by name wherever it runs. The

View file

@ -123,7 +123,7 @@ swarm-queue-client = { workspace = true, features = [
"agent-term", "agent-term",
"forge-events", "forge-events",
] } ] }
# `matrix_account.rs` writes the credential this daemon's route accepts. Same # `accounts/matrix_account.rs` writes the credential this daemon's route accepts. Same
# crate the hive reads it back with, which is the point: the path, the field # crate the hive reads it back with, which is the point: the path, the field
# name and the object's shape are agreements between the two ends, and a # name and the object's shape are agreements between the two ends, and a
# second spelling here would be a store this hive could not read. # second spelling here would be a store this hive could not read.

View file

@ -177,7 +177,7 @@ mod tests {
forge: std::sync::Arc::default(), forge: std::sync::Arc::default(),
create_gate: std::sync::Arc::default(), create_gate: std::sync::Arc::default(),
accounts: Accounts::Fake(Arc::clone(store)), accounts: Accounts::Fake(Arc::clone(store)),
try_outs: super::super::review_classifier::TryOuts::default(), try_outs: crate::review_classifier::TryOuts::default(),
reviews: std::sync::Arc::default(), reviews: std::sync::Arc::default(),
runs: crate::review_classifier::runs::Runs::Live(None), runs: crate::review_classifier::runs::Runs::Live(None),
builds: crate::builder::runs::Builds::Live(None), builds: crate::builder::runs::Builds::Live(None),

View file

@ -139,7 +139,7 @@ mod tests {
forge: std::sync::Arc::default(), forge: std::sync::Arc::default(),
create_gate: std::sync::Arc::default(), create_gate: std::sync::Arc::default(),
accounts: Accounts::Fake(Arc::clone(store)), accounts: Accounts::Fake(Arc::clone(store)),
try_outs: super::super::review_classifier::TryOuts::default(), try_outs: crate::review_classifier::TryOuts::default(),
reviews: std::sync::Arc::default(), reviews: std::sync::Arc::default(),
runs: crate::review_classifier::runs::Runs::Live(None), runs: crate::review_classifier::runs::Runs::Live(None),
builds: crate::builder::runs::Builds::Live(None), builds: crate::builder::runs::Builds::Live(None),

View file

@ -230,7 +230,7 @@ mod tests {
forge: std::sync::Arc::default(), forge: std::sync::Arc::default(),
create_gate: std::sync::Arc::default(), create_gate: std::sync::Arc::default(),
accounts: Accounts::Fake(Arc::clone(store)), accounts: Accounts::Fake(Arc::clone(store)),
try_outs: super::super::review_classifier::TryOuts::default(), try_outs: crate::review_classifier::TryOuts::default(),
reviews: std::sync::Arc::default(), reviews: std::sync::Arc::default(),
runs: crate::review_classifier::runs::Runs::Live(None), runs: crate::review_classifier::runs::Runs::Live(None),
builds: crate::builder::runs::Builds::Live(None), builds: crate::builder::runs::Builds::Live(None),

View file

@ -1255,7 +1255,7 @@ pub(crate) mod tests {
forge: std::sync::Arc::default(), forge: std::sync::Arc::default(),
create_gate: std::sync::Arc::default(), create_gate: std::sync::Arc::default(),
accounts: super::Accounts::Fake(Arc::clone(store)), accounts: super::Accounts::Fake(Arc::clone(store)),
try_outs: super::super::review_classifier::TryOuts::default(), try_outs: crate::review_classifier::TryOuts::default(),
reviews: std::sync::Arc::default(), reviews: std::sync::Arc::default(),
runs: crate::review_classifier::runs::Runs::Live(None), runs: crate::review_classifier::runs::Runs::Live(None),
builds: crate::builder::runs::Builds::Live(None), builds: crate::builder::runs::Builds::Live(None),

View file

@ -479,7 +479,7 @@ mod tests {
forge: std::sync::Arc::default(), forge: std::sync::Arc::default(),
create_gate: std::sync::Arc::default(), create_gate: std::sync::Arc::default(),
accounts: Accounts::Fake(Arc::clone(store)), accounts: Accounts::Fake(Arc::clone(store)),
try_outs: super::super::review_classifier::TryOuts::default(), try_outs: crate::review_classifier::TryOuts::default(),
reviews: std::sync::Arc::default(), reviews: std::sync::Arc::default(),
runs: crate::review_classifier::runs::Runs::Live(None), runs: crate::review_classifier::runs::Runs::Live(None),
builds: crate::builder::runs::Builds::Live(None), builds: crate::builder::runs::Builds::Live(None),

View file

@ -0,0 +1,9 @@
//! The accounts concern: the swarm's matrix accounts and the external accounts
//! linked to it (forge, github, gitlab), with their egress and routes.
pub(crate) mod forge_account;
pub(crate) mod github_account;
pub(crate) mod gitlab_account;
pub(crate) mod link_egress;
pub(crate) mod linked_accounts;
pub(crate) mod matrix_account;

View file

@ -23,6 +23,7 @@ use std::sync::{Arc, Mutex};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
mod accounts;
mod agent_archetype; mod agent_archetype;
mod agent_commands; mod agent_commands;
mod agent_config_repo; mod agent_config_repo;
@ -61,17 +62,11 @@ mod config_pr;
mod egress_allow; mod egress_allow;
mod egress_deny; mod egress_deny;
mod forge; mod forge;
mod forge_account;
mod forge_events; mod forge_events;
mod github_account;
mod gitlab_account;
mod held_deploys; mod held_deploys;
mod inference; mod inference;
mod issue_report; mod issue_report;
mod jobq; mod jobq;
mod link_egress;
mod linked_accounts;
mod matrix_account;
mod message_stream; mod message_stream;
mod meta_build; mod meta_build;
mod meta_fanout; mod meta_fanout;
@ -101,8 +96,11 @@ mod vcs_metrics;
mod wanted; mod wanted;
mod webhook; mod webhook;
// The accounts and review modules keep their crate-root paths (`crate::matrix_account::…`).
use accounts::{
forge_account, github_account, gitlab_account, link_egress, linked_accounts, matrix_account,
};
use jobq::{Late, WorkerDeps, spawn_jobq_worker}; use jobq::{Late, WorkerDeps, spawn_jobq_worker};
// The review modules keep their crate-root paths (`crate::review_classifier::…`).
use review::{notify_flows, notify_router_api, request_reviewer, review_classifier}; use review::{notify_flows, notify_router_api, request_reviewer, review_classifier};
use routes::AppState; use routes::AppState;
use startup::{ use startup::{