Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
091a8acada | ||
|
|
ac7165e82d | ||
|
|
5a27b1f7ff | ||
|
|
32489e9f55 | ||
|
|
2dbfd278e1 | ||
|
|
0fbfecde26 | ||
| 1e06f00336 |
37 changed files with 72 additions and 1832 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -22,3 +22,4 @@ build/
|
||||||
.venv/
|
.venv/
|
||||||
venv/
|
venv/
|
||||||
target/
|
target/
|
||||||
|
docs/research/cultural-ontology/sources/pdfs/*.pdf
|
||||||
|
|
|
||||||
18
AGENTS.md
18
AGENTS.md
|
|
@ -41,16 +41,18 @@ Before substantial implementation, state:
|
||||||
|
|
||||||
## Persistent State
|
## Persistent State
|
||||||
|
|
||||||
The live state architecture is ported from EpiphanyAgent in reduced form:
|
Canonical campaign, body-map, and decision state lives in Weksa's Huginn mind:
|
||||||
|
|
||||||
- `state/map.yaml` is canonical and slow-changing.
|
- `EUREKA_INSTANCE=weksa`, `HUGINN_ENDPOINT=rudp://10.77.0.1:17877`
|
||||||
- `state/scratch.md` is temporary and disposable.
|
- `weksa-body` (Body map and substrate ownership) and `weksa-lowering` (campaign
|
||||||
- `schemas/` explains state contracts in human language.
|
state, rulings, and active decisions)
|
||||||
- `crates/weksa` owns executable typed state.
|
- `crates/weksa` owns executable typed state (CultCache stores for packets,
|
||||||
|
inventory, corpus, entities, ontology, speaker state, and golf-loop runs).
|
||||||
|
- `schemas/` holds published CultNet schemas generated from `crates/weksa`.
|
||||||
|
- `state/map.yaml` is a non-canonical pointer to Huginn and `crates/weksa`.
|
||||||
|
|
||||||
Project truth does not belong in agent personality memory. If Weksa later grows
|
Project truth does not belong in agent personality memory. Role dossiers or
|
||||||
role dossiers or heartbeat scheduling, those surfaces must remain separate from
|
heartbeat scheduling remain separate from language-project truth.
|
||||||
language-project truth.
|
|
||||||
|
|
||||||
## Building And Verifying
|
## Building And Verifying
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
//! process its forger controls can stop it.
|
//! process its forger controls can stop it.
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::marker::PhantomData;
|
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
|
@ -41,7 +40,7 @@ use crate::packet::{
|
||||||
Context, Discourse, EntityId, Extension, FeatValue, Grade, Predication, Referent, Relation, Stance,
|
Context, Discourse, EntityId, Extension, FeatValue, Grade, Predication, Referent, Relation, Stance,
|
||||||
};
|
};
|
||||||
use crate::run::LADDER_STEP;
|
use crate::run::LADDER_STEP;
|
||||||
use crate::split::{Checkpoint, Split, SplitScheme, fnv1a64, hex16};
|
use crate::split::{Split, SplitScheme, fnv1a64, hex16};
|
||||||
use crate::store::{CorpusStore, normalized};
|
use crate::store::{CorpusStore, normalized};
|
||||||
use crate::validate::{LoweringInput, SceneRead};
|
use crate::validate::{LoweringInput, SceneRead};
|
||||||
|
|
||||||
|
|
@ -179,71 +178,27 @@ pub enum OfferRefusal {
|
||||||
Withdrawn,
|
Withdrawn,
|
||||||
/// A model-written item of a Test group is in no split.
|
/// A model-written item of a Test group is in no split.
|
||||||
NoSplit,
|
NoSplit,
|
||||||
/// A Test item is offered only under a [`Checkpoint`].
|
/// A Test item is excluded from round offers.
|
||||||
TestBeforeCheckpoint,
|
TestItem,
|
||||||
/// An item is offered at most once under one [`Checkpoint`].
|
|
||||||
OfferedAtCheckpoint,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One item the encoder may be shown, with the entities a packet for it may
|
/// One item the encoder may be shown, with the entities a packet for it may
|
||||||
/// cite. Built per item, so a call sees one item and nothing of its group.
|
/// cite. Built per item, so a call sees one item and nothing of its group.
|
||||||
///
|
pub struct EncoderOffer {
|
||||||
/// An offer made under a [`Checkpoint`] borrows it, so it is dead before
|
|
||||||
/// `TestReadings::at_checkpoint` can spend the checkpoint, and a Test offer is
|
|
||||||
/// never encoded after (or beside) the reading. A round offer borrows nothing.
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use weksa::context::{EncoderOffer, TrainItems};
|
|
||||||
/// use weksa::split::Checkpoint;
|
|
||||||
/// use weksa::{CorpusItem, score::TestReadings};
|
|
||||||
/// fn f(mut c: Checkpoint, i: &CorpusItem, t: &TrainItems, inv: &weksa::Inventory) {
|
|
||||||
/// if let Ok(o) = EncoderOffer::for_checkpoint(i, &mut c) {
|
|
||||||
/// let _ = weksa::context::Prompt::encode(&o, t, inv, 1);
|
|
||||||
/// }
|
|
||||||
/// let _ = TestReadings::at_checkpoint(c, &[], &[], &[]);
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// use weksa::context::{EncoderOffer, TrainItems};
|
|
||||||
/// use weksa::split::Checkpoint;
|
|
||||||
/// use weksa::{CorpusItem, score::TestReadings};
|
|
||||||
/// fn f(mut c: Checkpoint, i: &CorpusItem, t: &TrainItems, inv: &weksa::Inventory) {
|
|
||||||
/// let o = EncoderOffer::for_checkpoint(i, &mut c).unwrap();
|
|
||||||
/// let _ = TestReadings::at_checkpoint(c, &[], &[], &[]);
|
|
||||||
/// let _ = weksa::context::Prompt::encode(&o, t, inv, 1);
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
pub struct EncoderOffer<'cp> {
|
|
||||||
item: CorpusItem,
|
item: CorpusItem,
|
||||||
entities: Vec<EntityId>,
|
entities: Vec<EntityId>,
|
||||||
_checkpoint: PhantomData<&'cp mut Checkpoint>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'cp> EncoderOffer<'cp> {
|
impl EncoderOffer {
|
||||||
/// A round offers Train and Validation items. `RunStores::offer` and
|
/// A round offers Train and Validation items. `RunStores::offer` and
|
||||||
/// `RunStores::offers` are the public producers.
|
/// `RunStores::offers` are the public producers.
|
||||||
pub(crate) fn for_round(item: &CorpusItem) -> Result<EncoderOffer<'static>, OfferRefusal> {
|
pub(crate) fn for_round(item: &CorpusItem) -> Result<EncoderOffer, OfferRefusal> {
|
||||||
match Self::gate(item)? {
|
match Self::gate(item)? {
|
||||||
Split::Test => Err(OfferRefusal::TestBeforeCheckpoint),
|
Split::Test => Err(OfferRefusal::TestItem),
|
||||||
_ => Ok(Self::of(item)),
|
_ => Ok(Self::of(item)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A convergence checkpoint offers any live item, Test included, each item
|
|
||||||
/// at most once under one `Checkpoint`. The gate runs first, so a refused
|
|
||||||
/// item records no key.
|
|
||||||
pub fn for_checkpoint(
|
|
||||||
item: &CorpusItem,
|
|
||||||
checkpoint: &'cp mut Checkpoint,
|
|
||||||
) -> Result<Self, OfferRefusal> {
|
|
||||||
Self::gate(item)?;
|
|
||||||
if !checkpoint.first_offer(&item.id) {
|
|
||||||
return Err(OfferRefusal::OfferedAtCheckpoint);
|
|
||||||
}
|
|
||||||
Ok(Self::of(item))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn gate(item: &CorpusItem) -> Result<Split, OfferRefusal> {
|
fn gate(item: &CorpusItem) -> Result<Split, OfferRefusal> {
|
||||||
if item.withdrawn {
|
if item.withdrawn {
|
||||||
return Err(OfferRefusal::Withdrawn);
|
return Err(OfferRefusal::Withdrawn);
|
||||||
|
|
@ -251,14 +206,13 @@ impl<'cp> EncoderOffer<'cp> {
|
||||||
SplitScheme::V1.live(item).ok_or(OfferRefusal::NoSplit)
|
SplitScheme::V1.live(item).ok_or(OfferRefusal::NoSplit)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn of<'a>(item: &CorpusItem) -> EncoderOffer<'a> {
|
fn of(item: &CorpusItem) -> EncoderOffer {
|
||||||
let mut entities: Vec<EntityId> = item.cited_entities().cloned().collect();
|
let mut entities: Vec<EntityId> = item.cited_entities().cloned().collect();
|
||||||
entities.sort();
|
entities.sort();
|
||||||
entities.dedup();
|
entities.dedup();
|
||||||
EncoderOffer {
|
EncoderOffer {
|
||||||
item: item.clone(),
|
item: item.clone(),
|
||||||
entities,
|
entities,
|
||||||
_checkpoint: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -827,28 +781,6 @@ mod tests {
|
||||||
assert!(prompt.item_keys().is_empty());
|
assert!(prompt.item_keys().is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn checkpoint_offer_gate() {
|
|
||||||
// A fresh checkpoint per call: this test is the gate, not the once rule.
|
|
||||||
let check =
|
|
||||||
|i: &CorpusItem| EncoderOffer::for_checkpoint(i, &mut Checkpoint::for_test(1)).err();
|
|
||||||
let train = item("item:a:1", "t", &group_in(Split::Train), false);
|
|
||||||
let validation = item("item:b:1", "v", &group_in(Split::Validation), false);
|
|
||||||
let test = item("item:c:1", "x", &group_in(Split::Test), false);
|
|
||||||
let no_split = item("item:c:2", "m", &group_in(Split::Test), true);
|
|
||||||
let mut withdrawn = item("item:a:2", "w", &group_in(Split::Train), false);
|
|
||||||
withdrawn.withdrawn = true;
|
|
||||||
assert_eq!(check(&train), None);
|
|
||||||
assert_eq!(check(&validation), None);
|
|
||||||
assert_eq!(check(&test), None);
|
|
||||||
assert_eq!(check(&no_split), Some(OfferRefusal::NoSplit));
|
|
||||||
assert_eq!(check(&withdrawn), Some(OfferRefusal::Withdrawn));
|
|
||||||
// Withdrawn wins over NoSplit.
|
|
||||||
let mut both = no_split.clone();
|
|
||||||
both.withdrawn = true;
|
|
||||||
assert_eq!(check(&both), Some(OfferRefusal::Withdrawn));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn round_offer_gate_precedence() {
|
fn round_offer_gate_precedence() {
|
||||||
let round = |i: &CorpusItem| EncoderOffer::for_round(i).err();
|
let round = |i: &CorpusItem| EncoderOffer::for_round(i).err();
|
||||||
|
|
@ -856,9 +788,9 @@ mod tests {
|
||||||
no_split.withdrawn = true;
|
no_split.withdrawn = true;
|
||||||
// Withdrawn wins over NoSplit.
|
// Withdrawn wins over NoSplit.
|
||||||
assert_eq!(round(&no_split), Some(OfferRefusal::Withdrawn));
|
assert_eq!(round(&no_split), Some(OfferRefusal::Withdrawn));
|
||||||
// A withdrawn Test item is Withdrawn, not TestBeforeCheckpoint.
|
// A withdrawn Test item is Withdrawn, not TestItem.
|
||||||
let mut test = item("item:c:1", "x", &group_in(Split::Test), false);
|
let mut test = item("item:c:1", "x", &group_in(Split::Test), false);
|
||||||
assert_eq!(round(&test), Some(OfferRefusal::TestBeforeCheckpoint));
|
assert_eq!(round(&test), Some(OfferRefusal::TestItem));
|
||||||
test.withdrawn = true;
|
test.withdrawn = true;
|
||||||
assert_eq!(round(&test), Some(OfferRefusal::Withdrawn));
|
assert_eq!(round(&test), Some(OfferRefusal::Withdrawn));
|
||||||
}
|
}
|
||||||
|
|
@ -977,52 +909,4 @@ mod tests {
|
||||||
assert!(!out.chars().any(|c| is_sep(c) && c != '\n'), "{sep:?}");
|
assert!(!out.chars().any(|c| is_sep(c) && c != '\n'), "{sep:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn checkpoint_offers_each_item_once() {
|
|
||||||
let mut cp = Checkpoint::for_test(1);
|
|
||||||
let offer = |cp: &mut Checkpoint, i: &CorpusItem| EncoderOffer::for_checkpoint(i, cp).err();
|
|
||||||
let a = item("item:c:1", "a", &group_in(Split::Test), false);
|
|
||||||
let b = item("item:c:3", "b", &group_in(Split::Test), false);
|
|
||||||
let v = item("item:b:1", "v", &group_in(Split::Validation), false);
|
|
||||||
assert_eq!(offer(&mut cp, &a), None);
|
|
||||||
assert_eq!(offer(&mut cp, &a), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
assert_eq!(offer(&mut cp, &b), None);
|
|
||||||
assert_eq!(offer(&mut cp, &v), None);
|
|
||||||
assert_eq!(offer(&mut cp, &v), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
|
|
||||||
// The once rule is per key, not per text: a distinct key with the same
|
|
||||||
// text is a different item.
|
|
||||||
let twin = item("item:c:4", "a", &group_in(Split::Test), false);
|
|
||||||
assert_eq!(offer(&mut cp, &twin), None);
|
|
||||||
assert_eq!(offer(&mut cp, &twin), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
// Re-offers after others intervened are still refused: the set keeps
|
|
||||||
// every key, not the last.
|
|
||||||
assert_eq!(offer(&mut cp, &a), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
assert_eq!(offer(&mut cp, &b), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
// Keys are whole: ids longer than 8 bytes that share an 8-byte prefix.
|
|
||||||
let l1 = item("item:long:1", "l1", &group_in(Split::Test), false);
|
|
||||||
let l2 = item("item:long:2", "l2", &group_in(Split::Test), false);
|
|
||||||
assert_eq!(offer(&mut cp, &l1), None);
|
|
||||||
assert_eq!(offer(&mut cp, &l2), None);
|
|
||||||
assert_eq!(offer(&mut cp, &l1), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
// The rule holds for Train too.
|
|
||||||
let t = item("item:a:1", "t", &group_in(Split::Train), false);
|
|
||||||
assert_eq!(offer(&mut cp, &t), None);
|
|
||||||
assert_eq!(offer(&mut cp, &t), Some(OfferRefusal::OfferedAtCheckpoint));
|
|
||||||
|
|
||||||
// A refused item records no key: its refusal stays the gate's.
|
|
||||||
let mut gone = item("item:c:2", "w", &group_in(Split::Test), false);
|
|
||||||
gone.withdrawn = true;
|
|
||||||
assert_eq!(offer(&mut cp, &gone), Some(OfferRefusal::Withdrawn));
|
|
||||||
assert_eq!(offer(&mut cp, &gone), Some(OfferRefusal::Withdrawn));
|
|
||||||
let mut live = gone.clone();
|
|
||||||
live.withdrawn = false;
|
|
||||||
assert_eq!(offer(&mut cp, &live), None, "the refusal recorded no key");
|
|
||||||
|
|
||||||
// The checkpoint is spent by its reading; a new one offers afresh.
|
|
||||||
let _ = crate::score::TestReadings::at_checkpoint(cp, &[], &[], &[]);
|
|
||||||
let mut fresh = Checkpoint::for_test(2);
|
|
||||||
assert_eq!(offer(&mut fresh, &a), None);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -682,34 +682,6 @@ impl RunStores {
|
||||||
reach: LowererReach,
|
reach: LowererReach,
|
||||||
answerer_family: ModelFamily,
|
answerer_family: ModelFamily,
|
||||||
panel: &[String],
|
panel: &[String],
|
||||||
) -> Result<Self, RunError> {
|
|
||||||
Self::create_between(
|
|
||||||
root,
|
|
||||||
label,
|
|
||||||
paths,
|
|
||||||
model,
|
|
||||||
embedder,
|
|
||||||
reach,
|
|
||||||
answerer_family,
|
|
||||||
panel,
|
|
||||||
|| {},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `create` with `between` run after the digests are taken and before the
|
|
||||||
/// stores are opened: the seam that lets a test change a store in that window.
|
|
||||||
#[doc(hidden)]
|
|
||||||
#[allow(clippy::too_many_arguments)] // `create`'s seven plus the test seam
|
|
||||||
pub fn create_between(
|
|
||||||
root: &Path,
|
|
||||||
label: &str,
|
|
||||||
paths: RunPaths<'_>,
|
|
||||||
model: &str,
|
|
||||||
embedder: &str,
|
|
||||||
reach: LowererReach,
|
|
||||||
answerer_family: ModelFamily,
|
|
||||||
panel: &[String],
|
|
||||||
between: impl FnOnce(),
|
|
||||||
) -> Result<Self, RunError> {
|
) -> Result<Self, RunError> {
|
||||||
if !is_slug(label) {
|
if !is_slug(label) {
|
||||||
return Err(RunError::Malformed("label"));
|
return Err(RunError::Malformed("label"));
|
||||||
|
|
@ -768,15 +740,10 @@ impl RunStores {
|
||||||
speaker_state_digest: file_digest(&record.speaker_state).ok_or(RunError::Store)?,
|
speaker_state_digest: file_digest(&record.speaker_state).ok_or(RunError::Store)?,
|
||||||
..record
|
..record
|
||||||
};
|
};
|
||||||
between();
|
|
||||||
let mut run = Self::with(root, cache, record)?;
|
let mut run = Self::with(root, cache, record)?;
|
||||||
run.check_panel()?;
|
run.check_panel()?;
|
||||||
run.check_ontology()?;
|
run.check_ontology()?;
|
||||||
run.check_scenes()?;
|
run.check_scenes()?;
|
||||||
// The stores were read between the digests: unless they still match
|
|
||||||
// the pins, what was opened is not what was pinned. Nothing is
|
|
||||||
// recorded for a run that did not pin.
|
|
||||||
check_pins(&run.cache, root, &run.record)?;
|
|
||||||
run.cache
|
run.cache
|
||||||
.put(format!("run:{label}"), &run.record)
|
.put(format!("run:{label}"), &run.record)
|
||||||
.map_err(|_| RunError::Store)?;
|
.map_err(|_| RunError::Store)?;
|
||||||
|
|
@ -791,13 +758,6 @@ impl RunStores {
|
||||||
/// Reopens the run at `root` from its record, refusing when a pinned store
|
/// Reopens the run at `root` from its record, refusing when a pinned store
|
||||||
/// or the prompt source (`PROMPT_SOURCE_DIGEST`) no longer matches.
|
/// or the prompt source (`PROMPT_SOURCE_DIGEST`) no longer matches.
|
||||||
pub fn open(root: &Path) -> Result<Self, RunError> {
|
pub fn open(root: &Path) -> Result<Self, RunError> {
|
||||||
Self::open_between(root, || {})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `open` with `between` run after the pins are checked and before the
|
|
||||||
/// stores are opened: the seam that lets a test change a store in that window.
|
|
||||||
#[doc(hidden)]
|
|
||||||
pub fn open_between(root: &Path, between: impl FnOnce()) -> Result<Self, RunError> {
|
|
||||||
if !root.join("run.cc").is_file() {
|
if !root.join("run.cc").is_file() {
|
||||||
return Err(RunError::NoRun);
|
return Err(RunError::NoRun);
|
||||||
}
|
}
|
||||||
|
|
@ -807,12 +767,7 @@ impl RunStores {
|
||||||
return Err(RunError::Drift(DriftOf::Prompts));
|
return Err(RunError::Drift(DriftOf::Prompts));
|
||||||
}
|
}
|
||||||
check_pins(&cache, root, &record)?;
|
check_pins(&cache, root, &record)?;
|
||||||
between();
|
Self::with(root, cache, record)
|
||||||
let run = Self::with(root, cache, record)?;
|
|
||||||
// Checking and opening are two reads of each file: the opened stores
|
|
||||||
// are the pinned ones only if the pins still hold after the open.
|
|
||||||
check_pins(&run.cache, root, &run.record)?;
|
|
||||||
Ok(run)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with(root: &Path, cache: CultCache, record: RunRecord) -> Result<Self, RunError> {
|
fn with(root: &Path, cache: CultCache, record: RunRecord) -> Result<Self, RunError> {
|
||||||
|
|
@ -941,7 +896,7 @@ impl RunStores {
|
||||||
pub fn offer(
|
pub fn offer(
|
||||||
&self,
|
&self,
|
||||||
key: &str,
|
key: &str,
|
||||||
) -> anyhow::Result<Result<EncoderOffer<'static>, crate::context::OfferRefusal>> {
|
) -> anyhow::Result<Result<EncoderOffer, crate::context::OfferRefusal>> {
|
||||||
let item = self
|
let item = self
|
||||||
.corpus
|
.corpus
|
||||||
.get(key)?
|
.get(key)?
|
||||||
|
|
@ -953,7 +908,7 @@ impl RunStores {
|
||||||
/// The live Train and Validation offers in a panel language, in key order.
|
/// The live Train and Validation offers in a panel language, in key order.
|
||||||
/// Items the gate refuses, and items of any other language, are skipped
|
/// Items the gate refuses, and items of any other language, are skipped
|
||||||
/// and read no further.
|
/// and read no further.
|
||||||
pub fn offers(&self) -> anyhow::Result<Vec<EncoderOffer<'static>>> {
|
pub fn offers(&self) -> anyhow::Result<Vec<EncoderOffer>> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.corpus
|
.corpus
|
||||||
.all()?
|
.all()?
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,7 @@ pub(super) fn held_out(minted: &[&str], items: &[CorpusItem], want: Split) -> Sp
|
||||||
/// items (unigrams over all minted strings, longer grams within one string).
|
/// items (unigrams over all minted strings, longer grams within one string).
|
||||||
/// Honest single-word glosses saturate n = 1, so the leak signature is pooled
|
/// Honest single-word glosses saturate n = 1, so the leak signature is pooled
|
||||||
/// n >= 2 and the worst item at n >= 2. Train items are not measured; withdrawn
|
/// n >= 2 and the worst item at n >= 2. Train items are not measured; withdrawn
|
||||||
/// items and items in no split are dropped. Test is read only through
|
/// items and items in no split are dropped.
|
||||||
/// `TestReadings`.
|
|
||||||
pub fn leak_diagnostic(minted: &[&str], items: &[CorpusItem]) -> SplitLeak {
|
pub fn leak_diagnostic(minted: &[&str], items: &[CorpusItem]) -> SplitLeak {
|
||||||
held_out(minted, items, Split::Validation)
|
held_out(minted, items, Split::Validation)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,7 @@
|
||||||
//! before either is read, and the scorer takes no input from a packet, so no
|
//! before either is read, and the scorer takes no input from a packet, so no
|
||||||
//! text the output carries can raise a score except by resembling the
|
//! text the output carries can raise a score except by resembling the
|
||||||
//! reference. No door judges text; the diagnostics report. The round path
|
//! reference. No door judges text; the diagnostics report. The round path
|
||||||
//! (`aggregate`, `leak_diagnostic`) reads Train and Validation; Test is read
|
//! (`aggregate`, `leak_diagnostic`) reads Train and Validation only.
|
||||||
//! only through `TestReadings::at_checkpoint` (convergence-test).
|
|
||||||
|
|
||||||
mod chrf;
|
mod chrf;
|
||||||
mod diagnostics;
|
mod diagnostics;
|
||||||
|
|
@ -20,7 +19,7 @@ pub use diagnostics::{OrderCoverage, PairChrf, SplitLeak, WorstItem, leak_diagno
|
||||||
pub use embed::{Embedder, OllamaEmbedder, cosine};
|
pub use embed::{Embedder, OllamaEmbedder, cosine};
|
||||||
|
|
||||||
use crate::corpus::CorpusItem;
|
use crate::corpus::CorpusItem;
|
||||||
use crate::split::{Checkpoint, Split, SplitScheme};
|
use crate::split::{Split, SplitScheme};
|
||||||
|
|
||||||
/// One reference/output pair; both are scored whole.
|
/// One reference/output pair; both are scored whole.
|
||||||
pub struct ScoreInput<'a> {
|
pub struct ScoreInput<'a> {
|
||||||
|
|
@ -168,82 +167,6 @@ pub fn validation_items(scored: &[(&CorpusItem, ItemScore)]) -> Vec<ItemScore> {
|
||||||
scores_in(scored, Split::Validation).into_iter().cloned().collect()
|
scores_in(scored, Split::Validation).into_iter().cloned().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The Test split's readings, scalars only: no item key, no minted string, no
|
|
||||||
/// pair. The checkpoint decision (convergence-test) needs numbers; a key beside
|
|
||||||
/// a minted string is the handle an edit step would act on. The only producer
|
|
||||||
/// is `at_checkpoint`, which consumes a `Checkpoint`; only the lib can make one.
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use weksa::score::TestReadings;
|
|
||||||
/// fn f(t: TestReadings) -> usize { t.count() }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// use weksa::score::TestReadings;
|
|
||||||
/// fn f(t: TestReadings) { let _u = t.clone(); }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// use weksa::score::TestReadings;
|
|
||||||
/// fn f(t: TestReadings) { let _ = format!("{t:?}"); }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// use weksa::score::TestReadings;
|
|
||||||
/// fn s<T: serde::Serialize>(_: &T) {}
|
|
||||||
/// fn f(t: TestReadings) { s(&t); }
|
|
||||||
/// ```
|
|
||||||
pub struct TestReadings {
|
|
||||||
mean: SplitMean,
|
|
||||||
leak: SplitLeak,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TestReadings {
|
|
||||||
/// Reads the live Test items against the scores and the minted strings,
|
|
||||||
/// by the same `split_leak` method the Validation reading uses. The
|
|
||||||
/// checkpoint is spent.
|
|
||||||
pub fn at_checkpoint(
|
|
||||||
checkpoint: Checkpoint,
|
|
||||||
scored: &[(&CorpusItem, ItemScore)],
|
|
||||||
minted: &[&str],
|
|
||||||
items: &[CorpusItem],
|
|
||||||
) -> TestReadings {
|
|
||||||
let _spent = checkpoint;
|
|
||||||
TestReadings {
|
|
||||||
mean: split_mean(scored, Split::Test),
|
|
||||||
leak: diagnostics::held_out(minted, items, Split::Test),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Scored Test items.
|
|
||||||
pub fn count(&self) -> usize {
|
|
||||||
self.mean.count
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn chrf(&self) -> Option<f64> {
|
|
||||||
self.mean.chrf
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn meaning(&self) -> Option<f64> {
|
|
||||||
self.mean.meaning
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Test items in the leak reading.
|
|
||||||
pub fn items(&self) -> usize {
|
|
||||||
self.leak.items
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The highest chrF of any minted string against any Test item; the score
|
|
||||||
/// only, never the pair.
|
|
||||||
pub fn max_chrf(&self) -> Option<f64> {
|
|
||||||
self.leak.max_chrf.as_ref().map(|p| p.chrf)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn coverage_by_n(&self) -> &[OrderCoverage] {
|
|
||||||
&self.leak.coverage_by_n
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
@ -284,80 +207,4 @@ mod tests {
|
||||||
);
|
);
|
||||||
assert_eq!(got.len(), aggregate(&scored).validation.count);
|
assert_eq!(got.len(), aggregate(&scored).validation.count);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_readings_at_checkpoint() {
|
|
||||||
let train_item = in_split("item:t:1", UNRELATED, Split::Train, false);
|
|
||||||
let test = in_split("item:c:1", HELD_OUT, Split::Test, false);
|
|
||||||
let test_model = in_split("item:c:2", "model words here", Split::Test, true);
|
|
||||||
let mut gone = in_split("item:c:3", "withdrawn words", Split::Test, false);
|
|
||||||
gone.withdrawn = true;
|
|
||||||
let val = in_split(
|
|
||||||
"item:v:1",
|
|
||||||
"gardening is quiet work",
|
|
||||||
Split::Validation,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
let items = [
|
|
||||||
train_item.clone(),
|
|
||||||
test.clone(),
|
|
||||||
test_model.clone(),
|
|
||||||
gone.clone(),
|
|
||||||
val.clone(),
|
|
||||||
];
|
|
||||||
let scored = [
|
|
||||||
(&train_item, score(10.0, Some(0.5))),
|
|
||||||
(&val, score(40.0, Some(0.8))),
|
|
||||||
(&test, score(60.0, Some(0.6))),
|
|
||||||
(&test_model, score(100.0, Some(1.0))),
|
|
||||||
(&gone, score(90.0, Some(0.9))),
|
|
||||||
];
|
|
||||||
let t = TestReadings::at_checkpoint(Checkpoint::for_test(2), &scored, &[HELD_OUT], &items);
|
|
||||||
assert_eq!(
|
|
||||||
(t.count(), t.chrf(), t.meaning()),
|
|
||||||
(1, Some(60.0), Some(0.6))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
t.items(),
|
|
||||||
1,
|
|
||||||
"model-written and withdrawn Test items are excluded"
|
|
||||||
);
|
|
||||||
assert!(t.max_chrf().unwrap() > 99.0);
|
|
||||||
assert_eq!(t.coverage_by_n()[2].share, Some(1.0));
|
|
||||||
|
|
||||||
// A minted string that is not the Test text reads low.
|
|
||||||
let t = TestReadings::at_checkpoint(Checkpoint::for_test(2), &scored, &["zzz"], &items);
|
|
||||||
assert!(t.max_chrf().unwrap() < 20.0);
|
|
||||||
assert_eq!(t.coverage_by_n()[2].share, Some(0.0));
|
|
||||||
|
|
||||||
let empty = TestReadings::at_checkpoint(Checkpoint::for_test(2), &[], &[HELD_OUT], &[]);
|
|
||||||
assert_eq!(
|
|
||||||
(empty.count(), empty.chrf(), empty.meaning()),
|
|
||||||
(0, None, None)
|
|
||||||
);
|
|
||||||
assert_eq!((empty.items(), empty.max_chrf()), (0, None));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn validation_and_test_leak_agree_in_method() {
|
|
||||||
// The same text and minted strings, once in Validation and once in
|
|
||||||
// Test, read the same numbers.
|
|
||||||
let words: Vec<&str> = HELD_OUT.split(' ').collect();
|
|
||||||
let chunks: Vec<String> = words.chunks(3).map(|c| c.join(" ")).collect();
|
|
||||||
let minted: Vec<&str> = chunks.iter().map(String::as_str).collect();
|
|
||||||
let train_item = in_split("item:t:1", UNRELATED, Split::Train, false);
|
|
||||||
let v = leak_diagnostic(
|
|
||||||
&minted,
|
|
||||||
&[
|
|
||||||
in_split("item:v:1", HELD_OUT, Split::Validation, false),
|
|
||||||
train_item.clone(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
let test = in_split("item:c:1", HELD_OUT, Split::Test, false);
|
|
||||||
let t =
|
|
||||||
TestReadings::at_checkpoint(Checkpoint::for_test(1), &[], &minted, &[test, train_item]);
|
|
||||||
assert_eq!(t.items(), v.items);
|
|
||||||
assert_eq!(t.max_chrf(), v.max_chrf.as_ref().map(|p| p.chrf));
|
|
||||||
assert_eq!(t.coverage_by_n(), v.coverage_by_n.as_slice());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
//! The train/validation/test split is derived from an item's group and nothing
|
//! The train/validation/test split is derived from an item's group and nothing
|
||||||
//! else. No stored assignment exists, so no writer can reassign one. An item is
|
//! else. No stored assignment exists, so no writer can reassign one. An item is
|
||||||
//! read in its live split. The round path (round records, prompts, `aggregate`,
|
//! read in its live split. The round path (round records, prompts, `aggregate`,
|
||||||
//! `leak_diagnostic`) carries no Test reading; a typed `TestReadings` and a Test
|
//! `leak_diagnostic`) reads Train and Validation and excludes Test. Operator
|
||||||
//! `EncoderOffer` need a Checkpoint, and only the lib can make one
|
//! tools (`weksa corpus dump`, `weksa score`, `CorpusStore`) read corpus text
|
||||||
//! (convergence-freeze adds the door). Operator tools (`weksa corpus dump`,
|
//! of any split; that is not gated here.
|
||||||
//! `weksa score`, `CorpusStore`) read corpus text of any split; that is not
|
|
||||||
//! gated here.
|
|
||||||
|
|
||||||
use std::collections::BTreeSet;
|
|
||||||
|
|
||||||
use crate::corpus::{CorpusItem, Source};
|
use crate::corpus::{CorpusItem, Source};
|
||||||
|
|
||||||
|
|
@ -93,88 +89,6 @@ impl SplitScheme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Permission to read Test once, as typed `TestReadings` or as Test
|
|
||||||
/// `EncoderOffer`s. Only the weksa lib can make one: there is no public
|
|
||||||
/// constructor, so no code outside it can obtain those. This is not a seal on
|
|
||||||
/// corpus text: operator tools and `CorpusStore` can read any item, and the
|
|
||||||
/// guarded invariant is that the round path holds no Test reading. The one door
|
|
||||||
/// is added by
|
|
||||||
/// convergence-freeze, which builds a `Checkpoint` from the convergence window
|
|
||||||
/// over the run's persisted round records (convergence-test).
|
|
||||||
/// `TestReadings::at_checkpoint` consumes it, so one `Checkpoint` buys one Test
|
|
||||||
/// reading. One `Checkpoint` also offers each item at most once
|
|
||||||
/// (`EncoderOffer::for_checkpoint`), and an offer borrows its Checkpoint, so it
|
|
||||||
/// cannot outlive the reading that spends it.
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// fn f(c: &weksa::split::Checkpoint) -> u32 { c.round() }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// No public constructor:
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// let _ = weksa::split::Checkpoint::declare(1);
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// The test constructor is not exported (this doctest names it today; the
|
|
||||||
/// line-based tripwire in `tests/checkpoint_door.rs` catches only common
|
|
||||||
/// single-line forms of a new public constructor):
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// let _ = weksa::split::Checkpoint::for_test(1);
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// let _ = weksa::split::Checkpoint { round: 1, offered: Default::default() };
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// One reading per checkpoint:
|
|
||||||
///
|
|
||||||
/// ```
|
|
||||||
/// use weksa::score::TestReadings;
|
|
||||||
/// use weksa::split::Checkpoint;
|
|
||||||
/// fn f(c: Checkpoint) { let _ = TestReadings::at_checkpoint(c, &[], &[], &[]); }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// use weksa::score::TestReadings;
|
|
||||||
/// use weksa::split::Checkpoint;
|
|
||||||
/// fn f(c: Checkpoint) {
|
|
||||||
/// let _ = TestReadings::at_checkpoint(c, &[], &[], &[]);
|
|
||||||
/// let _ = TestReadings::at_checkpoint(c, &[], &[], &[]);
|
|
||||||
/// }
|
|
||||||
/// ```
|
|
||||||
///
|
|
||||||
/// ```compile_fail
|
|
||||||
/// fn f(c: weksa::split::Checkpoint) { let _ = c.clone(); }
|
|
||||||
/// ```
|
|
||||||
pub struct Checkpoint {
|
|
||||||
round: u32,
|
|
||||||
offered: BTreeSet<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Checkpoint {
|
|
||||||
#[cfg(test)]
|
|
||||||
pub(crate) fn for_test(round: u32) -> Self {
|
|
||||||
Self {
|
|
||||||
round,
|
|
||||||
offered: BTreeSet::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Records `key` as offered; false when it already was.
|
|
||||||
pub(crate) fn first_offer(&mut self, key: &str) -> bool {
|
|
||||||
self.offered.insert(key.to_string())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn round(&self) -> u32 {
|
|
||||||
self.round
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod mutants;
|
|
||||||
|
|
||||||
/// Item builders for the unit tests that live in `src`: the twins of
|
/// Item builders for the unit tests that live in `src`: the twins of
|
||||||
/// `tests/common`'s `group_in_bucket`, `item_in`, `cast` and `model`.
|
/// `tests/common`'s `group_in_bucket`, `item_in`, `cast` and `model`.
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
//! Pins of private items of `split` found unpinned by mutation testing.
|
|
||||||
|
|
||||||
use super::Checkpoint;
|
|
||||||
|
|
||||||
/// A checkpoint reports the round it was declared at, whatever the round.
|
|
||||||
#[test]
|
|
||||||
fn a_checkpoint_reports_its_round() {
|
|
||||||
assert_eq!(Checkpoint::for_test(7).round(), 7);
|
|
||||||
assert_eq!(Checkpoint::for_test(0).round(), 0);
|
|
||||||
assert_eq!(Checkpoint::for_test(1).round(), 1);
|
|
||||||
}
|
|
||||||
|
|
@ -320,23 +320,12 @@ impl CorpusStore {
|
||||||
return Err(StoreRefusal::NotNfc { key: item.id }.into());
|
return Err(StoreRefusal::NotNfc { key: item.id }.into());
|
||||||
}
|
}
|
||||||
let text = normalized(&item.text);
|
let text = normalized(&item.text);
|
||||||
// Read from the text as given: NFKC maps modifier letters (ʰ) to base letters.
|
if !item
|
||||||
// A text of marks, joiners and modifiers says so; any other text with
|
.text
|
||||||
// no alphanumeric character (punctuation, space) gets the plainer reason.
|
.chars()
|
||||||
if !item.text.chars().any(is_base) {
|
.any(|c| c.is_alphanumeric() && !is_combining_mark(c))
|
||||||
let marks_only = item.text.chars().any(|c| {
|
{
|
||||||
is_combining_mark(c)
|
return Err(malformed(&item.id, "text has no alphanumeric character"));
|
||||||
|| matches!(c, '\u{200c}' | '\u{200d}')
|
|
||||||
|| is_modifier_letter(c)
|
|
||||||
});
|
|
||||||
return Err(malformed(
|
|
||||||
&item.id,
|
|
||||||
if marks_only {
|
|
||||||
"text has no base letter or digit"
|
|
||||||
} else {
|
|
||||||
"text has no alphanumeric character"
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
if !is_calendar_date(&item.admitted_on) {
|
if !is_calendar_date(&item.admitted_on) {
|
||||||
return Err(malformed(&item.id, "admitted_on is not a YYYY-MM-DD date"));
|
return Err(malformed(&item.id, "admitted_on is not a YYYY-MM-DD date"));
|
||||||
|
|
@ -515,109 +504,6 @@ fn fold_variant(c: char) -> impl Iterator<Item = char> {
|
||||||
std::iter::once(first).chain(second)
|
std::iter::once(first).chain(second)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A character that can carry a word: alphanumeric and neither a combining
|
|
||||||
/// mark (Mn, Mc, Me) nor a modifier letter (Lm). A text of none is marks and
|
|
||||||
/// modifiers only, like a text of punctuation.
|
|
||||||
fn is_base(c: char) -> bool {
|
|
||||||
c.is_alphanumeric() && !is_combining_mark(c) && !is_modifier_letter(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// General_Category Lm, Unicode 17 (the Rust 1.99 tables), as inclusive ranges.
|
|
||||||
fn is_modifier_letter(c: char) -> bool {
|
|
||||||
const LM: [(u32, u32); 79] = [
|
|
||||||
(0x2b0, 0x2c1),
|
|
||||||
(0x2c6, 0x2d1),
|
|
||||||
(0x2e0, 0x2e4),
|
|
||||||
(0x2ec, 0x2ec),
|
|
||||||
(0x2ee, 0x2ee),
|
|
||||||
(0x374, 0x374),
|
|
||||||
(0x37a, 0x37a),
|
|
||||||
(0x559, 0x559),
|
|
||||||
(0x640, 0x640),
|
|
||||||
(0x6e5, 0x6e6),
|
|
||||||
(0x7f4, 0x7f5),
|
|
||||||
(0x7fa, 0x7fa),
|
|
||||||
(0x81a, 0x81a),
|
|
||||||
(0x824, 0x824),
|
|
||||||
(0x828, 0x828),
|
|
||||||
(0x8c9, 0x8c9),
|
|
||||||
(0x971, 0x971),
|
|
||||||
(0xe46, 0xe46),
|
|
||||||
(0xec6, 0xec6),
|
|
||||||
(0x10fc, 0x10fc),
|
|
||||||
(0x17d7, 0x17d7),
|
|
||||||
(0x1843, 0x1843),
|
|
||||||
(0x1aa7, 0x1aa7),
|
|
||||||
(0x1c78, 0x1c7d),
|
|
||||||
(0x1d2c, 0x1d6a),
|
|
||||||
(0x1d78, 0x1d78),
|
|
||||||
(0x1d9b, 0x1dbf),
|
|
||||||
(0x2071, 0x2071),
|
|
||||||
(0x207f, 0x207f),
|
|
||||||
(0x2090, 0x209c),
|
|
||||||
(0x2c7c, 0x2c7d),
|
|
||||||
(0x2d6f, 0x2d6f),
|
|
||||||
(0x2e2f, 0x2e2f),
|
|
||||||
(0x3005, 0x3005),
|
|
||||||
(0x3031, 0x3035),
|
|
||||||
(0x303b, 0x303b),
|
|
||||||
(0x309d, 0x309e),
|
|
||||||
(0x30fc, 0x30fe),
|
|
||||||
(0xa015, 0xa015),
|
|
||||||
(0xa4f8, 0xa4fd),
|
|
||||||
(0xa60c, 0xa60c),
|
|
||||||
(0xa67f, 0xa67f),
|
|
||||||
(0xa69c, 0xa69d),
|
|
||||||
(0xa717, 0xa71f),
|
|
||||||
(0xa770, 0xa770),
|
|
||||||
(0xa788, 0xa788),
|
|
||||||
(0xa7f1, 0xa7f4),
|
|
||||||
(0xa7f8, 0xa7f9),
|
|
||||||
(0xa9cf, 0xa9cf),
|
|
||||||
(0xa9e6, 0xa9e6),
|
|
||||||
(0xaa70, 0xaa70),
|
|
||||||
(0xaadd, 0xaadd),
|
|
||||||
(0xaaf3, 0xaaf4),
|
|
||||||
(0xab5c, 0xab5f),
|
|
||||||
(0xab69, 0xab69),
|
|
||||||
(0xff70, 0xff70),
|
|
||||||
(0xff9e, 0xff9f),
|
|
||||||
(0x10780, 0x10785),
|
|
||||||
(0x10787, 0x107b0),
|
|
||||||
(0x107b2, 0x107ba),
|
|
||||||
(0x10d4e, 0x10d4e),
|
|
||||||
(0x10d6f, 0x10d6f),
|
|
||||||
(0x10ec5, 0x10ec5),
|
|
||||||
(0x11dd9, 0x11dd9),
|
|
||||||
(0x16b40, 0x16b43),
|
|
||||||
(0x16d40, 0x16d42),
|
|
||||||
(0x16d6b, 0x16d6c),
|
|
||||||
(0x16f93, 0x16f9f),
|
|
||||||
(0x16fe0, 0x16fe1),
|
|
||||||
(0x16fe3, 0x16fe3),
|
|
||||||
(0x16ff2, 0x16ff3),
|
|
||||||
(0x1aff0, 0x1aff3),
|
|
||||||
(0x1aff5, 0x1affb),
|
|
||||||
(0x1affd, 0x1affe),
|
|
||||||
(0x1e030, 0x1e06d),
|
|
||||||
(0x1e137, 0x1e13d),
|
|
||||||
(0x1e4eb, 0x1e4eb),
|
|
||||||
(0x1e6ff, 0x1e6ff),
|
|
||||||
(0x1e94b, 0x1e94b),
|
|
||||||
];
|
|
||||||
let c = c as u32;
|
|
||||||
LM.binary_search_by(|&(lo, hi)| {
|
|
||||||
if hi < c {
|
|
||||||
std::cmp::Ordering::Less
|
|
||||||
} else if lo > c {
|
|
||||||
std::cmp::Ordering::Greater
|
|
||||||
} else {
|
|
||||||
std::cmp::Ordering::Equal
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.is_ok()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The field that holds an unattested provenance string, if any: a string with
|
/// The field that holds an unattested provenance string, if any: a string with
|
||||||
/// no alphanumeric, a control or format character, or over 200 bytes attests
|
/// no alphanumeric, a control or format character, or over 200 bytes attests
|
||||||
/// nothing.
|
/// nothing.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//! lowerer sees, comes from `PacketStore::admit` alone, which builds it from
|
//! lowerer sees, comes from `PacketStore::admit` alone, which builds it from
|
||||||
//! the admitted packet and its corpus item through the crate-private
|
//! the admitted packet and its corpus item through the crate-private
|
||||||
//! `LoweringInput::of`. The stance is checked like every feature
|
//! `LoweringInput::of`. The stance is checked like every feature
|
||||||
//! list, in slot `Stance`. The rules are V1..V8, V10..V12 and V14..V18: the
|
//! list, in slot `Stance`. The rules are V1..V8, V10..V12 and V14..V17: the
|
||||||
//! shape of an id or a grade is its type's parse, not a rule, so V9 is retired
|
//! shape of an id or a grade is its type's parse, not a rule, so V9 is retired
|
||||||
//! and not renumbered; V13 is retired too. [`LoweringInput::with_scene`] reads the
|
//! and not renumbered; V13 is retired too. [`LoweringInput::with_scene`] reads the
|
||||||
//! scene of the view's own item group from the speaker-state store, and
|
//! scene of the view's own item group from the speaker-state store, and
|
||||||
|
|
@ -120,12 +120,6 @@ pub enum Refusal {
|
||||||
V17AddresseeNotAReferent {
|
V17AddresseeNotAReferent {
|
||||||
id: NodeId,
|
id: NodeId,
|
||||||
},
|
},
|
||||||
/// V18: a predication whose frame is the inventory's `request_intervention`,
|
|
||||||
/// with no `addressee_consent` naming it. It says what the addressee did, so
|
|
||||||
/// only the packet's own record may license it.
|
|
||||||
V18RequestWithoutConsent {
|
|
||||||
predication: NodeId,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Refusal {
|
impl Refusal {
|
||||||
|
|
@ -150,7 +144,6 @@ impl Refusal {
|
||||||
Refusal::V15ConsentSource { .. } => "V15",
|
Refusal::V15ConsentSource { .. } => "V15",
|
||||||
Refusal::V16SpeakerNotInScene => "V16",
|
Refusal::V16SpeakerNotInScene => "V16",
|
||||||
Refusal::V17AddresseeNotAReferent { .. } => "V17",
|
Refusal::V17AddresseeNotAReferent { .. } => "V17",
|
||||||
Refusal::V18RequestWithoutConsent { .. } => "V18",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -180,9 +173,6 @@ impl fmt::Display for Refusal {
|
||||||
"the scene does not cover the speaker of every live item of its group"
|
"the scene does not cover the speaker of every live item of its group"
|
||||||
}
|
}
|
||||||
Refusal::V17AddresseeNotAReferent { .. } => "the addressee names no referent",
|
Refusal::V17AddresseeNotAReferent { .. } => "the addressee names no referent",
|
||||||
Refusal::V18RequestWithoutConsent { .. } => {
|
|
||||||
"a request frame needs the addressee's consent naming it"
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
write!(f, "{}: {what}", self.rule())
|
write!(f, "{}: {what}", self.rule())
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +221,6 @@ pub fn validate(packet: &Packet, inventory: &Inventory) -> Result<(), Vec<Refusa
|
||||||
out: &mut out,
|
out: &mut out,
|
||||||
}
|
}
|
||||||
.check(packet);
|
.check(packet);
|
||||||
check_requests(packet, inventory, &mut out);
|
|
||||||
} else {
|
} else {
|
||||||
out.push(Refusal::V10UnknownRevision {
|
out.push(Refusal::V10UnknownRevision {
|
||||||
rev: packet.inventory_rev,
|
rev: packet.inventory_rev,
|
||||||
|
|
@ -314,25 +303,6 @@ fn check_consent(packet: &Packet, nodes: &BTreeSet<NodeId>, out: &mut Vec<Refusa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The gloss of the inventory frame that reports an addressee's request.
|
|
||||||
const REQUEST_FRAME_GLOSS: &str = "request_intervention";
|
|
||||||
|
|
||||||
/// V18: a predication whose frame, resolved at the packet's revision, is the
|
|
||||||
/// request frame is named by `addressee_consent`. An unresolved frame is V5's.
|
|
||||||
fn check_requests(packet: &Packet, inventory: &Inventory, out: &mut Vec<Refusal>) {
|
|
||||||
for p in &packet.predications {
|
|
||||||
if inventory
|
|
||||||
.resolve(&p.frame, packet.inventory_rev)
|
|
||||||
.is_some_and(|e| e.gloss == REQUEST_FRAME_GLOSS)
|
|
||||||
&& packet.discourse.addressee_consent.as_ref() != Some(&p.id)
|
|
||||||
{
|
|
||||||
out.push(Refusal::V18RequestWithoutConsent {
|
|
||||||
predication: p.id.clone(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn node_lists(packet: &Packet) -> [(&Vec<NodeId>, &'static str); 3] {
|
fn node_lists(packet: &Packet) -> [(&Vec<NodeId>, &'static str); 3] {
|
||||||
[
|
[
|
||||||
(&packet.context.participants, "participant"),
|
(&packet.context.participants, "participant"),
|
||||||
|
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
||||||
//! A line-based tripwire on the Checkpoint door, not a proof. The real defence
|
|
||||||
//! is that `Checkpoint::for_test` is `cfg(test)`, pinned by the compile_fail
|
|
||||||
//! doctest on its current name in `split.rs`. This scan reads `split.rs` line by
|
|
||||||
//! line and catches the common single-line forms: a `pub fn` in `impl
|
|
||||||
//! Checkpoint` whose signature line says `-> Self` or `-> Checkpoint` without
|
|
||||||
//! `cfg(test)` above it, a trait impl for `Checkpoint`, a derive on it, a `pub`
|
|
||||||
//! field in its braces, and a `-> Checkpoint` line in any other `src` file. It
|
|
||||||
//! misses: signatures wrapped over several lines, `Option`, `Box`, `Result` or
|
|
||||||
//! tuple returns from `split.rs`, tuple structs with `pub` fields, and
|
|
||||||
//! constructors made by macros.
|
|
||||||
|
|
||||||
/// Why `src` lets code outside the lib make a `Checkpoint`, if it does.
|
|
||||||
fn door_leaks(split_rs: &str) -> Vec<String> {
|
|
||||||
let mut leaks = Vec::new();
|
|
||||||
let lines: Vec<&str> = split_rs.lines().collect();
|
|
||||||
let mut in_impl = false;
|
|
||||||
let mut in_struct = false;
|
|
||||||
for (n, line) in lines.iter().enumerate() {
|
|
||||||
let t = line.trim();
|
|
||||||
if t.starts_with("impl Checkpoint") {
|
|
||||||
in_impl = true;
|
|
||||||
} else if t.starts_with("impl") && t.contains("Checkpoint") {
|
|
||||||
leaks.push(format!("{}: trait impl: {t}", n + 1));
|
|
||||||
}
|
|
||||||
if t.starts_with("pub struct Checkpoint") {
|
|
||||||
let derived = lines[..n]
|
|
||||||
.iter()
|
|
||||||
.rev()
|
|
||||||
.take_while(|l| l.trim().starts_with("#[") || l.trim().starts_with("///"))
|
|
||||||
.any(|l| l.contains("derive"));
|
|
||||||
if derived {
|
|
||||||
leaks.push(format!("{}: derive on Checkpoint", n + 1));
|
|
||||||
}
|
|
||||||
in_struct = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if in_struct {
|
|
||||||
if t.starts_with('}') {
|
|
||||||
in_struct = false;
|
|
||||||
} else if t.starts_with("pub ") {
|
|
||||||
leaks.push(format!("{}: public field: {t}", n + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if in_impl && t.starts_with("pub ") && t.contains("fn ") {
|
|
||||||
let mints = t.contains("-> Self") || t.contains("-> Checkpoint");
|
|
||||||
let test_only = lines[..n]
|
|
||||||
.iter()
|
|
||||||
.rev()
|
|
||||||
.take_while(|l| l.trim().starts_with("#["))
|
|
||||||
.any(|l| l.contains("cfg(test)"));
|
|
||||||
if mints && !test_only {
|
|
||||||
leaks.push(format!("{}: pub constructor: {t}", n + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
leaks
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn no_public_item_mints_a_checkpoint() {
|
|
||||||
let src =
|
|
||||||
std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/split.rs")).unwrap();
|
|
||||||
assert_eq!(door_leaks(&src), Vec::<String>::new());
|
|
||||||
// No other module returns one either.
|
|
||||||
for entry in std::fs::read_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/src")).unwrap() {
|
|
||||||
let path = entry.unwrap().path();
|
|
||||||
if path.extension().is_some_and(|e| e == "rs") && !path.ends_with("split.rs") {
|
|
||||||
let text = std::fs::read_to_string(&path).unwrap();
|
|
||||||
let minting = text
|
|
||||||
.lines()
|
|
||||||
.filter(|l| l.contains("-> Checkpoint") || l.contains("-> Result<Checkpoint"))
|
|
||||||
.count();
|
|
||||||
assert_eq!(minting, 0, "{}", path.display());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_scan_sees_each_way_to_open_the_door() {
|
|
||||||
let good = "impl Checkpoint {\n #[cfg(test)]\n pub(crate) fn for_test(r: u32) -> Self { x }\n}\n";
|
|
||||||
assert!(door_leaks(good).is_empty());
|
|
||||||
// Test constructor made public, under its own name or another.
|
|
||||||
let public = "impl Checkpoint {\n pub fn for_test(r: u32) -> Self { x }\n}\n";
|
|
||||||
assert_eq!(door_leaks(public).len(), 1);
|
|
||||||
let renamed = "impl Checkpoint {\n #[cfg(test)]\n #[allow(x)]\n pub fn new(r: u32) -> Checkpoint { x }\n}\n";
|
|
||||||
assert!(
|
|
||||||
door_leaks(renamed).is_empty(),
|
|
||||||
"cfg(test) above another attribute counts"
|
|
||||||
);
|
|
||||||
let renamed = "impl Checkpoint {\n pub fn new(r: u32) -> Checkpoint { x }\n}\n";
|
|
||||||
assert_eq!(door_leaks(renamed).len(), 1);
|
|
||||||
// cfg(test) on the previous item does not cover this one.
|
|
||||||
let stray =
|
|
||||||
"impl Checkpoint {\n #[cfg(test)]\n fn a() {}\n pub fn b() -> Self { x }\n}\n";
|
|
||||||
assert_eq!(door_leaks(stray).len(), 1);
|
|
||||||
assert_eq!(door_leaks("impl Default for Checkpoint {}\n").len(), 1);
|
|
||||||
assert_eq!(door_leaks("impl From<u32> for Checkpoint {}\n").len(), 1);
|
|
||||||
assert_eq!(
|
|
||||||
door_leaks("#[derive(Clone)]\npub struct Checkpoint {\n").len(),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
door_leaks("pub struct Checkpoint {\n pub round: u32,\n}\n").len(),
|
|
||||||
1
|
|
||||||
);
|
|
||||||
assert!(door_leaks("pub struct Checkpoint {\n round: u32,\n}\n").is_empty());
|
|
||||||
}
|
|
||||||
|
|
@ -177,7 +177,7 @@ fn encoder_offer_split_gate() {
|
||||||
let round = |key: &str| c.run.offer(key).unwrap().err();
|
let round = |key: &str| c.run.offer(key).unwrap().err();
|
||||||
assert_eq!(round("item:a:1"), None);
|
assert_eq!(round("item:a:1"), None);
|
||||||
assert_eq!(round("item:b:1"), None);
|
assert_eq!(round("item:b:1"), None);
|
||||||
assert_eq!(round("item:c:1"), Some(OfferRefusal::TestBeforeCheckpoint));
|
assert_eq!(round("item:c:1"), Some(OfferRefusal::TestItem));
|
||||||
assert_eq!(round("item:c:2"), Some(OfferRefusal::NoSplit));
|
assert_eq!(round("item:c:2"), Some(OfferRefusal::NoSplit));
|
||||||
assert_eq!(round("item:a:2"), Some(OfferRefusal::Withdrawn));
|
assert_eq!(round("item:a:2"), Some(OfferRefusal::Withdrawn));
|
||||||
assert!(get(&c, "item:a:2").withdrawn);
|
assert!(get(&c, "item:a:2").withdrawn);
|
||||||
|
|
@ -593,41 +593,6 @@ mod lowering {
|
||||||
assert!(Prompt::lower(&read, &item, &away(), "en-US", &inv, &held, &empty).is_ok());
|
assert!(Prompt::lower(&read, &item, &away(), "en-US", &inv, &held, &empty).is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The packet the encoder emits for a request: frame:3, no consent, source
|
|
||||||
/// ModelDecomposition. Admission refuses it, so no lowering view exists.
|
|
||||||
#[test]
|
|
||||||
fn an_encoder_request_never_reaches_a_lowerer() {
|
|
||||||
let cast = InventoryStore::open(&data("interlingua/inventory.cc")).unwrap();
|
|
||||||
let entities = EntityStore::open(&data("entity/entity.cc")).unwrap();
|
|
||||||
let corpus = CorpusStore::open(&data("corpus/corpus.cc")).unwrap();
|
|
||||||
let dir = tempfile::tempdir().unwrap();
|
|
||||||
let mut store = PacketStore::open(&dir.path().join("p.cc")).unwrap();
|
|
||||||
let mut packet = proof_packet();
|
|
||||||
packet.provenance.source = weksa::packet::ProvenanceSource::ModelDecomposition;
|
|
||||||
packet.predications[0].frame = weksa::InvId::parse("frame:3").unwrap();
|
|
||||||
match store.admit(packet.clone(), &cast, &corpus, &entities) {
|
|
||||||
Err(weksa::StoreError::Invalid(r)) => assert_eq!(
|
|
||||||
r,
|
|
||||||
vec![weksa::Refusal::V18RequestWithoutConsent {
|
|
||||||
predication: weksa::packet::NodeId::parse("n4").unwrap()
|
|
||||||
}]
|
|
||||||
),
|
|
||||||
other => panic!("expected V18, got {:?}", other.map(|_| ())),
|
|
||||||
}
|
|
||||||
// Not blanket: telemetry that records the consent admits and lowers.
|
|
||||||
packet.provenance.source = weksa::packet::ProvenanceSource::GameTelemetry;
|
|
||||||
packet.discourse.addressee_consent = Some(weksa::packet::NodeId::parse("n4").unwrap());
|
|
||||||
drop(store);
|
|
||||||
let view = admitted(packet, &cast, "corpus/corpus.cc", &entities);
|
|
||||||
let item = CorpusItemId::parse("item:nibu:1").unwrap();
|
|
||||||
let held = Held(vec![nibu(&[("en-US", &["Nibu"])])]);
|
|
||||||
let empty = weksa::Ontology::empty();
|
|
||||||
assert!(
|
|
||||||
Prompt::lower(&view, &item, &away(), "en-US", &cast.inventory().unwrap(), &held, &empty)
|
|
||||||
.is_ok()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dao(index: usize) -> (LoweringInput, Inventory, EntityStore, CorpusItemId) {
|
fn dao(index: usize) -> (LoweringInput, Inventory, EntityStore, CorpusItemId) {
|
||||||
let inv = InventoryStore::open(&data("daodejing/inventory.cc")).unwrap();
|
let inv = InventoryStore::open(&data("daodejing/inventory.cc")).unwrap();
|
||||||
let entities = EntityStore::open(&data("daodejing/entity.cc")).unwrap();
|
let entities = EntityStore::open(&data("daodejing/entity.cc")).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ fn refusal_display_names_the_rule_and_no_identifier() {
|
||||||
},
|
},
|
||||||
Refusal::V16SpeakerNotInScene,
|
Refusal::V16SpeakerNotInScene,
|
||||||
Refusal::V17AddresseeNotAReferent { id: node() },
|
Refusal::V17AddresseeNotAReferent { id: node() },
|
||||||
Refusal::V18RequestWithoutConsent { predication: node() },
|
|
||||||
];
|
];
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Refusal::V16SpeakerNotInScene.to_string(),
|
Refusal::V16SpeakerNotInScene.to_string(),
|
||||||
|
|
|
||||||
|
|
@ -372,149 +372,6 @@ fn a_run_from_before_the_copy_does_not_open() {
|
||||||
assert_eq!(RunStores::open(&root).err(), Some(RunError::Store));
|
assert_eq!(RunStores::open(&root).err(), Some(RunError::Store));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_store_changed_between_its_digest_and_its_open_is_drift() {
|
|
||||||
let mut w = world();
|
|
||||||
let dir = w.dir.path().to_path_buf();
|
|
||||||
let root = dir.join("run");
|
|
||||||
run_over(&dir);
|
|
||||||
let more = |w: &mut common::World| {
|
|
||||||
let item = common::item_in(
|
|
||||||
"item:nibu:2",
|
|
||||||
"Another line.",
|
|
||||||
&common::group_in_bucket(10),
|
|
||||||
common::cast(),
|
|
||||||
);
|
|
||||||
w.corpus.add(item, &w.entities).unwrap();
|
|
||||||
};
|
|
||||||
// The pins hold at the check; the corpus changes before the stores open.
|
|
||||||
assert_eq!(
|
|
||||||
RunStores::open_between(&root, || more(&mut w)).err(),
|
|
||||||
Some(RunError::Drift(DriftOf::Corpus))
|
|
||||||
);
|
|
||||||
|
|
||||||
// The same window at create: nothing is pinned and the inventory copy and its
|
|
||||||
// lock are taken away again, so the retry creates.
|
|
||||||
let mut w = world();
|
|
||||||
let dir = w.dir.path().to_path_buf();
|
|
||||||
let root = dir.join("run");
|
|
||||||
for name in ["c.cc", "i.cc", "entities.cc"] {
|
|
||||||
assert!(dir.join(name).exists(), "{name}");
|
|
||||||
}
|
|
||||||
let (c, i, e) = (dir.join("c.cc"), dir.join("i.cc"), dir.join("entities.cc"));
|
|
||||||
let o = dir.join("ontology.cc");
|
|
||||||
let s = common::speaker_state_beside(&o);
|
|
||||||
let paths = || weksa::run::RunPaths {
|
|
||||||
corpus: &c,
|
|
||||||
inventory: &i,
|
|
||||||
entities: &e,
|
|
||||||
ontology: &o,
|
|
||||||
speaker_state: &s,
|
|
||||||
};
|
|
||||||
assert_eq!(
|
|
||||||
RunStores::create_between(
|
|
||||||
&root,
|
|
||||||
"t",
|
|
||||||
paths(),
|
|
||||||
"fake-model",
|
|
||||||
"bag",
|
|
||||||
weksa::run::LowererReach::ToolLessRelay,
|
|
||||||
ModelFamily::Unrecorded,
|
|
||||||
&["en-US".to_string()],
|
|
||||||
|| more(&mut w)
|
|
||||||
)
|
|
||||||
.err(),
|
|
||||||
Some(RunError::Drift(DriftOf::Corpus))
|
|
||||||
);
|
|
||||||
assert!(!root.join("inventory.cc").exists());
|
|
||||||
// Not the copy and not the lock the store's open left beside it.
|
|
||||||
assert!(!root.join("inventory.cc.lock").exists());
|
|
||||||
assert_eq!(RunStores::open(&root).err(), Some(RunError::NoRun));
|
|
||||||
RunStores::create(
|
|
||||||
&root,
|
|
||||||
"t",
|
|
||||||
paths(),
|
|
||||||
"fake-model",
|
|
||||||
"bag",
|
|
||||||
weksa::run::LowererReach::ToolLessRelay,
|
|
||||||
ModelFamily::Unrecorded,
|
|
||||||
&["en-US".to_string()],
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Runs `change` in the window between the pins and the open, at `open` and at
|
|
||||||
/// `create`, and returns what each refused with plus what `create` left behind.
|
|
||||||
fn window(
|
|
||||||
change: impl Fn(&mut common::World, &Path),
|
|
||||||
) -> (Option<RunError>, Option<RunError>, bool, Option<RunError>) {
|
|
||||||
let mut w = world();
|
|
||||||
let dir = w.dir.path().to_path_buf();
|
|
||||||
let root = dir.join("run");
|
|
||||||
run_over(&dir);
|
|
||||||
let opened = RunStores::open_between(&root, || change(&mut w, &root)).err();
|
|
||||||
|
|
||||||
let mut w = world();
|
|
||||||
let dir = w.dir.path().to_path_buf();
|
|
||||||
let root = dir.join("run");
|
|
||||||
let (c, i, e) = (dir.join("c.cc"), dir.join("i.cc"), dir.join("entities.cc"));
|
|
||||||
let o = dir.join("ontology.cc");
|
|
||||||
let paths = weksa::run::RunPaths {
|
|
||||||
corpus: &c,
|
|
||||||
inventory: &i,
|
|
||||||
entities: &e,
|
|
||||||
ontology: &o,
|
|
||||||
speaker_state: &common::speaker_state_beside(&o),
|
|
||||||
};
|
|
||||||
let created = RunStores::create_between(
|
|
||||||
&root,
|
|
||||||
"t",
|
|
||||||
paths,
|
|
||||||
"fake-model",
|
|
||||||
"bag",
|
|
||||||
weksa::run::LowererReach::ToolLessRelay,
|
|
||||||
ModelFamily::Unrecorded,
|
|
||||||
&["en-US".to_string()],
|
|
||||||
|| change(&mut w, &root),
|
|
||||||
)
|
|
||||||
.err();
|
|
||||||
let left = root.join("inventory.cc").exists() || root.join("inventory.cc.lock").exists();
|
|
||||||
(opened, created, left, RunStores::open(&root).err())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn an_entity_store_changed_between_its_digest_and_its_open_is_drift() {
|
|
||||||
let (opened, created, left, after) = window(|w, _| {
|
|
||||||
w.entities.put(ent("kay", "en-US", &["Kay"])).unwrap();
|
|
||||||
});
|
|
||||||
assert_eq!(opened, Some(RunError::Drift(DriftOf::Entities)));
|
|
||||||
assert_eq!(created, Some(RunError::Drift(DriftOf::Entities)));
|
|
||||||
assert!(!left);
|
|
||||||
assert_eq!(after, Some(RunError::NoRun));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_head_inventory_changed_between_its_digest_and_its_open_is_drift() {
|
|
||||||
let (opened, created, left, after) = window(|_, root| {
|
|
||||||
weksa::InventoryStore::open(&root.join("inventory.cc"))
|
|
||||||
.unwrap()
|
|
||||||
.admit_revision(
|
|
||||||
weksa::InventoryRevision {
|
|
||||||
n: 5,
|
|
||||||
parent: Some(4),
|
|
||||||
changes: vec![],
|
|
||||||
frozen: false,
|
|
||||||
},
|
|
||||||
vec![],
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
});
|
|
||||||
assert_eq!(opened, Some(RunError::Drift(DriftOf::Inventory)));
|
|
||||||
assert_eq!(created, Some(RunError::Drift(DriftOf::Inventory)));
|
|
||||||
assert!(!left);
|
|
||||||
assert_eq!(after, Some(RunError::NoRun));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn source_digests_cover_their_files() {
|
fn source_digests_cover_their_files() {
|
||||||
let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
|
let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
|
||||||
|
|
@ -2666,129 +2523,6 @@ fn a_changed_head_is_drift() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tripwires over the source, with the limits stated: they read text, so they
|
|
||||||
/// catch a spelling and not an alias.
|
|
||||||
#[test]
|
|
||||||
fn source_tripwires() {
|
|
||||||
let src = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
|
|
||||||
let read = |rel: &str| std::fs::read_to_string(src.join(rel)).unwrap();
|
|
||||||
for file in ["run.rs", "model.rs", "encode.rs"] {
|
|
||||||
let text = read(file);
|
|
||||||
for banned in ["Split::Test", "Checkpoint"] {
|
|
||||||
assert!(!text.contains(banned), "{file} names {banned}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Every prompt file leaves through RunStores::answer_files, which withholds Test text.
|
|
||||||
assert!(!read("main.rs").contains("AnswerFiles::new"));
|
|
||||||
let mut all = Vec::new();
|
|
||||||
let mut stack = vec![src.clone()];
|
|
||||||
while let Some(dir) = stack.pop() {
|
|
||||||
for entry in std::fs::read_dir(dir).unwrap() {
|
|
||||||
let path = entry.unwrap().path();
|
|
||||||
if path.is_dir() {
|
|
||||||
stack.push(path);
|
|
||||||
} else if path.extension().is_some_and(|e| e == "rs") {
|
|
||||||
all.push((
|
|
||||||
path.strip_prefix(&src)
|
|
||||||
.unwrap()
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
.to_string(),
|
|
||||||
std::fs::read_to_string(&path).unwrap(),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (file, text) in &all {
|
|
||||||
let code: String = text
|
|
||||||
.lines()
|
|
||||||
.filter(|l| !l.trim_start().starts_with("//"))
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("\n");
|
|
||||||
if file != "main.rs" {
|
|
||||||
assert!(!code.contains("std::process"), "{file}");
|
|
||||||
}
|
|
||||||
// The Ollama reply is the other xenos boundary: JSON read from a server.
|
|
||||||
if file != "encode.rs" && file != "score/embed.rs" {
|
|
||||||
assert!(!code.contains("serde_json::from_str"), "{file}");
|
|
||||||
}
|
|
||||||
if file != "context.rs" {
|
|
||||||
assert!(!code.contains("Prompt {"), "{file}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let context = read("context.rs");
|
|
||||||
assert!(!context.contains("pub fn from_corpus") && !context.contains("pub fn for_round"));
|
|
||||||
// The editor's prompt reads Train items, an inventory and an EditFeedback:
|
|
||||||
// no round record, decision, held-out mean or refusal count is named there.
|
|
||||||
for banned in [
|
|
||||||
"RoundRecord",
|
|
||||||
"Decision",
|
|
||||||
"SplitMean",
|
|
||||||
"Aggregate",
|
|
||||||
"validation_mean",
|
|
||||||
"validation_refused",
|
|
||||||
"ItemScore",
|
|
||||||
"LanguageScores",
|
|
||||||
"validation_scores",
|
|
||||||
] {
|
|
||||||
assert!(!context.contains(banned), "context.rs names {banned}");
|
|
||||||
}
|
|
||||||
// `EditFeedback::none` is the one public constructor; Decision has none.
|
|
||||||
assert!(!context.contains("pub fn new"));
|
|
||||||
let run = read("run.rs");
|
|
||||||
let code: Vec<&str> = run
|
|
||||||
.lines()
|
|
||||||
.filter(|l| !l.trim_start().starts_with("//"))
|
|
||||||
.collect();
|
|
||||||
let count = |needle: &str| code.iter().filter(|l| l.contains(needle)).count();
|
|
||||||
assert!(!run.contains("pub fn new"));
|
|
||||||
assert_eq!(
|
|
||||||
count("Prompt::lower("),
|
|
||||||
2,
|
|
||||||
"two lowering call sites: the round's and the stance ablation's replay of it"
|
|
||||||
);
|
|
||||||
// Prompt::lower takes the view, the item's key and speaker id, the inventory and the entity
|
|
||||||
// port: no corpus item, train set, offer or store.
|
|
||||||
let start = context.find("pub fn lower(").unwrap();
|
|
||||||
let signature = &context[start..start + context[start..].find(") -> ").unwrap()];
|
|
||||||
for banned in ["CorpusItem,", "CorpusItem)", "TrainItems", "EncoderOffer", "Store"] {
|
|
||||||
assert!(!signature.contains(banned), "Prompt::lower takes {banned}");
|
|
||||||
}
|
|
||||||
assert!(signature.contains("&LoweringInput") && signature.contains("&CorpusItemId"));
|
|
||||||
assert!(signature.contains("&Ontology"), "the whole ontology goes in; select chooses");
|
|
||||||
assert_eq!(count("admit_revision("), 1, "one door call");
|
|
||||||
assert_eq!(
|
|
||||||
count("std::fs::copy"),
|
|
||||||
1,
|
|
||||||
"the cycle's copy; create's is copy_new"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
count("Path::new(&record.inventory)"),
|
|
||||||
1,
|
|
||||||
"the source path is read once"
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
count("InventoryStore::open"),
|
|
||||||
2,
|
|
||||||
"the head and the cycle's file"
|
|
||||||
);
|
|
||||||
// An entry draft carries no id or revision field.
|
|
||||||
let encode = read("encode.rs");
|
|
||||||
let entry = encode
|
|
||||||
.split("pub struct EntryDraft {")
|
|
||||||
.nth(1)
|
|
||||||
.and_then(|t| t.split('}').next())
|
|
||||||
.unwrap();
|
|
||||||
for banned in ["id", "introduced_rev", "retired_rev"] {
|
|
||||||
assert!(
|
|
||||||
!entry
|
|
||||||
.split_whitespace()
|
|
||||||
.any(|w| w.trim_end_matches(':') == banned),
|
|
||||||
"EntryDraft has a {banned} field"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- the lowerer ----
|
// ---- the lowerer ----
|
||||||
|
|
||||||
/// Lowercase letters and digits only: what survives any re-spacing or re-casing.
|
/// Lowercase letters and digits only: what survives any re-spacing or re-casing.
|
||||||
|
|
|
||||||
|
|
@ -1,411 +0,0 @@
|
||||||
# Lm, Node 24 (Unicode 17.0) over 0..10FFFF, one hex code point per line
|
|
||||||
2B0
|
|
||||||
2B1
|
|
||||||
2B2
|
|
||||||
2B3
|
|
||||||
2B4
|
|
||||||
2B5
|
|
||||||
2B6
|
|
||||||
2B7
|
|
||||||
2B8
|
|
||||||
2B9
|
|
||||||
2BA
|
|
||||||
2BB
|
|
||||||
2BC
|
|
||||||
2BD
|
|
||||||
2BE
|
|
||||||
2BF
|
|
||||||
2C0
|
|
||||||
2C1
|
|
||||||
2C6
|
|
||||||
2C7
|
|
||||||
2C8
|
|
||||||
2C9
|
|
||||||
2CA
|
|
||||||
2CB
|
|
||||||
2CC
|
|
||||||
2CD
|
|
||||||
2CE
|
|
||||||
2CF
|
|
||||||
2D0
|
|
||||||
2D1
|
|
||||||
2E0
|
|
||||||
2E1
|
|
||||||
2E2
|
|
||||||
2E3
|
|
||||||
2E4
|
|
||||||
2EC
|
|
||||||
2EE
|
|
||||||
374
|
|
||||||
37A
|
|
||||||
559
|
|
||||||
640
|
|
||||||
6E5
|
|
||||||
6E6
|
|
||||||
7F4
|
|
||||||
7F5
|
|
||||||
7FA
|
|
||||||
81A
|
|
||||||
824
|
|
||||||
828
|
|
||||||
8C9
|
|
||||||
971
|
|
||||||
E46
|
|
||||||
EC6
|
|
||||||
10FC
|
|
||||||
17D7
|
|
||||||
1843
|
|
||||||
1AA7
|
|
||||||
1C78
|
|
||||||
1C79
|
|
||||||
1C7A
|
|
||||||
1C7B
|
|
||||||
1C7C
|
|
||||||
1C7D
|
|
||||||
1D2C
|
|
||||||
1D2D
|
|
||||||
1D2E
|
|
||||||
1D2F
|
|
||||||
1D30
|
|
||||||
1D31
|
|
||||||
1D32
|
|
||||||
1D33
|
|
||||||
1D34
|
|
||||||
1D35
|
|
||||||
1D36
|
|
||||||
1D37
|
|
||||||
1D38
|
|
||||||
1D39
|
|
||||||
1D3A
|
|
||||||
1D3B
|
|
||||||
1D3C
|
|
||||||
1D3D
|
|
||||||
1D3E
|
|
||||||
1D3F
|
|
||||||
1D40
|
|
||||||
1D41
|
|
||||||
1D42
|
|
||||||
1D43
|
|
||||||
1D44
|
|
||||||
1D45
|
|
||||||
1D46
|
|
||||||
1D47
|
|
||||||
1D48
|
|
||||||
1D49
|
|
||||||
1D4A
|
|
||||||
1D4B
|
|
||||||
1D4C
|
|
||||||
1D4D
|
|
||||||
1D4E
|
|
||||||
1D4F
|
|
||||||
1D50
|
|
||||||
1D51
|
|
||||||
1D52
|
|
||||||
1D53
|
|
||||||
1D54
|
|
||||||
1D55
|
|
||||||
1D56
|
|
||||||
1D57
|
|
||||||
1D58
|
|
||||||
1D59
|
|
||||||
1D5A
|
|
||||||
1D5B
|
|
||||||
1D5C
|
|
||||||
1D5D
|
|
||||||
1D5E
|
|
||||||
1D5F
|
|
||||||
1D60
|
|
||||||
1D61
|
|
||||||
1D62
|
|
||||||
1D63
|
|
||||||
1D64
|
|
||||||
1D65
|
|
||||||
1D66
|
|
||||||
1D67
|
|
||||||
1D68
|
|
||||||
1D69
|
|
||||||
1D6A
|
|
||||||
1D78
|
|
||||||
1D9B
|
|
||||||
1D9C
|
|
||||||
1D9D
|
|
||||||
1D9E
|
|
||||||
1D9F
|
|
||||||
1DA0
|
|
||||||
1DA1
|
|
||||||
1DA2
|
|
||||||
1DA3
|
|
||||||
1DA4
|
|
||||||
1DA5
|
|
||||||
1DA6
|
|
||||||
1DA7
|
|
||||||
1DA8
|
|
||||||
1DA9
|
|
||||||
1DAA
|
|
||||||
1DAB
|
|
||||||
1DAC
|
|
||||||
1DAD
|
|
||||||
1DAE
|
|
||||||
1DAF
|
|
||||||
1DB0
|
|
||||||
1DB1
|
|
||||||
1DB2
|
|
||||||
1DB3
|
|
||||||
1DB4
|
|
||||||
1DB5
|
|
||||||
1DB6
|
|
||||||
1DB7
|
|
||||||
1DB8
|
|
||||||
1DB9
|
|
||||||
1DBA
|
|
||||||
1DBB
|
|
||||||
1DBC
|
|
||||||
1DBD
|
|
||||||
1DBE
|
|
||||||
1DBF
|
|
||||||
2071
|
|
||||||
207F
|
|
||||||
2090
|
|
||||||
2091
|
|
||||||
2092
|
|
||||||
2093
|
|
||||||
2094
|
|
||||||
2095
|
|
||||||
2096
|
|
||||||
2097
|
|
||||||
2098
|
|
||||||
2099
|
|
||||||
209A
|
|
||||||
209B
|
|
||||||
209C
|
|
||||||
2C7C
|
|
||||||
2C7D
|
|
||||||
2D6F
|
|
||||||
2E2F
|
|
||||||
3005
|
|
||||||
3031
|
|
||||||
3032
|
|
||||||
3033
|
|
||||||
3034
|
|
||||||
3035
|
|
||||||
303B
|
|
||||||
309D
|
|
||||||
309E
|
|
||||||
30FC
|
|
||||||
30FD
|
|
||||||
30FE
|
|
||||||
A015
|
|
||||||
A4F8
|
|
||||||
A4F9
|
|
||||||
A4FA
|
|
||||||
A4FB
|
|
||||||
A4FC
|
|
||||||
A4FD
|
|
||||||
A60C
|
|
||||||
A67F
|
|
||||||
A69C
|
|
||||||
A69D
|
|
||||||
A717
|
|
||||||
A718
|
|
||||||
A719
|
|
||||||
A71A
|
|
||||||
A71B
|
|
||||||
A71C
|
|
||||||
A71D
|
|
||||||
A71E
|
|
||||||
A71F
|
|
||||||
A770
|
|
||||||
A788
|
|
||||||
A7F1
|
|
||||||
A7F2
|
|
||||||
A7F3
|
|
||||||
A7F4
|
|
||||||
A7F8
|
|
||||||
A7F9
|
|
||||||
A9CF
|
|
||||||
A9E6
|
|
||||||
AA70
|
|
||||||
AADD
|
|
||||||
AAF3
|
|
||||||
AAF4
|
|
||||||
AB5C
|
|
||||||
AB5D
|
|
||||||
AB5E
|
|
||||||
AB5F
|
|
||||||
AB69
|
|
||||||
FF70
|
|
||||||
FF9E
|
|
||||||
FF9F
|
|
||||||
10780
|
|
||||||
10781
|
|
||||||
10782
|
|
||||||
10783
|
|
||||||
10784
|
|
||||||
10785
|
|
||||||
10787
|
|
||||||
10788
|
|
||||||
10789
|
|
||||||
1078A
|
|
||||||
1078B
|
|
||||||
1078C
|
|
||||||
1078D
|
|
||||||
1078E
|
|
||||||
1078F
|
|
||||||
10790
|
|
||||||
10791
|
|
||||||
10792
|
|
||||||
10793
|
|
||||||
10794
|
|
||||||
10795
|
|
||||||
10796
|
|
||||||
10797
|
|
||||||
10798
|
|
||||||
10799
|
|
||||||
1079A
|
|
||||||
1079B
|
|
||||||
1079C
|
|
||||||
1079D
|
|
||||||
1079E
|
|
||||||
1079F
|
|
||||||
107A0
|
|
||||||
107A1
|
|
||||||
107A2
|
|
||||||
107A3
|
|
||||||
107A4
|
|
||||||
107A5
|
|
||||||
107A6
|
|
||||||
107A7
|
|
||||||
107A8
|
|
||||||
107A9
|
|
||||||
107AA
|
|
||||||
107AB
|
|
||||||
107AC
|
|
||||||
107AD
|
|
||||||
107AE
|
|
||||||
107AF
|
|
||||||
107B0
|
|
||||||
107B2
|
|
||||||
107B3
|
|
||||||
107B4
|
|
||||||
107B5
|
|
||||||
107B6
|
|
||||||
107B7
|
|
||||||
107B8
|
|
||||||
107B9
|
|
||||||
107BA
|
|
||||||
10D4E
|
|
||||||
10D6F
|
|
||||||
10EC5
|
|
||||||
11DD9
|
|
||||||
16B40
|
|
||||||
16B41
|
|
||||||
16B42
|
|
||||||
16B43
|
|
||||||
16D40
|
|
||||||
16D41
|
|
||||||
16D42
|
|
||||||
16D6B
|
|
||||||
16D6C
|
|
||||||
16F93
|
|
||||||
16F94
|
|
||||||
16F95
|
|
||||||
16F96
|
|
||||||
16F97
|
|
||||||
16F98
|
|
||||||
16F99
|
|
||||||
16F9A
|
|
||||||
16F9B
|
|
||||||
16F9C
|
|
||||||
16F9D
|
|
||||||
16F9E
|
|
||||||
16F9F
|
|
||||||
16FE0
|
|
||||||
16FE1
|
|
||||||
16FE3
|
|
||||||
16FF2
|
|
||||||
16FF3
|
|
||||||
1AFF0
|
|
||||||
1AFF1
|
|
||||||
1AFF2
|
|
||||||
1AFF3
|
|
||||||
1AFF5
|
|
||||||
1AFF6
|
|
||||||
1AFF7
|
|
||||||
1AFF8
|
|
||||||
1AFF9
|
|
||||||
1AFFA
|
|
||||||
1AFFB
|
|
||||||
1AFFD
|
|
||||||
1AFFE
|
|
||||||
1E030
|
|
||||||
1E031
|
|
||||||
1E032
|
|
||||||
1E033
|
|
||||||
1E034
|
|
||||||
1E035
|
|
||||||
1E036
|
|
||||||
1E037
|
|
||||||
1E038
|
|
||||||
1E039
|
|
||||||
1E03A
|
|
||||||
1E03B
|
|
||||||
1E03C
|
|
||||||
1E03D
|
|
||||||
1E03E
|
|
||||||
1E03F
|
|
||||||
1E040
|
|
||||||
1E041
|
|
||||||
1E042
|
|
||||||
1E043
|
|
||||||
1E044
|
|
||||||
1E045
|
|
||||||
1E046
|
|
||||||
1E047
|
|
||||||
1E048
|
|
||||||
1E049
|
|
||||||
1E04A
|
|
||||||
1E04B
|
|
||||||
1E04C
|
|
||||||
1E04D
|
|
||||||
1E04E
|
|
||||||
1E04F
|
|
||||||
1E050
|
|
||||||
1E051
|
|
||||||
1E052
|
|
||||||
1E053
|
|
||||||
1E054
|
|
||||||
1E055
|
|
||||||
1E056
|
|
||||||
1E057
|
|
||||||
1E058
|
|
||||||
1E059
|
|
||||||
1E05A
|
|
||||||
1E05B
|
|
||||||
1E05C
|
|
||||||
1E05D
|
|
||||||
1E05E
|
|
||||||
1E05F
|
|
||||||
1E060
|
|
||||||
1E061
|
|
||||||
1E062
|
|
||||||
1E063
|
|
||||||
1E064
|
|
||||||
1E065
|
|
||||||
1E066
|
|
||||||
1E067
|
|
||||||
1E068
|
|
||||||
1E069
|
|
||||||
1E06A
|
|
||||||
1E06B
|
|
||||||
1E06C
|
|
||||||
1E06D
|
|
||||||
1E137
|
|
||||||
1E138
|
|
||||||
1E139
|
|
||||||
1E13A
|
|
||||||
1E13B
|
|
||||||
1E13C
|
|
||||||
1E13D
|
|
||||||
1E4EB
|
|
||||||
1E6FF
|
|
||||||
1E94B
|
|
||||||
|
|
@ -1128,28 +1128,11 @@ fn committed_scenes_cover_original_groups() {
|
||||||
DIGEST_OF_THE_EARLIER_SCENES,
|
DIGEST_OF_THE_EARLIER_SCENES,
|
||||||
"an earlier scene revision changed"
|
"an earlier scene revision changed"
|
||||||
);
|
);
|
||||||
// Rubric r1 is text the labels cite: the section, as committed, is pinned.
|
|
||||||
let doc = std::fs::read_to_string(
|
|
||||||
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../docs/scene-annotation.md"),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
let from = doc.find("## Rubric r1").expect("the doc holds Rubric r1");
|
|
||||||
let rest = &doc[from + "## Rubric r1".len()..];
|
|
||||||
let section = &doc[from..from + "## Rubric r1".len() + rest.find("\n## ").expect("a section follows r1")];
|
|
||||||
assert_eq!(
|
|
||||||
weksa::split::fnv1a64_of(&[section.trim().as_bytes()]),
|
|
||||||
DIGEST_OF_THE_RUBRIC,
|
|
||||||
"rubric r1 was edited; a new rubric is a new section and a new generator"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Taken over the 113 scene revisions that precede rubric r1, 2026-11-13.
|
/// Taken over the 113 scene revisions that precede rubric r1, 2026-11-13.
|
||||||
const DIGEST_OF_THE_EARLIER_SCENES: u64 = 2598828882325200913;
|
const DIGEST_OF_THE_EARLIER_SCENES: u64 = 2598828882325200913;
|
||||||
|
|
||||||
/// Taken over the text of the `## Rubric r1` section of docs/scene-annotation.md
|
|
||||||
/// (trimmed), 2026-11-13.
|
|
||||||
const DIGEST_OF_THE_RUBRIC: u64 = 11823581212652524671;
|
|
||||||
|
|
||||||
/// Taken over each live group's latest revision (group, n, features) at rubric r1,
|
/// Taken over each live group's latest revision (group, n, features) at rubric r1,
|
||||||
/// 2026-11-13.
|
/// 2026-11-13.
|
||||||
const DIGEST_OF_THE_SCENES: u64 = 2505219080875817063;
|
const DIGEST_OF_THE_SCENES: u64 = 2505219080875817063;
|
||||||
|
|
|
||||||
|
|
@ -435,60 +435,16 @@ fn s6_folds_dotless_i_kana_and_arabic_indic_digits() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `modifier_letters.txt` is the Unicode 17 Lm list, the oracle for the test
|
|
||||||
/// below. When the toolchain's Unicode tables move, this fails first: regenerate
|
|
||||||
/// the file from the new tables, then bump the pin.
|
|
||||||
#[test]
|
|
||||||
fn the_modifier_letter_table_matches_the_toolchains_unicode_version() {
|
|
||||||
assert_eq!(
|
|
||||||
char::UNICODE_VERSION,
|
|
||||||
(17, 0, 0),
|
|
||||||
"regenerate crates/weksa/tests/modifier_letters.txt for the new Unicode version"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_text_of_only_marks_is_refused() {
|
fn a_text_of_only_marks_is_refused() {
|
||||||
let d = dir();
|
let d = dir();
|
||||||
let mut store = CorpusStore::open(&d.path().join("c.cc")).unwrap();
|
let mut store = CorpusStore::open(&d.path().join("c.cc")).unwrap();
|
||||||
// Prolonged sound mark, Thai maiyamok, fathatan, tatweel: alphabetic to
|
// Combining marks alone do not carry a word.
|
||||||
// Unicode, but none carries a word.
|
assert_eq!(
|
||||||
for (n, text) in [
|
refusal(store.add(item("item:mo:1", "\u{64b}"), &ents(&d))),
|
||||||
"\u{30fc}",
|
malformed("item:mo:1", "text has no alphanumeric character"),
|
||||||
"\u{e46}",
|
);
|
||||||
"\u{64b}",
|
// With a base letter or digit the same marks and modifiers are text.
|
||||||
"\u{640}",
|
|
||||||
"\u{30fc}\u{30fc}",
|
|
||||||
"\u{640}\u{64b}",
|
|
||||||
]
|
|
||||||
.into_iter()
|
|
||||||
.enumerate()
|
|
||||||
{
|
|
||||||
let key = format!("item:mo:{}", n + 1);
|
|
||||||
assert_eq!(
|
|
||||||
refusal(store.add(item(&key, text), &ents(&d))),
|
|
||||||
malformed(&key, "text has no base letter or digit"),
|
|
||||||
"{text:?}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Every modifier letter (Lm) alone is refused: for having no base letter,
|
|
||||||
// or, where Unicode does not call it alphabetic, no alphanumeric at all, or
|
|
||||||
// (U+0374, U+037A) for not being NFC.
|
|
||||||
for line in include_str!("modifier_letters.txt")
|
|
||||||
.lines()
|
|
||||||
.filter(|l| !l.starts_with('#'))
|
|
||||||
{
|
|
||||||
let c = char::from_u32(u32::from_str_radix(line, 16).unwrap()).unwrap();
|
|
||||||
let key = "item:mo:90";
|
|
||||||
let got = refusal(store.add(item(key, &c.to_string()), &ents(&d)));
|
|
||||||
assert!(
|
|
||||||
got == StoreRefusal::NotNfc { key: key.into() }
|
|
||||||
|| got == malformed(key, "text has no base letter or digit")
|
|
||||||
|| got == malformed(key, "text has no alphanumeric character"),
|
|
||||||
"{c:?}: {got:?}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// With a base letter or digit the same marks are text.
|
|
||||||
store
|
store
|
||||||
.add(item("item:mo:91", "\u{30a2}\u{30fc}"), &ents(&d))
|
.add(item("item:mo:91", "\u{30a2}\u{30fc}"), &ents(&d))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -575,7 +531,7 @@ fn s6_keeps_tone_marks_and_viramas_apart() {
|
||||||
let key = format!("item:mk:{}", 90 + n);
|
let key = format!("item:mk:{}", 90 + n);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
refusal(store.add(item(&key, text), &ents(&d))),
|
refusal(store.add(item(&key, text), &ents(&d))),
|
||||||
malformed(&key, "text has no base letter or digit"),
|
malformed(&key, "text has no alphanumeric character"),
|
||||||
"{text:?}"
|
"{text:?}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -740,53 +740,6 @@ fn a_source_that_only_read_wording_cannot_set_consent() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// V18: a request frame is licensed by the packet's own consent record.
|
|
||||||
|
|
||||||
/// The committed inventory, where `frame:3` is `request_intervention`.
|
|
||||||
fn cast_refusals(p: &Packet) -> Vec<Refusal> {
|
|
||||||
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../data/interlingua/inventory.cc");
|
|
||||||
let inv = weksa::InventoryStore::open(&path).unwrap().inventory().unwrap();
|
|
||||||
validate(p, &inv).err().unwrap_or_default()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn requesting() -> Packet {
|
|
||||||
let mut p = proof_packet();
|
|
||||||
p.predications[0].frame = iv("frame:3");
|
|
||||||
p.discourse.addressee_consent = Some(nd("n4"));
|
|
||||||
p
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_request_frame_needs_consent_naming_its_predication() {
|
|
||||||
assert_eq!(cast_refusals(&requesting()), vec![]);
|
|
||||||
let mut p = requesting();
|
|
||||||
p.discourse.addressee_consent = None;
|
|
||||||
assert_eq!(
|
|
||||||
cast_refusals(&p),
|
|
||||||
vec![Refusal::V18RequestWithoutConsent { predication: nd("n4") }]
|
|
||||||
);
|
|
||||||
p.discourse.addressee_consent = Some(nd("n5"));
|
|
||||||
assert_eq!(
|
|
||||||
cast_refusals(&p),
|
|
||||||
vec![Refusal::V18RequestWithoutConsent { predication: nd("n4") }]
|
|
||||||
);
|
|
||||||
let mut p = requesting();
|
|
||||||
p.provenance.source = ProvenanceSource::GameTelemetry;
|
|
||||||
assert_eq!(cast_refusals(&p), vec![]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn model_source_consent_is_v15_alone() {
|
|
||||||
let mut p = requesting();
|
|
||||||
p.provenance.source = ProvenanceSource::ModelDecomposition;
|
|
||||||
assert_eq!(
|
|
||||||
cast_refusals(&p),
|
|
||||||
vec![Refusal::V15ConsentSource {
|
|
||||||
source: ProvenanceSource::ModelDecomposition
|
|
||||||
}]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// V17: the addressee is someone spoken to, a referent.
|
// V17: the addressee is someone spoken to, a referent.
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
# Architecture
|
# Architecture
|
||||||
|
|
||||||
Weksa is a language-intent engine: currently a state spine, pipeline map,
|
Weksa is a language-intent engine implemented in Rust under `crates/weksa`
|
||||||
fixtures, ontology data and a planned service contract. No daemon runs; the
|
(live on `main`), with CultCache-backed stores, packet validation, lowering
|
||||||
planned packet crate is `crates/weksa` (cut `packet-store`).
|
prompt construction, pronunciation planning, and golf-loop scoring/evaluation.
|
||||||
|
No long-running daemon runs yet.
|
||||||
|
|
||||||
See [Verse Service Contract](./verse-service-contract.md) for the
|
See [Verse Service Contract](./verse-service-contract.md) for the
|
||||||
CultCache/CultMesh authority map.
|
CultCache/CultMesh authority map.
|
||||||
|
|
@ -17,9 +18,11 @@ requests, and utterance handoff documents.
|
||||||
|
|
||||||
## Current Mechanism
|
## Current Mechanism
|
||||||
|
|
||||||
There is no long-running runtime loop yet. The repo contains persistent state
|
`crates/weksa` owns the live CLI and library (CultCache stores, packet
|
||||||
surfaces that define the intended data flow
|
validation, split derivation, scoring, pronunciation planning, and the
|
||||||
and the ownership boundaries future code must respect.
|
golf-loop runner). No long-running daemon loop runs yet; the docs under
|
||||||
|
`docs/` and Huginn (`weksa-body`, `weksa-lowering`) record the ownership
|
||||||
|
boundaries and campaign state.
|
||||||
|
|
||||||
The first shared contract is the [Interlingua Standard](./interlingua-standard.md):
|
The first shared contract is the [Interlingua Standard](./interlingua-standard.md):
|
||||||
clients submit interlingua packets before any language project projects them
|
clients submit interlingua packets before any language project projects them
|
||||||
|
|
@ -41,13 +44,11 @@ through its ontology.
|
||||||
|
|
||||||
## Intended Change
|
## Intended Change
|
||||||
|
|
||||||
Future implementation should turn the pipeline in `state/map.yaml` into a small,
|
Future implementation should turn the pipeline mapped in `weksa-body` and
|
||||||
inspectable daemon. The first executable slice should validate a tiny
|
`crates/weksa` into a small, inspectable daemon once earned. The current
|
||||||
interlingua packet, read a tiny language project definition, render glossed
|
executable slice validates interlingua packets, lowers admitted views into
|
||||||
output, lower an accepted intent into target-language realizations, optionally
|
target-language realizations, plans English pronunciation, and traces stage
|
||||||
project the accepted realization into a speech-provider request or
|
decisions.
|
||||||
pronunciation/utterance handoff, and produce a trace explaining which stage made
|
|
||||||
each decision.
|
|
||||||
|
|
||||||
Runtime should be fast and deterministic. Model-assisted English decomposition
|
Runtime should be fast and deterministic. Model-assisted English decomposition
|
||||||
belongs in authoring tools or offline import flows, not in the required hot path.
|
belongs in authoring tools or offline import flows, not in the required hot path.
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
304
state/map.yaml
304
state/map.yaml
|
|
@ -1,295 +1,15 @@
|
||||||
|
# Non-canonical pointer. Canonical state lives in Weksa's Huginn mind
|
||||||
|
# (`EUREKA_INSTANCE=weksa`, `HUGINN_ENDPOINT=rudp://10.77.0.1:17877`).
|
||||||
|
|
||||||
project:
|
project:
|
||||||
name: Weksa
|
name: Weksa
|
||||||
status: scaffolded
|
status: active
|
||||||
phase: state_spine
|
implementation: crates/weksa
|
||||||
premise: >
|
|
||||||
Build a procedural language engine that generates alien languages from
|
|
||||||
explicit concepts, cultural constraints, grammar, phonology, morphology,
|
|
||||||
and diachronic history instead of direct English word substitution.
|
|
||||||
|
|
||||||
objective:
|
canonical_state:
|
||||||
primary: >
|
huginn_endpoint: rudp://10.77.0.1:17877
|
||||||
Create a durable workspace where Weksa can develop from a persistent map
|
eureka_instance: weksa
|
||||||
before runtime architecture decisions are made.
|
body_map_mind: weksa-body
|
||||||
current: >
|
campaign_mind: weksa-lowering
|
||||||
Treat written output, AquaSynth utterance embeddings, and MiMo expressive
|
executable_typed_state: crates/weksa
|
||||||
speech requests as sibling target projections from accepted interlingua
|
published_schemas: schemas/cultnet
|
||||||
lowerings while keeping Weksa's ownership limited to inspected intent,
|
|
||||||
delivery controls, and trace.
|
|
||||||
|
|
||||||
constraints:
|
|
||||||
- Runtime implementation language is undecided.
|
|
||||||
- Do not add framework, package, build, CLI, or service scaffolding until the
|
|
||||||
architecture earns it.
|
|
||||||
- Neural models may decompose, suggest, generate, and critique; they do not
|
|
||||||
own the canonical language state.
|
|
||||||
- Runtime should accept interlingua packets and compiled project data;
|
|
||||||
required hot-path rendering must not depend on arbitrary English
|
|
||||||
interpretation or live LLM calls.
|
|
||||||
- Setting-specific projects may pressure the engine, but their ontology must
|
|
||||||
not become generic Weksa doctrine.
|
|
||||||
- Zyphos / Eusocial Interbeing canon belongs to the Eusocial Interbeing vault;
|
|
||||||
Weksa should consume it through explicit naming and language-design briefs.
|
|
||||||
- Explicit project state must distinguish durable decisions from scratch.
|
|
||||||
- Avoid direct English-to-alien word replacement as the core design.
|
|
||||||
- The interlingua must stay language-neutral. Setting-specific pressure starts
|
|
||||||
in namespaced extensions and only becomes standard when multiple clients or
|
|
||||||
language projects need it.
|
|
||||||
- Human target-language utterance lowering is the first proof layer. English,
|
|
||||||
Brazilian Portuguese (`pt-BR`), and Japanese are the initial targets.
|
|
||||||
Alien-language lowering waits until Weksa can preserve meaning through
|
|
||||||
character voice, target cultural ontology, and realization choices humans
|
|
||||||
can judge.
|
|
||||||
- Agent state is projected context, not prompt prose storage. Raw state
|
|
||||||
internals must not leak into generated dialogue.
|
|
||||||
- AquaSynth owns IPA, phoneme, reference-synth, vocal-tract, and speech parity
|
|
||||||
work. Weksa owns interlingua-to-utterance projection.
|
|
||||||
- Weksa still owns English pronunciation planning: tokenization, word
|
|
||||||
pronunciations, phrase grouping, stress, and broad IPA stringing.
|
|
||||||
- Long-term speech handoff should use Weksa-provided speech text embeddings,
|
|
||||||
prosody/emphasis hints, and Ghostlight/Epiphany-shaped character-state
|
|
||||||
vectors; AquaSynth owns the learned utterance embedding encoder, gradient
|
|
||||||
descent, and synth-control decoding.
|
|
||||||
- MiMo V2.5 TTS VoiceDesign is an external speech-provider target. Weksa may
|
|
||||||
project an accepted target-language realization plus the same speaker-local
|
|
||||||
delivery intent used to create it into a MiMo voice design request, but MiMo
|
|
||||||
owns only provider rendering and audio output.
|
|
||||||
- Large offline text-embedding jobs should use `bge-m3` on the neighboring
|
|
||||||
Ollama inference box documented in `E:\Projects\gamecult-ops` rather than
|
|
||||||
running on the local Weksa workspace by default.
|
|
||||||
|
|
||||||
invariants:
|
|
||||||
- Ontology owns meaning.
|
|
||||||
- Grammar owns required expression.
|
|
||||||
- Phonology owns sound shape.
|
|
||||||
- Morphology owns derivation, inflection, compounding, and root families.
|
|
||||||
- Diachrony owns historical distortion, semantic drift, register split, loan
|
|
||||||
strata, and irregularity.
|
|
||||||
- Renderer owns surface text and glosses from already-structured meaning.
|
|
||||||
- Persistent state owns durable maps, accepted decisions, open questions,
|
|
||||||
evidence, and working memory.
|
|
||||||
- Scratch is disposable; the map is slow-changing.
|
|
||||||
|
|
||||||
data_flow:
|
|
||||||
observe:
|
|
||||||
- source utterance
|
|
||||||
- interlingua packet
|
|
||||||
- translation context
|
|
||||||
- world model
|
|
||||||
- existing language project state
|
|
||||||
process:
|
|
||||||
- accept or decompose source into a Weksa interlingua packet
|
|
||||||
- optionally project the packet through an agent-local state context
|
|
||||||
- lower projected meaning into target-language utterance realizations
|
|
||||||
through explicit target-language cultural ontology profiles
|
|
||||||
- optionally produce pronunciation plans for lowered dialogue where Weksa
|
|
||||||
owns the target pronunciation layer
|
|
||||||
- optionally encode the line as a learned expression vector for downstream
|
|
||||||
synth control
|
|
||||||
- optionally project an accepted realization into a provider-specific
|
|
||||||
speech request such as MiMo VoiceDesign without making the provider an
|
|
||||||
owner of source meaning
|
|
||||||
- apply alien ontology and cultural salience
|
|
||||||
- select grammatical commitments
|
|
||||||
- derive morphology and lexical families
|
|
||||||
- apply phonological constraints
|
|
||||||
- apply diachronic history
|
|
||||||
- render surface alien text, gloss, and explanation
|
|
||||||
cut:
|
|
||||||
- remove stages that do not own a clear invariant
|
|
||||||
- reject generic adapters until a real external boundary exists
|
|
||||||
- keep model prompts as replaceable tools, not hidden sources of truth
|
|
||||||
|
|
||||||
pipeline:
|
|
||||||
stages:
|
|
||||||
- id: source-input
|
|
||||||
title: Source Input
|
|
||||||
owns: raw utterance and context
|
|
||||||
emits: source packet
|
|
||||||
invariant: input text remains recoverable as evidence
|
|
||||||
- id: interlingua
|
|
||||||
title: Meaning Interlingua
|
|
||||||
owns: structured semantic representation
|
|
||||||
emits: concept/event graph
|
|
||||||
invariant: meaning is explicit before alien rendering
|
|
||||||
- id: ontology
|
|
||||||
title: Alien Ontology
|
|
||||||
owns: concept splits, collapses, salience, and worldview pressure
|
|
||||||
emits: alien concept frame
|
|
||||||
invariant: alien worldview decides which distinctions matter
|
|
||||||
- id: grammar
|
|
||||||
title: Grammar
|
|
||||||
owns: required expression, syntax, agreement, and clause structure
|
|
||||||
emits: grammatical plan
|
|
||||||
invariant: surface output carries required commitments
|
|
||||||
- id: morphology
|
|
||||||
title: Morphology
|
|
||||||
owns: roots, derivation, inflection, compounds, and families
|
|
||||||
emits: morpheme plan
|
|
||||||
invariant: related forms remain related for a reason
|
|
||||||
- id: phonology
|
|
||||||
title: Phonology
|
|
||||||
owns: legal sounds, syllables, phonotactics, and prosody
|
|
||||||
emits: legal proto-forms
|
|
||||||
invariant: generated forms belong to one sound system
|
|
||||||
- id: diachrony
|
|
||||||
title: Diachrony
|
|
||||||
owns: historical sound change, semantic drift, registers, loans, scars
|
|
||||||
emits: attested forms
|
|
||||||
invariant: plausible irregularity comes from history, not decoration
|
|
||||||
- id: renderer
|
|
||||||
title: Renderer
|
|
||||||
owns: surface alien text, glosses, and analysis output
|
|
||||||
emits: final translation packet
|
|
||||||
invariant: rendering does not invent meaning
|
|
||||||
edges:
|
|
||||||
- source: source-input
|
|
||||||
target: interlingua
|
|
||||||
carries: source packet
|
|
||||||
- source: interlingua
|
|
||||||
target: ontology
|
|
||||||
carries: concept/event graph
|
|
||||||
- source: ontology
|
|
||||||
target: grammar
|
|
||||||
carries: alien concept frame
|
|
||||||
- source: grammar
|
|
||||||
target: morphology
|
|
||||||
carries: grammatical plan
|
|
||||||
- source: morphology
|
|
||||||
target: phonology
|
|
||||||
carries: morpheme plan
|
|
||||||
- source: phonology
|
|
||||||
target: diachrony
|
|
||||||
carries: legal proto-forms
|
|
||||||
- source: diachrony
|
|
||||||
target: renderer
|
|
||||||
carries: attested forms
|
|
||||||
|
|
||||||
accepted_design:
|
|
||||||
- Weksa starts with a language-neutral persistent state spine rather than a
|
|
||||||
runtime scaffold.
|
|
||||||
- The EpiphanyAgent pattern is ported as architecture discipline, not as Rust
|
|
||||||
code or product-specific organs.
|
|
||||||
- The first model is concept-first translation through an explicit
|
|
||||||
interlingua, ontology, grammar, morphology, phonology, diachrony, and
|
|
||||||
renderer pipeline.
|
|
||||||
- The interlingua packet is the client-facing meaning contract. It owns
|
|
||||||
referents, predications, relations, discourse, context, provenance,
|
|
||||||
constraints, extensions, and trace data before ontology projection.
|
|
||||||
- Utterance lowering through projected agent state is the first proof target
|
|
||||||
before alien language rendering. English remains one target, not the hidden
|
|
||||||
source for other target languages.
|
|
||||||
- Nibu is the first target for flavored-English lowering, using her VoidBot
|
|
||||||
state and Aetheria lore note as source context.
|
|
||||||
- Target-language cultural ontology profiles own address, politeness,
|
|
||||||
register, idiom, metaphor, script, and forbidden-flattening distinctions for
|
|
||||||
human-language lowering. They do not own source meaning.
|
|
||||||
- Weksa is the engine. A language project owns one constructed language.
|
|
||||||
Setting docs own story, species, culture, and use cases.
|
|
||||||
- Rust to Dust is an earlier proving ground, not engine doctrine.
|
|
||||||
- Zyphos / Eusocial Interbeing is now the higher-priority setting target for
|
|
||||||
Weksa naming and language-design work.
|
|
||||||
- Time-sensitive runtime paths should be deterministic and LLM-free.
|
|
||||||
Model-assisted decomposition, generation, and critique belong in authoring
|
|
||||||
or offline workflows.
|
|
||||||
- `docs/best-modern-approach.md` is the current doctrine for conceptual
|
|
||||||
ontology, root generation, morphology, syntax, lexical semantics,
|
|
||||||
interlingua, diachrony, and model-assisted consistency.
|
|
||||||
- Eusocial Interbeing is a second setting collaboration surface. It needs
|
|
||||||
inhabitant-language names derived from speaker ontology, register,
|
|
||||||
phonology, morphology, diachrony, and setting context rather than direct
|
|
||||||
English label translation.
|
|
||||||
- Airawa first-contact work should begin with social mechanics rather than
|
|
||||||
scenery vocabulary: identity, formal naming, origin, approach permission,
|
|
||||||
border-right, peace claim, obligation, gratitude/debt, witness, authority,
|
|
||||||
guest status, mother-tree access, nutrient gift, and taboo delivery.
|
|
||||||
- The current Airawa starter forms are provisional seed evidence, not canon.
|
|
||||||
They must be promoted through a language-project state that explains their
|
|
||||||
morphology, phonology, grammar, and allowed usage before Weksa claims clean
|
|
||||||
full translation.
|
|
||||||
|
|
||||||
open_questions:
|
|
||||||
- Which implementation language best serves the first usable engine?
|
|
||||||
- What format should language projects use for ontology, grammar, phonology,
|
|
||||||
morphology, and diachrony definitions?
|
|
||||||
- What compiled runtime bundle format keeps game-time rendering fast and
|
|
||||||
inspectable?
|
|
||||||
- How should Weksa persist or cache speech text embeddings generated by
|
|
||||||
`bge-m3` on the neighboring Ollama box before AquaSynth turns them into
|
|
||||||
utterance embeddings?
|
|
||||||
- How much deterministic validation belongs in v0?
|
|
||||||
- What is the minimal Rust to Dust language-project slice that proves the
|
|
||||||
engine without hard-coding the setting into it?
|
|
||||||
- What minimal Eusocial Interbeing language-project slice can prove naming for
|
|
||||||
Airawa, Sa'ueia, ecological partner, and imperial registers without
|
|
||||||
collapsing them into one universal language?
|
|
||||||
- Which Zyphos language project should be first: Airawa, imperial Airawa,
|
|
||||||
Sa'ueia, or a narrow naming-brief interlingua?
|
|
||||||
- What is the minimal Airawa starter lexicon and permission model needed to
|
|
||||||
translate the first chieftain/visitor/mother-tree scene honestly?
|
|
||||||
- How should Airawa encode honorable scars: bodily evidence, honor claim, debt
|
|
||||||
marker, warrior-status signal, or a split among those meanings?
|
|
||||||
- What Weksa naming brief schema best serves nation-scale interbeings,
|
|
||||||
ecological memory networks, and mobile family-unit civilizations?
|
|
||||||
- Which interlingua fields should be promoted from namespaced extensions after
|
|
||||||
the first real Zyphos and Rust to Dust packets?
|
|
||||||
- What exact projected-context subset should Weksa accept from Ghostlight-style
|
|
||||||
agent state for English lowering?
|
|
||||||
- What exact pass/fail rubric proves a Nibu-flavored English line preserves
|
|
||||||
interlingua meaning instead of merely sounding sharp?
|
|
||||||
- What English G2P path should become executable first: CMUdict lookup plus
|
|
||||||
ARPABET-to-IPA conversion, eSpeak NG oracle comparison, or a trained OOV
|
|
||||||
model?
|
|
||||||
- What training corpus should the first AquaSynth-owned utterance embedding
|
|
||||||
encoder use now that the v0.1 handoff fixes Weksa inputs at 1024 + 32 + 64
|
|
||||||
floats and AquaSynth output at 64 floats?
|
|
||||||
|
|
||||||
landed_baseline:
|
|
||||||
- Language-neutral state spine.
|
|
||||||
- Canonical pipeline map.
|
|
||||||
- Scratch surface.
|
|
||||||
- Schema receipt docs.
|
|
||||||
- Rust to Dust setting documentation skeleton.
|
|
||||||
- Eusocial Interbeing naming surface at settings/eusocial-interbeing.
|
|
||||||
- Zyphos language-design pressure note.
|
|
||||||
- Airawa first-contact slice recording room consensus on strong sound,
|
|
||||||
introduction vocabulary, permission-bound dialogue, and the boundary against
|
|
||||||
direct English-to-Airawa substitution.
|
|
||||||
- Draft Weksa interlingua standard and packet schema receipt.
|
|
||||||
- Draft flavored-English lowering contract.
|
|
||||||
- Nibu lowering target note.
|
|
||||||
- First English pronunciation plan fixture for Nibu proof output.
|
|
||||||
- First toy utterance embedding handoff fixture for Nibu proof output.
|
|
||||||
- First executable utterance handoff emitter at
|
|
||||||
`tools/emit_tiny_panphon_handoffs.py`.
|
|
||||||
- First executable utterance handoff fixture validator at
|
|
||||||
`tools/validate_tiny_panphon_handoffs.py`, scoped to the tiny PanPhon v0.1
|
|
||||||
batch rather than promoted as a general schema runtime.
|
|
||||||
- First machine-readable AquaSynth speech-training seed batch at
|
|
||||||
`examples/speech-training/tiny-panphon-v0.1/batch.json`, covering pure IPA
|
|
||||||
`a`, `pa`, `ta`, `ka`, `sa`, and `ma` with fixed v0.1 vector widths and
|
|
||||||
PanPhon's 22-feature basis.
|
|
||||||
- Weksa-to-AquaSynth utterance embedding handoff v0.1 fixes the training
|
|
||||||
vector contract: 1024-float `bge-m3:latest` speech text embedding,
|
|
||||||
variable-length PanPhon sequence evidence, a 256-float AquaSynth-owned
|
|
||||||
phonetic realization embedding, 32-float prosody/emphasis hints, 64-float
|
|
||||||
projected character state, and 64-float AquaSynth-owned utterance embedding
|
|
||||||
output. Toy fixtures are marked non-training if they do not use those
|
|
||||||
dimensions.
|
|
||||||
- Speech text embedding and phonetic realization are separate channels.
|
|
||||||
English text semantics may use `bge-m3`; IPA strings and alien phonetic
|
|
||||||
material belong in PanPhon sequence evidence that AquaSynth compresses into
|
|
||||||
the phonetic realization embedding.
|
|
||||||
- MiMo V2.5 TTS VoiceDesign is accepted as a speech-provider target
|
|
||||||
projection from Weksa utterance realizations. MiMo requests speak the
|
|
||||||
accepted target text and receive Weksa-derived voice/style guidance from the
|
|
||||||
same projected context that produced the utterance; backtranslations,
|
|
||||||
provider tags, and fresh raw Persona interpretation do not become source
|
|
||||||
meaning.
|
|
||||||
- First Nibu interlingua-to-English lowering fixture.
|
|
||||||
- First Nibu multilingual utterance lowering fixture at
|
|
||||||
`examples/multilingual-lowering/nibu-proof-001/`, covering English,
|
|
||||||
Brazilian Portuguese (`pt-BR`), and Japanese from one shared interlingua
|
|
||||||
packet through explicit target-language cultural ontology profiles.
|
|
||||||
- `bge-m3:latest` installed on neighboring Ollama box `192.168.1.84` and
|
|
||||||
verified through a 1024-dimensional utterance embedding.
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue