[roads] QA B-3: an app road names whose devices it is for, and reaches only those

subject: app:<id> applied to every device in the mesh, so whoever could write
one road (app:steam goes-direct 0.0.0.0/0) changed the tunnel of other
people's devices, an exit and a classic router. An app road now needs the new
header key on: (a person, group or device), and reaches only those devices;
on: is forbidden on any other subject. The home fixture's steam road is on
Mark's devices, so it leaves Jana's, Petr's and the router's plans. Four
fixtures, a B-3 test (fails if app roads reach every device again), the
property generator scopes app roads to a person, and the R-55 renaming
rewrites on: like subject:.
This commit is contained in:
2026-11-25 09:04:50 +01:00
parent 69e3a9377d
commit b482e264d2
18 changed files with 179 additions and 84 deletions
+1 -1
View File
@@ -1 +1 @@
bfcecb172d2f1edc0ea152e1f0e05ad7b89a05ad14b27e22651a5ee6379e0917 8eaa80e6c40ff1541d125f0755fbdddc775f9210e830f2868d4b5e5cf05c1fa4
+33 -10
View File
@@ -95,9 +95,22 @@ impl Extras {
} }
} }
/// The devices a subject covers: a person's are the devices they own; a group's, its members'; an app's, every /// The devices a subject covers: a person's are the devices they own; a group's, its members'; an app's, those
/// device. /// of its `on` (QA B-3: never every device of the mesh).
pub fn subject_devices(subject: &Subject, dir: &Directory, devs: &Devices) -> BTreeSet<DeviceKey> { pub fn subject_devices(
subject: &Subject,
on: Option<&Subject>,
dir: &Directory,
devs: &Devices,
) -> BTreeSet<DeviceKey> {
if let Subject::App(_) = subject {
return match on {
Some(s @ (Subject::Person(_) | Subject::Group(_) | Subject::Device(_))) => {
subject_devices(s, None, dir, devs)
}
_ => BTreeSet::new(),
};
}
devs.devices devs.devices
.values() .values()
.filter(|d| match subject { .filter(|d| match subject {
@@ -107,7 +120,7 @@ pub fn subject_devices(subject: &Subject, dir: &Directory, devs: &Devices) -> BT
.get(g) .get(g)
.is_some_and(|g| d.owner.as_ref().is_some_and(|o| g.members.contains(o))), .is_some_and(|g| d.owner.as_ref().is_some_and(|o| g.members.contains(o))),
Subject::Device(k) => &d.key == k, Subject::Device(k) => &d.key == k,
Subject::App(_) => true, Subject::App(_) => false,
}) })
.map(|d| d.key.clone()) .map(|d| d.key.clone())
.collect() .collect()
@@ -133,6 +146,7 @@ impl Index {
fn devices_of( fn devices_of(
&self, &self,
subject: &Subject, subject: &Subject,
on: Option<&Subject>,
dir: &Directory, dir: &Directory,
devs: &Devices, devs: &Devices,
) -> BTreeSet<DeviceKey> { ) -> BTreeSet<DeviceKey> {
@@ -156,7 +170,12 @@ impl Index {
.then(|| k.clone()) .then(|| k.clone())
.into_iter() .into_iter()
.collect(), .collect(),
Subject::App(_) => devs.devices.keys().cloned().collect(), Subject::App(_) => match on {
Some(s @ (Subject::Person(_) | Subject::Group(_) | Subject::Device(_))) => {
self.devices_of(s, None, dir, devs)
}
_ => BTreeSet::new(),
},
} }
} }
} }
@@ -172,19 +191,23 @@ fn check(
let p = |field: &str, code, msg: String| { let p = |field: &str, code, msg: String| {
Problem::error(&road.path, Some(field), code, msg).at(road.line_of(field)) Problem::error(&road.path, Some(field), code, msg).at(road.line_of(field))
}; };
match &road.subject { let (field, who) = match (&road.subject, &road.on) {
(Subject::App(_), Some(on)) => ("on", on),
(s, _) => ("subject", s),
};
match who {
Subject::Person(id) if !dir.people.contains_key(id) => out.push(p( Subject::Person(id) if !dir.people.contains_key(id) => out.push(p(
"subject", field,
r::SUBJECT_UNKNOWN, r::SUBJECT_UNKNOWN,
format!("person `{id}` is not in directory.json"), format!("person `{id}` is not in directory.json"),
)), )),
Subject::Group(id) if !dir.groups.contains_key(id) => out.push(p( Subject::Group(id) if !dir.groups.contains_key(id) => out.push(p(
"subject", field,
r::SUBJECT_UNKNOWN, r::SUBJECT_UNKNOWN,
format!("group `{id}` is not in directory.json"), format!("group `{id}` is not in directory.json"),
)), )),
Subject::Device(k) if !devs.devices.contains_key(k) => out.push(p( Subject::Device(k) if !devs.devices.contains_key(k) => out.push(p(
"subject", field,
r::SUBJECT_UNKNOWN, r::SUBJECT_UNKNOWN,
format!("device {} is not in devices.json", k.short()), format!("device {} is not in devices.json", k.short()),
)), )),
@@ -370,7 +393,7 @@ pub fn compile(store: &Store, now: Instant) -> Compiled {
let mut roads: Vec<&Road> = store.roads.iter().collect(); let mut roads: Vec<&Road> = store.roads.iter().collect();
roads.sort_by(|a, b| a.id.cmp(&b.id)); roads.sort_by(|a, b| a.id.cmp(&b.id));
for road in roads { for road in roads {
let subject = index.devices_of(&road.subject, dir, devs); let subject = index.devices_of(&road.subject, road.on.as_ref(), dir, devs);
let problems = check(road, dir, devs, &subject); let problems = check(road, dir, devs, &subject);
if !problems.is_empty() { if !problems.is_empty() {
out.problems.extend(problems); out.problems.extend(problems);
+68 -4
View File
@@ -15,12 +15,12 @@ use std::fmt;
pub const MAX_FILE: usize = 256 * 1024; pub const MAX_FILE: usize = 256 * 1024;
pub const REQUIRED: [&str; 4] = ["id", "subject", "verb", "created"]; pub const REQUIRED: [&str; 4] = ["id", "subject", "verb", "created"];
pub const OPTIONAL: [&str; 5] = ["object", "until", "ports", "via", "classic"]; pub const OPTIONAL: [&str; 6] = ["on", "object", "until", "ports", "via", "classic"];
/// Optional keys whose absence is their widest value; present but empty is `key.empty`. /// Optional keys whose absence is their widest value; present but empty is `key.empty`.
pub const NARROWING: [&str; 2] = ["until", "ports"]; pub const NARROWING: [&str; 2] = ["until", "ports"];
/// The canonical key order. /// The canonical key order.
pub const ORDER: [&str; 9] = [ pub const ORDER: [&str; 10] = [
"id", "subject", "verb", "object", "until", "ports", "via", "classic", "created", "id", "subject", "on", "verb", "object", "until", "ports", "via", "classic", "created",
]; ];
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -282,6 +282,9 @@ pub struct Road {
pub path: String, pub path: String,
pub id: RoadId, pub id: RoadId,
pub subject: Subject, pub subject: Subject,
/// For an `app:` subject only: whose devices the app's road applies to (a person, a group or a device).
/// Without it an app road would change the tunnel of every device in the mesh (QA B-3).
pub on: Option<Subject>,
pub verb: Verb, pub verb: Verb,
pub object: Option<Place>, pub object: Option<Place>,
pub until: Option<Timestamp>, pub until: Option<Timestamp>,
@@ -310,7 +313,15 @@ impl Road {
Subject::Device(k) => format!("device:{}", dev(k)), Subject::Device(k) => format!("device:{}", dev(k)),
s => s.to_string(), s => s.to_string(),
}; };
let mut out = format!("{subject} {}", self.verb); let mut out = subject;
if let Some(on) = &self.on {
let on = match on {
Subject::Device(k) => format!("device:{}", dev(k)),
s => s.to_string(),
};
out.push_str(&format!(" on {on}"));
}
out.push_str(&format!(" {}", self.verb));
match &self.object { match &self.object {
Some(Place::Device(k)) => out.push_str(&format!(" device:{}", dev(k))), Some(Place::Device(k)) => out.push_str(&format!(" device:{}", dev(k))),
Some(Place::Exit(k)) => out.push_str(&format!(" exit:{}", dev(k))), Some(Place::Exit(k)) => out.push_str(&format!(" exit:{}", dev(k))),
@@ -351,6 +362,9 @@ impl Road {
}; };
field("id", self.id.to_string()); field("id", self.id.to_string());
field("subject", scalar(self.subject.to_string())); field("subject", scalar(self.subject.to_string()));
if let Some(on) = &self.on {
field("on", scalar(on.to_string()));
}
field("verb", self.verb.to_string()); field("verb", self.verb.to_string());
if let Some(o) = &self.object { if let Some(o) = &self.object {
field("object", scalar(o.to_string())); field("object", scalar(o.to_string()));
@@ -590,6 +604,55 @@ impl Road {
} }
}); });
// `on` belongs to an app subject, and an app subject needs it (QA B-3).
let is_app = matches!(subject, Some(Subject::App(_)));
let on = if subject.is_some() && !is_app {
if line_of.contains_key("on") {
problems.push(p(
"on",
r::KEY_FORBIDDEN,
"only an app: road takes `on`".into(),
));
}
None
} else if is_app {
match single("on", &mut problems) {
None => {
problems.push(
Problem::error(
path,
Some("on"),
r::KEY_MISSING,
"an app: road says whose devices it is for: `on: person:<id>`, `group:<id>` or `device:<key>`",
)
.at(at("on")),
);
None
}
Some(s) => match parse_ref(&s) {
Err((code, m)) => {
problems.push(p("on", code, m));
None
}
Ok(Ref::S(sub @ (Subject::Person(_) | Subject::Group(_)))) => Some(sub),
Ok(Ref::P(Place::Device(d))) => Some(Subject::Device(d)),
Ok(rf) => {
problems.push(p(
"on",
r::SUBJECT_KIND,
format!(
"`on` takes person, group or device, not {}",
rf.kind().name()
),
));
None
}
},
}
} else {
None
};
if let Some(v) = verb { if let Some(v) = verb {
for k in OPTIONAL { for k in OPTIONAL {
if !v.takes(k) && line_of.contains_key(k) { if !v.takes(k) && line_of.contains_key(k) {
@@ -782,6 +845,7 @@ impl Road {
path: path.to_string(), path: path.to_string(),
id, id,
subject, subject,
on,
verb, verb,
object, object,
until, until,
+1 -12
View File
@@ -39,17 +39,6 @@
"dns": [], "dns": [],
"exit": null, "exit": null,
"kill_switch": null, "kill_switch": null,
"direct": [ "direct": [],
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.7/32"
],
"roads": [
"e5yj1s"
]
}
],
"custom": [] "custom": []
} }
+1 -13
View File
@@ -38,18 +38,6 @@
], ],
"exit": null, "exit": null,
"kill_switch": null, "kill_switch": null,
"direct": [ "direct": [],
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32",
"100.96.1.2/32"
],
"roads": [
"e5yj1s"
]
}
],
"custom": [] "custom": []
} }
+1 -13
View File
@@ -38,18 +38,6 @@
], ],
"exit": null, "exit": null,
"kill_switch": null, "kill_switch": null,
"direct": [ "direct": [],
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32",
"100.96.1.2/32"
],
"roads": [
"e5yj1s"
]
}
],
"custom": [] "custom": []
} }
+1 -10
View File
@@ -34,15 +34,6 @@
] ]
}, },
"kill_switch": null, "kill_switch": null,
"direct": [ "direct": [],
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [],
"roads": [
"e5yj1s"
]
}
],
"custom": [] "custom": []
} }
+1 -13
View File
@@ -29,19 +29,7 @@
"dns": [], "dns": [],
"exit": null, "exit": null,
"kill_switch": null, "kill_switch": null,
"direct": [ "direct": [],
{
"app": "steam",
"subnet": "0.0.0.0/0",
"except": [
"100.96.0.2/32",
"100.96.1.2/32"
],
"roads": [
"e5yj1s"
]
}
],
"custom": [ "custom": [
{ {
"road": "x1d7qa", "road": "x1d7qa",
@@ -1,8 +1,9 @@
--- ---
id: e5yj1s id: e5yj1s
subject: app:steam subject: app:steam
on: person:mark
verb: goes-direct verb: goes-direct
object: subnet:0.0.0.0/0 object: subnet:0.0.0.0/0
created: 2026-11-21T18:30:00+01:00 created: 2026-11-21T18:30:00+01:00
--- ---
Games do not go through the tunnel. Mark's games do not go through the tunnel.
+4
View File
@@ -48,6 +48,10 @@ road a00046-until-comment.md key.empty until
road a00047-empty-ports.md key.empty ports road a00047-empty-ports.md key.empty ports
road a00048-direct-mesh.md direct.mesh object road a00048-direct-mesh.md direct.mesh object
road a00049-direct-tunnelled.md direct.tunnelled object road a00049-direct-tunnelled.md direct.tunnelled object
road a00050-app-everyone.md key.missing on
road a00051-on-not-app.md key.forbidden on
road a00052-on-nobody.md subject.unknown on
road a00053-on-service.md subject.kind on
directory unknown-field.directory.json snapshot.json - directory unknown-field.directory.json snapshot.json -
directory format-two.directory.json snapshot.format format directory format-two.directory.json snapshot.format format
directory bad-person-id.directory.json directory.id people[3].id directory bad-person-id.directory.json directory.id people[3].id
@@ -0,0 +1,7 @@
---
id: a00050
subject: app:steam
verb: goes-direct
object: subnet:0.0.0.0/0
created: 2026-11-25T10:00:00+01:00
---
@@ -0,0 +1,8 @@
---
id: a00051
subject: person:jana
on: person:mark
verb: goes-direct
object: subnet:0.0.0.0/0
created: 2026-11-25T10:00:00+01:00
---
@@ -0,0 +1,8 @@
---
id: a00052
subject: app:steam
on: person:nobody
verb: goes-direct
object: subnet:0.0.0.0/0
created: 2026-11-25T10:00:00+01:00
---
@@ -0,0 +1,8 @@
---
id: a00053
subject: app:steam
on: service:photos.home.arpa
verb: goes-direct
object: subnet:0.0.0.0/0
created: 2026-11-25T10:00:00+01:00
---
+5 -4
View File
@@ -68,7 +68,8 @@ enum Subj {
Person(usize), Person(usize),
Group(usize), Group(usize),
Device(usize), Device(usize),
App, /// An app on a person's devices (QA B-3).
App(usize),
} }
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
@@ -145,7 +146,7 @@ fn world(bytes: &[u8]) -> World {
// Indices one past the end name things that do not exist. // Indices one past the end name things that do not exist.
let subject = match (s.n(4), &verb) { let subject = match (s.n(4), &verb) {
(_, Verb::Custom) => Subj::Device(s.n(n_dev + 1)), (_, Verb::Custom) => Subj::Device(s.n(n_dev + 1)),
(3, Verb::Direct) => Subj::App, (3, Verb::Direct) => Subj::App(s.n(people + 1)),
(0, _) | (3, _) => Subj::Person(s.n(people + 1)), (0, _) | (3, _) => Subj::Person(s.n(people + 1)),
(1, _) => Subj::Group(s.n(3)), (1, _) => Subj::Group(s.n(3)),
_ => Subj::Device(s.n(n_dev + 1)), _ => Subj::Device(s.n(n_dev + 1)),
@@ -302,7 +303,7 @@ fn to_store(w: &World, roads: &[(usize, &R)], when: Instant) -> Store {
Subj::Person(p) => format!("subject: person:p{p}\n"), Subj::Person(p) => format!("subject: person:p{p}\n"),
Subj::Group(g) => format!("subject: group:g{g}\n"), Subj::Group(g) => format!("subject: group:g{g}\n"),
Subj::Device(d) => format!("subject: device:{}\n", dev_key(*d)), Subj::Device(d) => format!("subject: device:{}\n", dev_key(*d)),
Subj::App => "subject: app:games\n".into(), Subj::App(p) => format!("subject: app:games\non: person:p{p}\n"),
}; };
t += match r.verb { t += match r.verb {
Verb::Reach => "verb: can-reach\n", Verb::Reach => "verb: can-reach\n",
@@ -355,7 +356,7 @@ fn subj_devs(w: &World, s: &Subj) -> BTreeSet<usize> {
.get(*g) .get(*g)
.is_some_and(|m| w.devs[d].owner.is_some_and(|o| m.contains(&o))), .is_some_and(|m| w.devs[d].owner.is_some_and(|o| m.contains(&o))),
Subj::Device(x) => *x == d, Subj::Device(x) => *x == d,
Subj::App => true, Subj::App(p) => w.devs[d].owner == Some(*p),
}) })
.collect() .collect()
} }
+26
View File
@@ -364,3 +364,29 @@ fn f09_an_emptied_narrowing_condition_is_an_error() {
); );
} }
} }
/// B-3. An `app:` road used to reach every device in the mesh, other people's included: `app:steam goes-direct
/// 0.0.0.0/0` changed the tunnel of Jana's phone, Petr's friend node and a classic router. An app road now names
/// whose devices it is for (`on:`), and reaches only those.
#[test]
fn b3_an_app_road_reaches_only_the_devices_it_is_on() {
let c = Parts::home().compile();
let steam = |k: u8| c.plans[&key(k)].direct.iter().any(|d| d.app.is_some());
assert!(steam(2), "mark's home server runs the road");
for (k, who) in [
(3, "jana-phone"),
(4, "jana-laptop"),
(5, "router"),
(6, "friend-node"),
(7, "petr-phone"),
] {
assert!(!steam(k), "{who} is not mark's, and its tunnel changed");
}
// The same road for Jana moves to Jana's devices.
let text = Parts::home()
.road_text("e5yj1s")
.replace("on: person:mark", "on: person:jana");
let c = Parts::home().replace_road("e5yj1s", &text).compile();
let steam = |k: u8| c.plans[&key(k)].direct.iter().any(|d| d.app.is_some());
assert!(steam(3) && steam(4) && !steam(2) && !steam(6));
}
+1 -1
View File
@@ -264,7 +264,7 @@ impl Renaming {
{ {
let v2 = match k { let v2 = match k {
"id" => self.new_of(v), "id" => self.new_of(v),
"subject" | "object" | "via" => self.reference(v), "subject" | "on" | "object" | "via" => self.reference(v),
_ => v.to_string(), _ => v.to_string(),
}; };
out.push_str(&format!("{k}: {v2}\n")); out.push_str(&format!("{k}: {v2}\n"));
+3 -2
View File
@@ -56,6 +56,7 @@ is not `key: value`, or a bad quoted string, is `yaml.syntax`.
|:--|:--|:--|:--| |:--|:--|:--|:--|
| `id` | yes | 6 characters of `0123456789abcdefghjkmnpqrstvwxyz` (no `i l o u`), random | `id.format`; must equal the file name's prefix (`id.file-name`); unique in the store (`id.duplicate`, both files grant nothing) | | `id` | yes | 6 characters of `0123456789abcdefghjkmnpqrstvwxyz` (no `i l o u`), random | `id.format`; must equal the file name's prefix (`id.file-name`); unique in the store (`id.duplicate`, both files grant nothing) |
| `subject` | yes | a reference (below): `person:`, `group:`, `device:` or `app:` | `ref.format`, `subject.kind` (not allowed for the verb), `subject.unknown` (not in the snapshots) | | `subject` | yes | a reference (below): `person:`, `group:`, `device:` or `app:` | `ref.format`, `subject.kind` (not allowed for the verb), `subject.unknown` (not in the snapshots) |
| `on` | yes for an `app:` subject, not allowed otherwise | a reference: `person:`, `group:` or `device:`: whose devices the app road applies to | `key.missing`, `key.forbidden`, `ref.format`, `subject.kind`, `subject.unknown`. Without it an app road would change the tunnel of every device in the mesh, other people's included (QA B-3) |
| `verb` | yes | `can-reach`, `exits-through`, `goes-direct`, `never-online-without`, `custom` | `verb.unknown` | | `verb` | yes | `can-reach`, `exits-through`, `goes-direct`, `never-online-without`, `custom` | `verb.unknown` |
| `object` | yes, except `custom` (where it is not allowed) | a reference: `device:`, `subnet:`, `service:` or `exit:` | `ref.format`, `object.kind`, `object.unknown`, `object.not-exit`, `subnet.not-canonical`, `subnet.unrouted`, `service.shared` (a service that shares its address and a port with another: its rule would open both, QA F-01); a `goes-direct` subnet other than `/0` that holds a mesh address is `direct.mesh` (mesh traffic never goes direct, QA F-02) | | `object` | yes, except `custom` (where it is not allowed) | a reference: `device:`, `subnet:`, `service:` or `exit:` | `ref.format`, `object.kind`, `object.unknown`, `object.not-exit`, `subnet.not-canonical`, `subnet.unrouted`, `service.shared` (a service that shares its address and a port with another: its rule would open both, QA F-01); a `goes-direct` subnet other than `/0` that holds a mesh address is `direct.mesh` (mesh traffic never goes direct, QA F-02) |
| `until` | no | RFC 3339 with an offset: `2026-11-29T23:59:59+01:00` or `…Z`; exclusive | `until.format`; `until <= now` makes the road *inactive* (`road.expired`) | | `until` | no | RFC 3339 with an offset: `2026-11-29T23:59:59+01:00` or `…Z`; exclusive | `until.format`; `until <= now` makes the road *inactive* (`road.expired`) |
@@ -77,7 +78,7 @@ never widens a road (QA F-09). `ports: []` is `ports.format`.
| `person:<id>` | a person in `directory.json` | opaque: 1–64 of `[A-Za-z0-9_-]` (no people directory exists in Fundamentum yet) | | `person:<id>` | a person in `directory.json` | opaque: 1–64 of `[A-Za-z0-9_-]` (no people directory exists in Fundamentum yet) |
| `group:<id>` | a group in `directory.json` | as a person id | | `group:<id>` | a group in `directory.json` | as a person id |
| `device:<key>` | a device in `devices.json` | the Tessera device subkey: 32-byte Ed25519 public key, base64url without padding, 43 characters, canonical | | `device:<key>` | a device in `devices.json` | the Tessera device subkey: 32-byte Ed25519 public key, base64url without padding, 43 characters, canonical |
| `app:<id>` | a Domi app on every device | the Tessera id: 1–32 of `[a-z0-9-]`, not starting or ending with `-` | | `app:<id>` | a Domi app, on the devices its road's `on` names (QA B-3) | the Tessera id: 1–32 of `[a-z0-9-]`, not starting or ending with `-` |
| `subnet:<cidr>` | an IPv4 or IPv6 network | canonical: host bits zero (`192.168.100.0/24`, not `192.168.100.7/24`) and in the usual text form; IPv6 that embeds IPv4 (`::ffff:0:0/96`, `::/96`, `64:ff9b::/96`, `64:ff9b:1::/48`, `2002::/16`) is `ref.format`: write the IPv4 subnet | | `subnet:<cidr>` | an IPv4 or IPv6 network | canonical: host bits zero (`192.168.100.0/24`, not `192.168.100.7/24`) and in the usual text form; IPv6 that embeds IPv4 (`::ffff:0:0/96`, `::/96`, `64:ff9b::/96`, `64:ff9b:1::/48`, `2002::/16`) is `ref.format`: write the IPv4 subnet |
| `service:<hostname>` | an Ianitor host, served by a device in `devices.json` | Ianitor's hostname rules: lowercase, labels of `[a-z0-9-]` not starting or ending with `-`, at most 63 per label and 253 in all, no wildcard, no trailing dot, not an IP address | | `service:<hostname>` | an Ianitor host, served by a device in `devices.json` | Ianitor's hostname rules: lowercase, labels of `[a-z0-9-]` not starting or ending with `-`, at most 63 per label and 253 in all, no wildcard, no trailing dot, not an IP address |
| `exit:<key>` | a device with `exit: true` | a device key | | `exit:<key>` | a device with `exit: true` | a device key |
@@ -97,7 +98,7 @@ Everything after the closing `---`.
### Canonical form ### Canonical form
The form `via` writes, and which reads back byte for byte: `---`, then the keys in the order `id, subject, verb, The form `via` writes, and which reads back byte for byte: `---`, then the keys in the order `id, subject, on, verb,
object, until, ports, via, classic, created`, absent keys left out, scalars plain when they read back unchanged object, until, ports, via, classic, created`, absent keys left out, scalars plain when they read back unchanged
and double-quoted otherwise, `ports` as a flow list, LF line endings, `---`, then the body. A custom road's body and double-quoted otherwise, `ports` as a flow list, LF line endings, `---`, then the body. A custom road's body
is ```` ```raw\n ```` + raw + ```` ```\n ````. is ```` ```raw\n ```` + raw + ```` ```\n ````.