commit d66d9427693efcc202220f59e908ede3cfd5bf79
parent 5ba33666585800b5d0dfb26e591d14c56ba2e5c7
Author: triesap <tyson@radroots.org>
Date: Tue, 28 Jul 2026 20:43:27 +0000
event: admit canonical listing module
- exempt the approved event listing module from retired alias checks
- keep legacy listing paths and references rejected everywhere else
- add positive hygiene fixtures for the canonical root and module
- verify formatting hygiene source freshness and architecture gates
Diffstat:
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/xtask/src/hygiene.rs b/tools/xtask/src/hygiene.rs
@@ -343,7 +343,10 @@ fn reject_retired_listing_aliases(root: &Path, failures: &mut Vec<String>) {
line.trim()
));
}
- if is_listing_module_scope(&rel) && contains_retired_listing_module_reference(line) {
+ if is_listing_module_scope(&rel)
+ && !is_canonical_event_listing_module_reference(&rel, line)
+ && contains_retired_listing_module_reference(line)
+ {
failures.push(format!(
"retired listing public aliases must not reappear: {}:{}: {}",
rel,
@@ -379,6 +382,7 @@ fn is_identifier_continue(ch: char) -> bool {
fn is_retired_listing_module_path(rel: &str) -> bool {
is_listing_module_scope(rel)
+ && !is_canonical_event_listing_module_path(rel)
&& Path::new(rel).components().any(|component| {
component.as_os_str() == "listing"
|| Path::new(component.as_os_str())
@@ -387,6 +391,10 @@ fn is_retired_listing_module_path(rel: &str) -> bool {
})
}
+fn is_canonical_event_listing_module_path(rel: &str) -> bool {
+ rel == "crates/event/src/listing.rs" || rel.starts_with("crates/event/src/listing/")
+}
+
fn is_listing_module_scope(rel: &str) -> bool {
rel.starts_with("crates/event/src/")
|| rel.starts_with("crates/event/tests/")
@@ -408,6 +416,10 @@ fn contains_retired_listing_module_reference(line: &str) -> bool {
})
}
+fn is_canonical_event_listing_module_reference(rel: &str, line: &str) -> bool {
+ rel == "crates/event/src/lib.rs" && line.trim() == "pub mod listing;"
+}
+
fn is_retired_listing_negative_guard(rel: &str, line: &str) -> bool {
(rel == "crates/event/src/dto.rs" && line.contains("\"RadrootsListingCancel\""))
|| (rel == "crates/event/src/contract/registry_v7/tests.rs"
@@ -747,6 +759,12 @@ mod tests {
#[test]
fn listing_alias_guard_is_token_and_path_aware() {
let clean_root = unique_temp_dir("listing_alias_clean");
+ write_file(&clean_root, "crates/event/src/lib.rs", "pub mod listing;\n");
+ write_file(
+ &clean_root,
+ "crates/event/src/listing.rs",
+ "pub struct CanonicalListing;\n",
+ );
write_file(
&clean_root,
"crates/event/src/kinds.rs",