Watch
0
0
Fork
You've already forked hyperhive
0

use a neutral forge name in link-form placeholders, schema examples and tests

Codeberg does not accept AI-assisted contributions, so it should not be
the example we put in front of operators. The placeholders now read
myforge / forge.example.org; the tests use the same neutral names.
This commit is contained in:
iris 2026-10-04 15:51:20 +02:00
commit 78e9f2ca67
5 changed files with 34 additions and 34 deletions

View file

@ -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]