From dc1ea70cfe91cb600c68ff2d6739a1583dceff3f Mon Sep 17 00:00:00 2001 From: vtroc7 Date: Fri, 2 Oct 2026 16:59:07 +0300 Subject: [PATCH] Refuse cargo tests in approved_tests and strip merge-train leftovers Co-Authored-By: Claude Opus 5.5 --- crates/approved_tests/README.md | 7 +++---- crates/asset_game/src/fx_model_catalog.rs | 3 --- crates/asset_game/src/menu_catalog.rs | 2 ++ crates/ui/src/menu.rs | 5 ++++- docs/RUN.md | 3 +-- xtask/src/publish_check.rs | 18 ++++++------------ xtask/src/shell.rs | 1 - 7 files changed, 16 insertions(+), 23 deletions(-) diff --git a/crates/approved_tests/README.md b/crates/approved_tests/README.md index cb56aa6..9ef7ea9 100644 --- a/crates/approved_tests/README.md +++ b/crates/approved_tests/README.md @@ -8,10 +8,9 @@ must be deleted before the final squash/push unless specifically approved. A useful test is not automatically an approved test. A new permanent scenario is added here only after the owner has approved that -scenario by name. The same holds for a unit test inside this crate: being -useful does not make it approved. `make publish-check` refuses `#[test]`, -`#[cfg(test)]`, `mod tests` and `tests/` directories anywhere else in the -workspace. +scenario by name, as a scenario the runner drives, never as a `cargo test`. +`make publish-check` refuses `#[test]`, `#[cfg(test)]`, `mod tests` and `tests/` +directories everywhere in the workspace, this crate included. ## Approved scenarios diff --git a/crates/asset_game/src/fx_model_catalog.rs b/crates/asset_game/src/fx_model_catalog.rs index bc1dbe5..d69ac43 100644 --- a/crates/asset_game/src/fx_model_catalog.rs +++ b/crates/asset_game/src/fx_model_catalog.rs @@ -83,9 +83,6 @@ impl FxModelCatalog { self.capture_shared(Arc::new(skel), materials); } - /// [`Self::capture`] for a skeleton another catalog already decoded from - /// the same stream, strings and materials; the entry shares it rather than - /// holding a second decode. pub fn capture_shared(&mut self, skel: Arc, materials: &MaterialCatalog) { let key = (self.capture_ns, skel.name.clone()); if !self.entries.contains_key(&key) { diff --git a/crates/asset_game/src/menu_catalog.rs b/crates/asset_game/src/menu_catalog.rs index 2c09afd..1b5beee 100644 --- a/crates/asset_game/src/menu_catalog.rs +++ b/crates/asset_game/src/menu_catalog.rs @@ -19,6 +19,8 @@ pub const ITEM_TYPE_BUTTON: i32 = 1; pub const ITEM_TYPE_TEXT: i32 = 0; +pub const ITEM_TYPE_SLIDER: i32 = 10; + #[derive(Clone, Copy, Debug, Default, serde::Deserialize, serde::Serialize)] #[serde(default, deny_unknown_fields)] pub struct MenuRect { diff --git a/crates/ui/src/menu.rs b/crates/ui/src/menu.rs index 22ebd12..1e85c93 100644 --- a/crates/ui/src/menu.rs +++ b/crates/ui/src/menu.rs @@ -77,7 +77,10 @@ pub fn install_frontend_menus(catalog: &mut asset_game::MenuCatalog) -> Result<( .iter() .find(|item| item.text_key == "@MENU_MOUSE_SENSITIVITY") .map(|label| label.rect.y) - && let Some(item) = menu.items.iter_mut().find(|item| item.item_type == 10) + && let Some(item) = menu + .items + .iter_mut() + .find(|item| item.item_type == asset_game::ITEM_TYPE_SLIDER) { *item = asset_game::MenuItem { name: "look_sensitivity".into(), diff --git a/docs/RUN.md b/docs/RUN.md index 939ebed..3c3b940 100644 --- a/docs/RUN.md +++ b/docs/RUN.md @@ -19,8 +19,7 @@ scenario`, `chaos`, `bench` ([`BENCH.md`](BENCH.md)), `bench-live`, `lifecycle-* actions: `move`, `look`, `tp`, `nudge`, `god`, `kill`, `damage`, `force_spawn`, `force_match_start`, `rotatevelocity` and the `give` supply commands. `--no-cheats` turns them off for `map`, `serve` and `menu`; a lobby host toggles them in the -game setup. With cheats off the host refuses these actions, and a listen host -echoes `cheats are off`. +game setup. **GSC controls the start freeze.** `freezecontrols` constrains authority movement; snapshots carry the same constraints into client prediction and command replay. diff --git a/xtask/src/publish_check.rs b/xtask/src/publish_check.rs index 43137bf..5f29eb5 100644 --- a/xtask/src/publish_check.rs +++ b/xtask/src/publish_check.rs @@ -49,15 +49,9 @@ const EXEMPT: &[&str] = &[ "xtask/src/publish_check.rs", ]; -/// The one crate allowed to hold tests; see its README for the policy. -const APPROVED_TESTS: &str = "crates/approved_tests/"; - fn stray_test(rel: &str, text: &str) -> Option<(usize, &'static str)> { - if rel.starts_with(APPROVED_TESTS) { - return None; - } if rel.split('/').rev().skip(1).any(|part| part == "tests") { - return Some((0, "tests/ directory outside crates/approved_tests")); + return Some((0, "tests/ directory")); } if !rel.ends_with(".rs") { return None; @@ -70,7 +64,7 @@ fn stray_test(rel: &str, text: &str) -> Option<(usize, &'static str)> { || line .strip_prefix("mod tests") .is_some_and(|rest| rest.starts_with([' ', '{', ';']) || rest.is_empty()); - hit.then_some((n + 1, "test outside crates/approved_tests")) + hit.then_some((n + 1, "cargo test")) }) } @@ -505,14 +499,14 @@ pub fn run_cli(root: &Path) -> Res<()> { } if !tests.is_empty() { return Err(format!( - "{} test(s) outside crates/approved_tests; only owner-approved \ - scenarios are permanent, everything else is deleted before a push", + "{} cargo test(s) in the tracked tree; the only permanent tests are \ + the owner-approved scenarios in crates/approved_tests", tests.len() )); } println!( - "publish-check: clean — nothing but the product is tracked, no test outside \ - crates/approved_tests, and no retail offsets in the {scanned} text file(s) read" + "publish-check: clean — nothing but the product is tracked, no cargo test, \ + and no retail offsets in the {scanned} text file(s) read" ); Ok(()) } diff --git a/xtask/src/shell.rs b/xtask/src/shell.rs index dd402db..8d4ccd1 100644 --- a/xtask/src/shell.rs +++ b/xtask/src/shell.rs @@ -27,7 +27,6 @@ pub fn tool_on_path(name: &str) -> bool { let Some(path) = std::env::var_os("PATH") else { return false; }; - // Windows executables carry `.exe` (rustup installs `rustfmt.exe`). let exe = format!("{name}{}", std::env::consts::EXE_SUFFIX); std::env::split_paths(&path) .any(|dir| is_executable(&dir.join(name)) || is_executable(&dir.join(&exe)))