Refuse cargo tests in approved_tests and strip merge-train leftovers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vtroc7
2026-10-02 16:59:07 +03:00
parent 2bcedf97fe
commit dc1ea70cfe
7 changed files with 16 additions and 23 deletions
+3 -4
View File
@@ -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
@@ -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<ModelSkel>, materials: &MaterialCatalog) {
let key = (self.capture_ns, skel.name.clone());
if !self.entries.contains_key(&key) {
+2
View File
@@ -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 {
+4 -1
View File
@@ -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(),
+1 -2
View File
@@ -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.
+6 -12
View File
@@ -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(())
}
-1
View File
@@ -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)))