feat(rust): install the helpers a plugin release ships beside the bridge (D182)
All checks were successful
PR Checks / rust-gates (pull_request) Successful in 1m37s

Rust-Plugins now releases a ZoneManager helper, RunicGatewayZones.cs, beside
RunicGateway.cs (docs/modules/rust/PLAN_FIXES.md D181, D182), and the org lead
decided it is installed by default. The tarball reader took only the bridge,
so the helper would have been downloaded and dropped.

- plugin::read_tarball reads every other .cs the release's manifest lists in
  `files`, and refuses the release when one is missing, does not match its own
  sha256, or is not a plain `<Name>.cs` (the name is written into a plugins
  directory, so nothing in a tarball may reach outside it). A .cs the manifest
  does not list is ignored, so a release older than helpers has none.
- install/update place each helper before the bridge, in place like the
  bridge (Oxide and Carbon reload on a change, not on a rename), put back one
  that was deleted or edited, and remove one a later release stops shipping.
- The record gains per-instance `helpers` (path + sha256). It is absent from
  every record written before this and reads back as none.
- doctor warns — never fails — on a missing or edited helper and says what
  the bridge loses without it; uninstall removes helpers before the bridge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
2026-09-26 21:24:33 -05:00
parent 3a3676a22d
commit 9d9ee3344b
5 changed files with 384 additions and 14 deletions

View File

@@ -4,6 +4,8 @@
//! says where to look. Per instance (docs/modules/rust/PLAN.md §34.2.3):
//!
//! - the framework, and whether the plugin file is still the one deployed;
//! - each helper deployed beside it (D182), as a warning when it is gone or edited — the bridge
//! runs without one, and the row says what that costs;
//! - that the plugin's config names this instance;
//! - `requires_plugins` present, as a warning (D153);
//! - the service registered and running;
@@ -151,6 +153,31 @@ fn instance_rows(
)),
}
// ── The helpers: ours too, and optional to the bridge (D182) ─────────────
// A warning rather than a failure: the bridge runs without a helper and falls back. What is
// lost is said, so an operator who removed one on purpose knows what they chose.
for (name, helper) in &instance.helpers {
match std::fs::read(&helper.path) {
Ok(bytes) if crate::util::sha256_bytes(&bytes) == helper.sha256 => {
rows.push(Row::ok(&label("helper"), helper.path.clone()))
}
Ok(_) => rows.push(
Row::warn(
&label("helper"),
format!("{} is not the file that was deployed", helper.path),
)
.note(
"edited or replaced by hand; `update --game rust` puts the released one back",
),
),
Err(_) => rows.push(
Row::warn(&label("helper"), format!("{} is missing", helper.path))
.note(helper_absence(name))
.note("`update --game rust` puts it back"),
),
}
}
// ── The plugin's config: the website's ───────────────────────────────────
match plugin::read_config(Path::new(&instance.plugin_config)) {
Ok(Some(view)) if view.server_id.as_deref() == Some(id) => rows.push(Row::ok(
@@ -279,6 +306,18 @@ fn instance_rows(
}
/// Whether a newer Rust bundle than the installed one is published.
/// What a missing helper costs, in the operator's words. Unknown helpers get a generic line.
fn helper_absence(name: &str) -> String {
match name {
"RunicGatewayZones.cs" => {
"the bridge still runs and scores its zones by position, but ZoneManager's \
own flags miss anybody already standing in a zone when it is created or restored"
.to_string()
}
_ => format!("the bridge still runs without {name}; what it helped with falls back"),
}
}
fn bundle_row(record: &RustRecord) -> Row {
match bundle::fetch_rust(None) {
Ok((current, _)) if current.bundle == record.bundle.tag => {