From 034c1c6e37bd0e7045ba5868ba23703d4d99272c Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Tue, 17 Mar 2026 12:25:07 +0100 Subject: [PATCH] fix(simulation): apply PR #94 review suggestions - validate_ron: add eligible_roles referential integrity check against defined RoleSpec.id values in zone-type templates - v01-yaml-content-audit.md: fix grep path from data/templates to server/data/templates in the superseded-files verification command - pre-commit hook: comment out nonexistent check-decision-ids script to stop per-commit warnings until the script is implemented Co-Authored-By: Claude Opus 4.6 (1M context) --- .config/hooks/pre-commit | 3 ++- docs/architecture/v01-yaml-content-audit.md | 2 +- server/src/bin/validate_ron.rs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.config/hooks/pre-commit b/.config/hooks/pre-commit index a8c204623..a9012e26c 100755 --- a/.config/hooks/pre-commit +++ b/.config/hooks/pre-commit @@ -21,7 +21,8 @@ run_check() { # --- Checks --- run_check "tooling/check-fact-ids" "fact_id validation" -run_check "tooling/check-decision-ids" "decision ID duplication" +# TODO: uncomment when tooling/check-decision-ids is implemented +# run_check "tooling/check-decision-ids" "decision ID duplication" # Run cargo audit only when Cargo.toml or Cargo.lock changed if git diff --cached --name-only | grep -qE '(Cargo\.toml|Cargo\.lock)$'; then diff --git a/docs/architecture/v01-yaml-content-audit.md b/docs/architecture/v01-yaml-content-audit.md index 01d33daaa..0c26d19f6 100644 --- a/docs/architecture/v01-yaml-content-audit.md +++ b/docs/architecture/v01-yaml-content-audit.md @@ -86,7 +86,7 @@ These files were authored before the RON zone-type system. The zone-type RON fil | `server/data/templates/terminal-social-site.yaml` | Social site definitions in RON zone-type files | | `server/data/templates/terminal-triangle-01.yaml` | Triangle definitions will move to RON format via #663 | -**Edge case:** verify with `grep -r "data/templates"` that no Rust code still loads these paths before deletion. The `generator_spike.rs` binary uses `content/global/` paths, not `data/templates/`. +**Edge case:** verify with `grep -r "data/templates" server/src/` that no Rust code still loads these paths before deletion. The `generator_spike.rs` binary uses `content/global/` paths, not `data/templates/`. --- diff --git a/server/src/bin/validate_ron.rs b/server/src/bin/validate_ron.rs index 22bcb27be..b7c070b37 100644 --- a/server/src/bin/validate_ron.rs +++ b/server/src/bin/validate_ron.rs @@ -122,6 +122,8 @@ fn main() { eprintln!(" WARNING: no roles defined — generator will reject this"); warnings += 1; } + let role_ids: Vec<&str> = + template.roles.iter().map(|r| r.id.as_str()).collect(); for role in &template.roles { if role.behavior_primitives.is_empty() { eprintln!( @@ -131,6 +133,17 @@ fn main() { warnings += 1; } } + for site in &template.social_site_types { + for eligible in &site.eligible_roles { + if !role_ids.contains(&eligible.as_str()) { + eprintln!( + " WARNING: social site '{}' references eligible_role '{}' which is not a defined role", + site.site_type, eligible + ); + warnings += 1; + } + } + } if warnings > 0 { process::exit(1); }