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
79 lines
2.0 KiB
Rust
79 lines
2.0 KiB
Rust
//! Fixture project for the C29 load-seam e2e (#316): one fully resolvable
|
|
//! pass-through node under the `und` namespace whose `NodeSchema` carries the
|
|
//! empty-string alibi `doc: ""` — compile-legal (the field is present), but
|
|
//! the load gate must refuse it. The charter is satisfied (prefixed id,
|
|
//! list/resolver in sync) so the refusal under test is exactly the doc gate.
|
|
|
|
use aura_core::{
|
|
Cell, Ctx, FieldSpec, Firing, Node, NodeSchema, PortSpec, PrimitiveBuilder,
|
|
ScalarKind,
|
|
};
|
|
|
|
/// One-input f64 pass-through with a deliberately empty doc.
|
|
pub struct Opaque {
|
|
out: [Cell; 1],
|
|
}
|
|
|
|
impl Opaque {
|
|
pub fn new() -> Self {
|
|
Self { out: [Cell::from_f64(0.0)] }
|
|
}
|
|
pub fn builder() -> PrimitiveBuilder {
|
|
PrimitiveBuilder::new(
|
|
"und::Opaque",
|
|
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.
|
|
doc: "",
|
|
},
|
|
|_| Box::new(Opaque::new()),
|
|
)
|
|
}
|
|
}
|
|
|
|
impl Default for Opaque {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl Node for Opaque {
|
|
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 {
|
|
"und::Opaque".to_string()
|
|
}
|
|
}
|
|
|
|
fn vocabulary(type_id: &str) -> Option<PrimitiveBuilder> {
|
|
match type_id {
|
|
"und::Opaque" => Some(Opaque::builder()),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
fn type_ids() -> &'static [&'static str] {
|
|
&["und::Opaque"]
|
|
}
|
|
|
|
aura_core::aura_project! {
|
|
namespace: "und",
|
|
vocabulary: vocabulary,
|
|
type_ids: type_ids,
|
|
}
|