diff --git a/frontend/packages/swarm-ui/src/pages/LinkForgeAccountForm.tsx b/frontend/packages/swarm-ui/src/pages/LinkForgeAccountForm.tsx index abaa8a1e..71d6e37a 100644 --- a/frontend/packages/swarm-ui/src/pages/LinkForgeAccountForm.tsx +++ b/frontend/packages/swarm-ui/src/pages/LinkForgeAccountForm.tsx @@ -83,7 +83,7 @@ export function LinkForgeAccountForm({ value={label} pattern={LABEL_PATTERN} title="1-63 chars: lowercase letters, digits, hyphen" - placeholder="e.g. codeberg" + placeholder="e.g. myforge" required onInput={setLabel} /> @@ -92,7 +92,7 @@ export function LinkForgeAccountForm({ label="forge URL" type="url" value={url} - placeholder="https://codeberg.org" + placeholder="https://forge.example.org" required onInput={setUrl} /> diff --git a/hive-types/src/lib.rs b/hive-types/src/lib.rs index 90735cfa..dc123baf 100644 --- a/hive-types/src/lib.rs +++ b/hive-types/src/lib.rs @@ -196,7 +196,7 @@ mod ident_tests { "damocles", "hm1nd", "agent-with-dashes", - "codeberg", + "myforge", "acct-1", ] { assert!(Ident::parse(ok).is_ok(), "should accept {ok:?}"); diff --git a/swarm-controller/src/forge_account.rs b/swarm-controller/src/forge_account.rs index 8cdead36..637baecf 100644 --- a/swarm-controller/src/forge_account.rs +++ b/swarm-controller/src/forge_account.rs @@ -22,7 +22,7 @@ use super::{AppState, error_problem, swarm_hive}; pub struct PutForgeAccountRequest { /// The forge's base URL, `http://` or `https://`. A trailing slash is /// dropped. - #[schema(example = "https://codeberg.org")] + #[schema(example = "https://forge.example.org")] url: String, /// The access token. Never logged, and never returned by this route. token: String, @@ -122,14 +122,14 @@ mod tests { #[test] fn the_url_loses_its_trailing_slash_and_the_token_is_kept() { - let a = account(request("https://codeberg.org/ ", "t0k3n")).expect("valid"); - assert_eq!(a.url, "https://codeberg.org"); + let a = account(request("https://forge.example.org/ ", "t0k3n")).expect("valid"); + assert_eq!(a.url, "https://forge.example.org"); assert_eq!(a.value, "t0k3n"); } #[test] fn a_url_that_is_not_http_is_refused() { - assert!(account(request("codeberg.org", "t")).is_err()); + assert!(account(request("forge.example.org", "t")).is_err()); assert!(account(request("file:///etc/passwd", "t")).is_err()); // The control: plain http is accepted. assert!(account(request("http://forge.lan", "t")).is_ok()); @@ -137,7 +137,7 @@ mod tests { #[test] fn an_empty_token_is_refused() { - assert!(account(request("https://codeberg.org", " ")).is_err()); + assert!(account(request("https://forge.example.org", " ")).is_err()); } /// Bare-minimum `AppState`, as `matrix_account`'s tests build it. @@ -173,7 +173,7 @@ mod tests { super::put_forge_account( axum::extract::State(state(store)), axum::extract::Path(("pr1ma".to_owned(), "atlas".to_owned(), label.to_owned())), - axum::Json(request("https://codeberg.org", "t0k3n")), + axum::Json(request("https://forge.example.org", "t0k3n")), ) .await } @@ -182,7 +182,7 @@ mod tests { #[tokio::test] async fn a_label_hive_forge_cannot_name_is_refused_before_the_store() { let store = Arc::default(); - for bad in ["Codeberg", "code_berg", "../x"] { + for bad in ["MyForge", "my_forge", "../x"] { let problem = put(&store, bad).await.expect_err("refused"); assert_eq!( problem.status, @@ -197,9 +197,9 @@ mod tests { #[tokio::test] async fn a_plain_label_reaches_the_store() { let store = Arc::default(); - let stored = put(&store, "codeberg").await.expect("nothing is stored"); - assert_eq!(stored.url, "https://codeberg.org"); - assert_eq!(store.written(), ["swarm/agents/atlas/forge/codeberg"]); + let stored = put(&store, "myforge").await.expect("nothing is stored"); + assert_eq!(stored.url, "https://forge.example.org"); + assert_eq!(store.written(), ["swarm/agents/atlas/forge/myforge"]); } #[tokio::test] @@ -208,8 +208,8 @@ mod tests { use swarm_secret_client::forge; let store = FakeStore::default(); - let path = forge::account_path("atlas", "codeberg").expect("a valid path"); - let first = account(request("https://codeberg.org", "t0k3n-first")).expect("valid"); + let path = forge::account_path("atlas", "myforge").expect("a valid path"); + let first = account(request("https://forge.example.org", "t0k3n-first")).expect("valid"); let second = account(request("https://forge.lan", "t0k3n-second")).expect("valid"); link(&store, &path, &first) @@ -218,12 +218,12 @@ mod tests { let problem = link(&store, &path, &second) .await .expect_err("an account is stored") - .problem(&super::existing("atlas", "codeberg")); + .problem(&super::existing("atlas", "myforge")); assert_eq!(problem.status, Some(axum::http::StatusCode::CONFLICT)); let detail = problem.detail.expect("a detail"); assert!( - detail.contains(r#"agent atlas already has forge account "codeberg""#), + detail.contains(r#"agent atlas already has forge account "myforge""#), "{detail}" ); assert_eq!(store.written(), std::slice::from_ref(&path)); @@ -232,7 +232,7 @@ mod tests { .await .expect("store answers") .expect("still stored"); - assert_eq!(kept.url, "https://codeberg.org"); + assert_eq!(kept.url, "https://forge.example.org"); assert_eq!(kept.value, "t0k3n-first"); } } diff --git a/swarm-controller/src/linked_accounts.rs b/swarm-controller/src/linked_accounts.rs index eda4e846..bea302a2 100644 --- a/swarm-controller/src/linked_accounts.rs +++ b/swarm-controller/src/linked_accounts.rs @@ -693,8 +693,8 @@ pub(crate) mod tests { json!({"value": "t0k3n-old"}), ) .with( - "swarm/agents/atlas/forge/codeberg", - json!({"value": "t0k3n-forge", "url": "https://codeberg.org"}), + "swarm/agents/atlas/forge/myforge", + json!({"value": "t0k3n-forge", "url": "https://forge.example.org"}), ) .with( "swarm/agents/atlas/github-token", @@ -735,8 +735,8 @@ pub(crate) mod tests { row(AccountKind::Matrix, "old", None, false), row( AccountKind::Forgejo, - "codeberg", - Some("https://codeberg.org"), + "myforge", + Some("https://forge.example.org"), false ), row(AccountKind::Github, "github", Some("github.com"), false), @@ -802,7 +802,7 @@ pub(crate) mod tests { ) .await .expect("stored"); - remove_plain::(&store, "swarm/agents/atlas/forge/codeberg") + remove_plain::(&store, "swarm/agents/atlas/forge/myforge") .await .expect("stored"); remove_plain::(&store, "swarm/agents/atlas/github-token") @@ -812,7 +812,7 @@ pub(crate) mod tests { deleted(&store), [ "swarm/agents/atlas/matrix/catgirl", - "swarm/agents/atlas/forge/codeberg", + "swarm/agents/atlas/forge/myforge", "swarm/agents/atlas/github-token", ] ); @@ -828,7 +828,7 @@ pub(crate) mod tests { None::, ) .await, - remove_plain::(&store, "swarm/agents/atlas/forge/codeberg").await, + remove_plain::(&store, "swarm/agents/atlas/forge/myforge").await, remove_plain::(&store, "swarm/agents/atlas/github-token").await, ]; for result in results { diff --git a/swarm-secret-client/src/forge.rs b/swarm-secret-client/src/forge.rs index 0babd55b..d3cf9ba3 100644 --- a/swarm-secret-client/src/forge.rs +++ b/swarm-secret-client/src/forge.rs @@ -109,8 +109,8 @@ mod tests { fn an_account_and_its_directory_land_under_the_agent_prefix() { // Spelled out: `forge-accounts.nix` spells the same strings. assert_eq!( - account_path("atlas", "codeberg").expect("both segments are legal"), - "swarm/agents/atlas/forge/codeberg" + account_path("atlas", "myforge").expect("both segments are legal"), + "swarm/agents/atlas/forge/myforge" ); assert_eq!( accounts_dir("atlas").expect("legal"), @@ -132,7 +132,7 @@ mod tests { fn a_label_that_could_escape_the_directory_is_refused() { for bad in ["../argus", "a/b", "a.b", ""] { assert!(account_path("atlas", bad).is_err(), "label {bad:?}"); - assert!(account_path(bad, "codeberg").is_err(), "agent {bad:?}"); + assert!(account_path(bad, "myforge").is_err(), "agent {bad:?}"); } // The control: the legal charset stays reachable. assert!(account_path("a-b_C9", "d-e0").is_ok()); @@ -153,14 +153,14 @@ mod tests { assert!(covers(&format!("secret/metadata/{dir}/"))); assert!(covers(&format!( "secret/data/{}", - account_path("atlas", "codeberg").expect("legal") + account_path("atlas", "myforge").expect("legal") ))); // The control: another agent's accounts are outside both grants. let other = accounts_dir("argus").expect("legal"); assert!(!covers(&format!("secret/metadata/{other}/"))); assert!(!covers(&format!( "secret/data/{}", - account_path("argus", "codeberg").expect("legal") + account_path("argus", "myforge").expect("legal") ))); } @@ -168,21 +168,21 @@ mod tests { fn the_account_fields_match_what_the_nix_reader_asks_for() { let json = serde_json::to_string(&Account { value: "t".to_owned(), - url: "https://codeberg.org".to_owned(), + url: "https://forge.example.org".to_owned(), }) .expect("two Strings serialise"); - assert_eq!(json, r#"{"value":"t","url":"https://codeberg.org"}"#); + assert_eq!(json, r#"{"value":"t","url":"https://forge.example.org"}"#); } #[test] fn debug_never_prints_an_accounts_value() { let a = Account { value: "0123456789abcdef".to_owned(), - url: "https://codeberg.org".to_owned(), + url: "https://forge.example.org".to_owned(), }; let shown = format!("{a:?}"); assert!(!shown.contains("0123456789abcdef"), "{shown}"); - assert!(shown.contains("codeberg.org"), "{shown}"); + assert!(shown.contains("forge.example.org"), "{shown}"); } #[test]