d6694d0641
Iteration 2 of the self-description plan: field presence is compile-
enforced since iteration 1, but an extension crate can still ship the
empty-string alibi (or a name-restating doc) the compiler cannot see.
load_crate now walks every charter-checked type id, resolves its
builder, and runs aura_core::doc_gate over schema.doc; a fault refuses
the load via ProjectError::UndescribedVocabularyEntry { type_id, fault }
(exit 1 through the CLI's Display-driven surface, C14).
The variant carries the DocGateFault beyond the spec's minimal sketch
because the spec's error-handling section requires the refusal to name
entry + field + rule -- with only the type id the prose could not
distinguish the two faults (decision logged on #316).
Two gate-failing fixture crates drive the e2e, modelled on
badcharter-project: undescribed-project (und::Opaque, doc: "") for the
Empty arm, restated-project (restated::Echo, doc: "Restated Echo") for
the RestatesName arm -- the second contributed by the E2E phase to
close the only-unit-pinned gap on that arm. A runner unit test pins
both rendered Display arms directly. The described twins (demo-project,
nested-nodes-project) stay green and are now load-bearing for the gate.
Gates: cargo test -p aura-cli --test project_load (14 green, incl. both
refusal e2es); cargo test --workspace green; clippy -D warnings clean.
refs #316
84 lines
2.3 KiB
Rust
84 lines
2.3 KiB
Rust
//! Fixture project for the C29 load-seam e2e (#316): one fully resolvable
|
|
//! pass-through node under the `restated` namespace whose `NodeSchema` doc
|
|
//! merely restates its own type id (`DocGateFault::RestatesName`, the fault
|
|
//! arm `undescribed-project` does not exercise). The charter is satisfied
|
|
//! (prefixed id, list/resolver in sync) so the refusal under test is exactly
|
|
//! the doc gate's name-restatement branch.
|
|
|
|
use aura_core::{
|
|
Cell, Ctx, FieldSpec, Firing, Node, NodeSchema, PortSpec, PrimitiveBuilder,
|
|
ScalarKind,
|
|
};
|
|
|
|
/// One-input f64 pass-through whose doc is a no-content restatement of its
|
|
/// own name.
|
|
pub struct Echo {
|
|
out: [Cell; 1],
|
|
}
|
|
|
|
impl Echo {
|
|
pub fn new() -> Self {
|
|
Self { out: [Cell::from_f64(0.0)] }
|
|
}
|
|
pub fn builder() -> PrimitiveBuilder {
|
|
PrimitiveBuilder::new(
|
|
"restated::Echo",
|
|
NodeSchema {
|
|
inputs: vec![PortSpec {
|
|
kind: ScalarKind::F64,
|
|
firing: Firing::Any,
|
|
name: "value".into(),
|
|
}],
|
|
output: vec![FieldSpec { name: "value".into(), kind: ScalarKind::F64 }],
|
|
params: vec![],
|
|
// The one deliberate violation this fixture exists for: this
|
|
// norm-equals the type id "restated::Echo" once punctuation
|
|
// and case are stripped, so it carries no meaning beyond the
|
|
// name itself.
|
|
doc: "Restated Echo",
|
|
},
|
|
|_| Box::new(Echo::new()),
|
|
)
|
|
}
|
|
}
|
|
|
|
impl Default for Echo {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl Node for Echo {
|
|
fn lookbacks(&self) -> Vec<usize> {
|
|
vec![1]
|
|
}
|
|
fn eval(&mut self, ctx: Ctx<'_>) -> Option<&[Cell]> {
|
|
let w = ctx.f64_in(0);
|
|
if w.is_empty() {
|
|
return None;
|
|
}
|
|
self.out[0] = Cell::from_f64(w[0]);
|
|
Some(&self.out)
|
|
}
|
|
fn label(&self) -> String {
|
|
"restated::Echo".to_string()
|
|
}
|
|
}
|
|
|
|
fn vocabulary(type_id: &str) -> Option<PrimitiveBuilder> {
|
|
match type_id {
|
|
"restated::Echo" => Some(Echo::builder()),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
fn type_ids() -> &'static [&'static str] {
|
|
&["restated::Echo"]
|
|
}
|
|
|
|
aura_core::aura_project! {
|
|
namespace: "restated",
|
|
vocabulary: vocabulary,
|
|
type_ids: type_ids,
|
|
}
|