From b04b56148d6e0873edaac5004096a015a4202209 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 23 Jul 2026 21:00:28 +0200 Subject: [PATCH] test(core): RED -- doc_gate refuses the namespaced short-name alibi Executable spec for the fieldtest spec_gap (decision on #316: tighten, not ratify): doc_gate("lab316_nodes::Scale", "Scale") must be Err(RestatesName) -- a doc normalizing to the final ::-segment of a namespaced entry name restates the name. Unnamespaced entries and genuine meaning lines containing the name stay Ok (guard assertions green). Currently red: the shipped check compares the full name only. refs #316 --- crates/aura-core/src/node.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/crates/aura-core/src/node.rs b/crates/aura-core/src/node.rs index dd5c1de..969f792 100644 --- a/crates/aura-core/src/node.rs +++ b/crates/aura-core/src/node.rs @@ -811,6 +811,25 @@ mod tests { assert_eq!(doc_gate("rolling_max", "Rolling Max"), Err(DocGateFault::RestatesName)); } + /// C29 tightening (#316 fieldtest): for a namespaced entry, the bare + /// display segment is a restatement too — a doc that adds nothing beyond + /// the name must not pass just because the name carries a `::` prefix. + /// Genuine meaning lines that merely *contain* the name stay legal. + #[test] + fn doc_gate_refuses_namespaced_short_name_restatement() { + // The most natural alibi at the extension-author seam: the node's + // own display name as its doc. + assert_eq!(doc_gate("lab316_nodes::Scale", "Scale"), Err(DocGateFault::RestatesName)); + // Guard: a real meaning line stays Ok even when it contains the + // short name as a substring... + assert_eq!( + doc_gate("lab316_nodes::Scale", "scalar gain: emits the input times the factor param"), + Ok(()) + ); + // ...and a namespaced entry with a genuine doc is untouched. + assert_eq!(doc_gate("und::Opaque", "one-input f64 pass-through"), Ok(())); + } + #[test] fn doc_gate_accepts_a_meaning_line() { assert_eq!(doc_gate("EMA", "exponential moving average over the input series"), Ok(()));