reply kind: one result of her Self session, as its actuator heard it (eureka-pipeline, huginn-mind, schemas, golden)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
196be4f11c
commit
3ef5da5e0d
21 changed files with 368 additions and 27 deletions
|
|
@ -313,6 +313,7 @@ fn refuse_foreign_instance(document: &PipelineDocument, mind: &Slug) -> Result<(
|
|||
PipelineDocument::Stewardship(value) if value.instance != *mind => Err(foreign(&value.instance)),
|
||||
PipelineDocument::Run(value) if value.instance != *mind => Err(foreign(&value.instance)),
|
||||
PipelineDocument::Pulse(value) if value.instance != *mind => Err(foreign(&value.instance)),
|
||||
PipelineDocument::Reply(value) if value.instance != *mind => Err(foreign(&value.instance)),
|
||||
PipelineDocument::Memory(value) if value.instance != *mind => Err(foreign(&value.instance)),
|
||||
PipelineDocument::HandOff(value) if value.from_instance != *mind && value.to_instance != *mind => {
|
||||
Err(foreign(&value.from_instance))
|
||||
|
|
@ -623,7 +624,7 @@ fn check(docs: &Docs<'_>, staged: &Staged, mind: &Slug) -> Result<(), MindRefusa
|
|||
let replay = docs.in_image(K::Run, key) == Some(&staged.document);
|
||||
run_rule(docs, key, run, replay)
|
||||
}
|
||||
D::FollowUp(_) | D::Instance(_) | D::Pulse(_) | D::Memory(_) | D::Research(_) | D::Idea(_) => Ok(()),
|
||||
D::FollowUp(_) | D::Instance(_) | D::Pulse(_) | D::Reply(_) | D::Memory(_) | D::Research(_) | D::Idea(_) => Ok(()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2474,6 +2475,27 @@ mod tests {
|
|||
committed(admit(&mut mind, vec![pulse(INSTANCE)]));
|
||||
}
|
||||
|
||||
/// A reply is her own: one of another mind is a ForeignInstance, her own is admitted.
|
||||
#[test]
|
||||
fn a_reply_of_another_mind_is_a_foreign_instance_and_her_own_is_admitted() {
|
||||
let mut mind = with_specs();
|
||||
let reply = |instance: &str| {
|
||||
D::Reply(eureka_pipeline::PipelineReply {
|
||||
instance: slug(instance),
|
||||
label: l("w1-r1"),
|
||||
run: r(K::Run, &format!("{INSTANCE}:run:w1")),
|
||||
answers: vec![],
|
||||
text: "Done.".into(),
|
||||
})
|
||||
};
|
||||
assert_eq!(
|
||||
refusal(admit(&mut mind, vec![reply(OTHER_INSTANCE)])),
|
||||
MindRefusal::ForeignInstance { declared: OTHER_INSTANCE.into(), mind: INSTANCE.into() }
|
||||
);
|
||||
committed(admit(&mut mind, vec![run("w1", &[])]));
|
||||
committed(admit(&mut mind, vec![reply(INSTANCE)]));
|
||||
}
|
||||
|
||||
fn memory_key(label: &str) -> String {
|
||||
format!("{INSTANCE}:memory:{label}")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,8 @@ pub(crate) fn line_of(document: &PipelineDocument) -> Option<Lineage<'_>> {
|
|||
| D::Instance(_)
|
||||
| D::HandOff(_)
|
||||
| D::Run(_)
|
||||
| D::Pulse(_) => None,
|
||||
| D::Pulse(_)
|
||||
| D::Reply(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -392,10 +393,11 @@ pub enum CitationRole {
|
|||
Sources,
|
||||
RestsOn,
|
||||
Toward,
|
||||
Run,
|
||||
}
|
||||
|
||||
impl CitationRole {
|
||||
pub const ALL: [CitationRole; 21] = [
|
||||
pub const ALL: [CitationRole; 22] = [
|
||||
Self::RaisedIn,
|
||||
Self::Answers,
|
||||
Self::Rulings,
|
||||
|
|
@ -417,6 +419,7 @@ impl CitationRole {
|
|||
Self::Sources,
|
||||
Self::RestsOn,
|
||||
Self::Toward,
|
||||
Self::Run,
|
||||
];
|
||||
|
||||
/// The wire spelling, equal to the referring field's name.
|
||||
|
|
@ -443,6 +446,7 @@ impl CitationRole {
|
|||
Self::Sources => "sources",
|
||||
Self::RestsOn => "rests_on",
|
||||
Self::Toward => "toward",
|
||||
Self::Run => "run",
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -467,6 +471,7 @@ impl CitationRole {
|
|||
Self::Consolidates => K::Memory,
|
||||
Self::Serves | Self::Sources => K::Research,
|
||||
Self::RestsOn | Self::Toward => K::Idea,
|
||||
Self::Run => K::Reply,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -484,6 +489,7 @@ impl CitationRole {
|
|||
Self::Verdict => vec![K::Verdict],
|
||||
Self::Claims => vec![K::CutSpec, K::Finding, K::FollowUp],
|
||||
Self::Consolidates => vec![K::Memory],
|
||||
Self::Run => vec![K::Run],
|
||||
Self::RaisedIn
|
||||
| Self::Source
|
||||
| Self::Subject
|
||||
|
|
@ -566,6 +572,7 @@ pub(crate) fn citations(document: &PipelineDocument) -> Vec<(CitationRole, Pipel
|
|||
hand_off.documents.iter().filter_map(|to| kind_of_id(&to.0).map(|kind| (R::Documents, cited(kind, to)))),
|
||||
),
|
||||
D::Run(run) => edges.extend(run.claims.iter().map(|to| (R::Claims, to.clone()))),
|
||||
D::Reply(reply) => edges.push((R::Run, reply.run.clone())),
|
||||
D::Memory(memory) => edges.extend(memory.consolidates.iter().map(|to| (R::Consolidates, to.clone()))),
|
||||
D::Research(research) => {
|
||||
edges.extend(research.serves.iter().map(|to| (R::Serves, to.clone())));
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ pub fn index_text(document: &PipelineDocument) -> Option<String> {
|
|||
lines.push(&idea.idea.0);
|
||||
lines.push(&idea.tradeoffs.0);
|
||||
}
|
||||
D::Instance(_) | D::Stewardship(_) | D::Run(_) | D::Pulse(_) => {}
|
||||
D::Instance(_) | D::Stewardship(_) | D::Run(_) | D::Pulse(_) | D::Reply(_) => {}
|
||||
}
|
||||
lines.retain(|line| !line.is_empty());
|
||||
if lines.is_empty() {
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ pub enum PipelineFacts {
|
|||
HandOff { from_instance: Slug, to_instance: Slug, repo: OrgRepo, handed_on: Date },
|
||||
Run { label: Label, operated_by: RunOperator, turn: RunTurn, started_on: Date, claims: Vec<PipelineRef> },
|
||||
Pulse { label: Label, tempo_vote_beat_s: Option<u32>, #[serde(default)] tempo_vote_withdrawn: bool, urgency_permille: Option<u16> },
|
||||
Reply { label: Label, run: PipelineRef, answers: Vec<PipelineRef> },
|
||||
Memory { label: Label, sort: MemorySort, about: Vec<Short>, origin: MemoryOrigin, salience_permille: u16 },
|
||||
Research { pass: Label, label: Label, claim: Line, inferred: bool, observed_on: Date },
|
||||
Idea { pass: Label, label: Label, title: Title, proposed_on: Date },
|
||||
|
|
@ -254,6 +255,7 @@ impl PipelineFacts {
|
|||
tempo_vote_withdrawn: value.tempo_vote_withdrawn,
|
||||
urgency_permille: value.urgency_permille,
|
||||
},
|
||||
D::Reply(value) => Self::Reply { label: value.label.clone(), run: value.run.clone(), answers: value.answers.clone() },
|
||||
D::Memory(value) => Self::Memory {
|
||||
label: value.label.clone(),
|
||||
sort: value.sort,
|
||||
|
|
@ -1736,6 +1738,10 @@ mod tests {
|
|||
let handoff = landed.iter().find(|write| write.kind == K::HandOff).expect("the hand-off landed").id.0.clone();
|
||||
let (_, landed) = committed(admit(&mut mind, vec![run("w1", &[r(K::CutSpec, &id("cut_spec", "cut-1.r2")), r(K::FollowUp, &fu)])]));
|
||||
let run_id = landed[0].id.0.clone();
|
||||
let reply_id = format!("{INSTANCE}:reply:w1-r1");
|
||||
committed(admit(&mut mind, vec![D::Reply(eureka_pipeline::PipelineReply {
|
||||
instance: INSTANCE.into(), label: "w1-r1".into(), run: r(K::Run, &run_id), answers: vec![r(K::FollowUp, &fu)], text: "Done.".into(),
|
||||
})]));
|
||||
let (older, newer) = (format!("{INSTANCE}:memory:m1"), format!("{INSTANCE}:memory:m2"));
|
||||
committed(admit(&mut mind, vec![memory("m1", MemorySort::Idea, "one", &[])]));
|
||||
let D::Memory(mut consolidating) = memory("m2", MemorySort::Idea, "two", &[]) else { unreachable!() };
|
||||
|
|
@ -1785,13 +1791,14 @@ mod tests {
|
|||
(CitationRole::Documents, &handoff, &q1),
|
||||
(CitationRole::Claims, &run_id, &spec_r2),
|
||||
(CitationRole::Claims, &run_id, &fu),
|
||||
(CitationRole::Run, &reply_id, &run_id),
|
||||
(CitationRole::Consolidates, &newer, &older),
|
||||
(CitationRole::Serves, ¬e, &q1),
|
||||
(CitationRole::Sources, ¬e, &f1),
|
||||
(CitationRole::RestsOn, &way, ¬e),
|
||||
(CitationRole::Toward, &way, &q1),
|
||||
];
|
||||
assert_eq!(CitationRole::ALL.len(), 21);
|
||||
assert_eq!(CitationRole::ALL.len(), 22);
|
||||
for role in CitationRole::ALL {
|
||||
let selection =
|
||||
Selection { cited: Some(Incoming { role: role.name().into(), exists: true }), ..Selection::default() };
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ impl SelectionRow {
|
|||
D::FollowUp(follow_up) => vec![follow_up.repo.identity()],
|
||||
D::Stewardship(stewardship) => vec![stewardship.repo.identity()],
|
||||
D::HandOff(hand_off) => vec![hand_off.repo.identity()],
|
||||
D::Target(_) | D::Question(_) | D::Ruling(_) | D::Verdict(_) | D::Finding(_) | D::Instance(_) | D::Resolution(_) | D::Run(_) | D::Pulse(_) | D::Memory(_) | D::Research(_) | D::Idea(_) => {
|
||||
D::Target(_) | D::Question(_) | D::Ruling(_) | D::Verdict(_) | D::Finding(_) | D::Instance(_) | D::Resolution(_) | D::Run(_) | D::Pulse(_) | D::Reply(_) | D::Memory(_) | D::Research(_) | D::Idea(_) => {
|
||||
Vec::new()
|
||||
}
|
||||
},
|
||||
|
|
@ -329,7 +329,7 @@ impl Row for SelectionRow {
|
|||
}
|
||||
}
|
||||
|
||||
/// The organ's closed lists: eighteen schemas, twenty aliases, twenty-one roles.
|
||||
/// The organ's closed lists: nineteen schemas, twenty aliases, twenty-two roles.
|
||||
/// A schema's name is its id, so the substrate's alias matching resolves
|
||||
/// nothing beyond exact ids.
|
||||
pub(crate) struct Vocabulary;
|
||||
|
|
@ -375,7 +375,7 @@ fn invalid(field: impl Into<String>, value: &str, message: impl Into<String>) ->
|
|||
/// because `OrgRepo` identity is case-insensitive.
|
||||
///
|
||||
/// Refuses, naming the field the client sent: a `schemas` entry that is not
|
||||
/// one of the eighteen ids; a `keys` entry that is not a full id whose kind
|
||||
/// one of the nineteen ids; a `keys` entry that is not a full id whose kind
|
||||
/// segment reads and passes the leaf's ref grammar; an `any_of` value outside
|
||||
/// its alias's domain; and a `cites.target` whose key fails the ref grammar
|
||||
/// for its schema's kind (V24's rule, at this door). Whether the target
|
||||
|
|
@ -442,7 +442,7 @@ mod tests {
|
|||
/// refused at the substrate's door.
|
||||
#[test]
|
||||
fn each_kind_declares_exactly_its_aliases_and_none_is_numeric() {
|
||||
let table: [(K, &[&str]); 18] = [
|
||||
let table: [(K, &[&str]); 19] = [
|
||||
(K::Campaign, &["repo"]),
|
||||
(K::Target, &[]),
|
||||
(K::Question, &[]),
|
||||
|
|
@ -461,6 +461,7 @@ mod tests {
|
|||
(K::Memory, &["sort", "about", "memory_origin"]),
|
||||
(K::Research, &["pass"]),
|
||||
(K::Idea, &["pass"]),
|
||||
(K::Reply, &[]),
|
||||
];
|
||||
for (kind, extra) in table {
|
||||
let want = [&["root", "in_force", "faculty"][..], extra].concat();
|
||||
|
|
@ -473,10 +474,10 @@ mod tests {
|
|||
|
||||
/// Each role is declared by the one kind whose field carries it, and its
|
||||
/// targets are the kinds that field is typed to, "any" spelled as all
|
||||
/// eighteen.
|
||||
/// nineteen.
|
||||
#[test]
|
||||
fn each_kind_declares_the_roles_it_carries_and_their_targets() {
|
||||
let table: [(K, &[&str]); 18] = [
|
||||
let table: [(K, &[&str]); 19] = [
|
||||
(K::Campaign, &[]),
|
||||
(K::Target, &[]),
|
||||
(K::Question, &["raised_in"]),
|
||||
|
|
@ -495,13 +496,14 @@ mod tests {
|
|||
(K::Memory, &["consolidates"]),
|
||||
(K::Research, &["serves", "sources"]),
|
||||
(K::Idea, &["rests_on", "toward"]),
|
||||
(K::Reply, &["run"]),
|
||||
];
|
||||
for (kind, roles) in table {
|
||||
assert_eq!(sorted(Vocabulary.declared_roles(kind.type_id())), strings(roles), "{kind:?}");
|
||||
}
|
||||
assert_eq!(Vocabulary.target_leaves("answers"), vec![K::Question.type_id().to_string()]);
|
||||
assert_eq!(Vocabulary.target_leaves("rulings"), vec![K::Ruling.type_id().to_string()]);
|
||||
assert_eq!(Vocabulary.target_leaves("subject").len(), 18);
|
||||
assert_eq!(Vocabulary.target_leaves("subject").len(), 19);
|
||||
assert_eq!(
|
||||
sorted(Vocabulary.target_leaves("claims")),
|
||||
sorted([K::CutSpec, K::Finding, K::FollowUp].iter().map(|kind| kind.type_id().to_string()).collect())
|
||||
|
|
|
|||
Loading…
Reference in a new issue