Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
//! The image and the batch, the two places a rule or a view may look, and
//! every derivation over them. "In force" is recursive: a document is in force
//! when no resolution that is itself in force names it, so a withdrawn
//! resolution stops closing its subject. Computed over image and batch at rule
//! time, over the image at read time, never stored, and never from
//! `stored_at`.
use cultcache_rs ::CultCacheEnvelope ;
2026-10-09 14:09:16 +02:00
use eureka_pipeline ::{
2026-11-10 15:24:08 +00:00
DeskOutcome , Label , OrgRepo , PipelineCampaign , PipelineDocument , PipelineKind , PipelineRef , PipelineResolution , PipelineRun , PipelineStewardship , ResolutionOutcome ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
ResearchSource , RunOperator , Short , Slug ,
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
} ;
2026-09-29 05:16:05 +02:00
use schemars ::JsonSchema ;
use serde ::{ Deserialize , Serialize } ;
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
2026-11-03 11:26:27 +01:00
use crate ::image ::Image ;
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
use crate ::refusal ::MindRefusal ;
2026-11-08 17:47:43 +01:00
use crate ::rows ::root_and_local ;
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
/// A batch document after A3 and A5: decoded, keyed, and its envelope.
pub ( crate ) struct Staged {
pub ( crate ) kind : PipelineKind ,
pub ( crate ) key : String ,
pub ( crate ) document : PipelineDocument ,
pub ( crate ) envelope : CultCacheEnvelope ,
}
2026-11-03 11:26:27 +01:00
/// The held image at one snapshot and the batch, the two places a rule or a view
/// may look. The one door of visibility: a document is there when its writing
/// receipt's ordinal is at or before `as_of`. Admission runs at the head.
pub ( crate ) struct Docs < ' i > {
image : & ' i Image ,
as_of : u64 ,
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
pub ( crate ) batch : Vec < Staged > ,
}
RS-3 2: the read side is CultNet's selection over the organ's rows
The four hand-written filters, the order and the cap are deleted:
PipelineQuery, PipelineQueryPage, QUERY_LIMIT_MAX, Reader::matches, ordered,
repo_matches. Mind::query(selection, semantic) validates through
cultnet_rs::validate, closes the values door (rows.rs refuse_values, S6),
takes the snapshot from the cursor's own asOf (an asOf beyond the head is
CursorInvalid), builds Reader::at(as_of) so every derivation runs over the
documents admitted at or before it, and evaluates through cultnet_rs::select.
The page carries matched, asOf, the next cursor, headers or whole views by
projection, and typed edges when the selection hops.
rows.rs is the organ's vocabulary: SelectionRow (a Row), Vocabulary (a
RowSet: thirteen schemas, eleven aliases, fifteen roles) and the value door.
huginn-mind links cultnet-rs at the rev the daemon pins. Selection refusals
map totally onto SelectionInvalid, CursorInvalid or Unavailable. The wire's
Query carries CultLib's selection by $ref, and both published schemas are
regenerated. The relations RS-2 unpinned are re-pinned as selections.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-29 05:56:37 +02:00
pub ( crate ) fn kind_of_type ( type_id : & str ) -> Option < PipelineKind > {
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
PipelineKind ::ALL . iter ( ) . copied ( ) . find ( | kind | kind . type_id ( ) = = type_id )
}
2026-11-03 11:26:27 +01:00
impl < ' i > Docs < ' i > {
pub ( crate ) fn at ( image : & ' i Image , as_of : u64 ) -> Self {
Self { image , as_of , batch : Vec ::new ( ) }
}
fn visible ( & self , id : u32 ) -> bool {
self . image . row ( id ) . ordinal < = self . as_of
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
}
/// A4: one identity, once.
pub ( crate ) fn push ( & mut self , staged : Staged ) -> Result < ( ) , MindRefusal > {
if self . batch . iter ( ) . any ( | other | other . kind = = staged . kind & & other . key = = staged . key ) {
return Err ( MindRefusal ::IdentityCollision { kind : staged . kind , id : staged . key } ) ;
}
self . batch . push ( staged ) ;
Ok ( ( ) )
}
pub ( crate ) fn in_batch ( & self , kind : PipelineKind , id : & str ) -> Option < & PipelineDocument > {
self . batch . iter ( ) . find ( | staged | staged . kind = = kind & & staged . key = = id ) . map ( | staged | & staged . document )
}
2026-11-08 21:43:00 +00:00
/// Whether the mind holds this document as its own write rather than an import.
pub ( crate ) fn is_native ( & self , kind : PipelineKind , id : & str ) -> bool {
self . image . id_of ( kind , id ) . filter ( | row | self . visible ( * row ) ) . is_some_and ( | row | self . image . row ( row ) . view . admission . provenance . imported_from . is_none ( ) )
}
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
pub ( crate ) fn in_image ( & self , kind : PipelineKind , id : & str ) -> Option < & PipelineDocument > {
2026-11-03 11:26:27 +01:00
self . image . id_of ( kind , id ) . filter ( | row | self . visible ( * row ) ) . map ( | row | & self . image . row ( row ) . view . document )
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
}
2026-11-10 23:57:27 +00:00
/// The ordinal of the receipt that wrote an image document: its admission order.
pub ( crate ) fn ordinal_of ( & self , kind : PipelineKind , id : & str ) -> Option < u64 > {
self . image . id_of ( kind , id ) . filter ( | row | self . visible ( * row ) ) . map ( | row | self . image . row ( row ) . ordinal )
}
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
pub ( crate ) fn find ( & self , kind : PipelineKind , id : & str ) -> Option < & PipelineDocument > {
self . in_batch ( kind , id ) . or_else ( | | self . in_image ( kind , id ) )
}
2026-11-08 21:43:00 +00:00
/// Whether this mind holds a native write under `root` that an import must not meet (the batch is not asked).
2026-11-08 19:11:56 +01:00
pub ( crate ) fn root_holds_native_write ( & self , root : & str ) -> bool {
self . image . root_holds_native_write ( root )
}
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
pub ( crate ) fn of_kind ( & self , kind : PipelineKind ) -> impl Iterator < Item = ( & str , & PipelineDocument ) > {
let batch = self . batch . iter ( ) . filter ( move | staged | staged . kind = = kind ) . map ( | staged | ( staged . key . as_str ( ) , & staged . document ) ) ;
2026-11-03 11:26:27 +01:00
let image = self
. image
. of_kind ( kind )
. filter ( move | ( _ , row ) | self . visible ( * row ) )
. map ( move | ( key , row ) | ( key , & self . image . row ( row ) . view . document ) ) ;
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
batch . chain ( image )
}
pub ( crate ) fn stewardships ( & self ) -> impl Iterator < Item = ( & str , & PipelineStewardship ) > {
self . of_kind ( PipelineKind ::Stewardship ) . filter_map ( | ( key , document ) | match document {
PipelineDocument ::Stewardship ( stewardship ) = > Some ( ( key , stewardship ) ) ,
_ = > None ,
} )
}
/// Every resolution of one subject, in image and batch: the scope a
RS fix batch: read-side density, the smallest seal, R5's two shapes, stale prose
F1: AdmissionIndex::build now calls receipt::head before copying any
ordinal, so query and view refuse a receipt chain that is not exactly
{1..=N} (duplicate, gap, zero, or above-N) instead of trusting a stored
ordinal unchecked. New test query::tests::query_and_view_refuse_a_receipt_chain_that_is_not_dense
pins it behaviourally: it plants each broken chain directly (bypassing
admission) and asserts query and view both refuse. The schema's ordinal
gets minimum: 1 (was 0), matched by #[schemars(range(min = 1))] on
AdmissionFacts::ordinal. head's doc now says AdmissionIndex::build asks
it too.
F2: Mind::open_with is renamed to an internal open_checked, and a
test-only Mind::open_with is gated behind cfg(test) or the test-support
feature, exactly like store_path_for. Production reaches open_checked
only through Mind::open, which takes the store's per-path lock first.
mind::tests::a_mind_has_one_owner_at_a_time (pre-existing) still pins
that a second Mind::open on the same path is refused. The full store
seal against a second in-process owner over an arbitrary MindStore stays
a recorded follow-up. lib.rs's crate doc now names Mind::open as the
owner of "may this store be this instance's mind".
F3: R5 is not binary. Two loosenings are pinned as R5b and R5c in
mind.rs, with behavioural fixtures: a foreign type with no epoch record
at all still refuses MissingIdentity, not ForeignStore (R5b); an epoch
record at the current key with a foreign value, beside a foreign type,
still refuses ForeignEpoch, not ForeignStore (R5c).
F5: gate step numbering in mind.rs's doc comment and its test comments
now read 2 (epoch), 3 (type), matching the code's actual order. docs.rs
no longer credits resolutions_of/assignments_of with reading history,
which RS-2 deleted. The two-door test in query.rs is renamed from
a_ref_whose_kind_and_id_disagree_is_refused_by_both_doors to
..._by_view, since view is the only door left.
Per the operator's ruling retiring the anchor-based mutation harness,
this batch carries no .psd1 changes; the cut9/cut10/readside mutation
files have uncommitted edits from the earlier pass (stale references to
the old test names, and R3L's target) left for a later pass to fold in
or drop.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 18:34:47 +02:00
/// subject's sequence counts in.
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
pub ( crate ) fn resolutions_of ( & self , subject : & PipelineRef ) -> impl Iterator < Item = ( & str , & PipelineResolution ) > {
2026-11-03 11:26:27 +01:00
self . resolutions_naming ( subject . kind , & subject . id . 0 )
}
/// The resolutions naming one document: the batch's first, then the held ones visible at
/// `as_of` in resolution-key order, the order a closing resolution is found in.
fn resolutions_naming ( & self , kind : PipelineKind , id : & str ) -> impl Iterator < Item = ( & str , & PipelineResolution ) > {
let batch = self . batch . iter ( ) . filter_map ( move | staged | match & staged . document {
PipelineDocument ::Resolution ( resolution ) if resolution . subject . kind = = kind & & resolution . subject . id . 0 = = id = > {
Some ( ( staged . key . as_str ( ) , resolution ) )
}
_ = > None ,
} ) ;
let held = self . image . closers_of ( kind , id ) . filter ( move | ( _ , row ) | self . visible ( * row ) ) . filter_map ( move | ( key , row ) | {
match & self . image . row ( row ) . view . document {
PipelineDocument ::Resolution ( resolution ) = > Some ( ( key , resolution ) ) ,
_ = > None ,
}
} ) ;
batch . chain ( held )
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
}
/// Every assignment of one repo to one mind, in image and batch, in force
RS fix batch: read-side density, the smallest seal, R5's two shapes, stale prose
F1: AdmissionIndex::build now calls receipt::head before copying any
ordinal, so query and view refuse a receipt chain that is not exactly
{1..=N} (duplicate, gap, zero, or above-N) instead of trusting a stored
ordinal unchecked. New test query::tests::query_and_view_refuse_a_receipt_chain_that_is_not_dense
pins it behaviourally: it plants each broken chain directly (bypassing
admission) and asserts query and view both refuse. The schema's ordinal
gets minimum: 1 (was 0), matched by #[schemars(range(min = 1))] on
AdmissionFacts::ordinal. head's doc now says AdmissionIndex::build asks
it too.
F2: Mind::open_with is renamed to an internal open_checked, and a
test-only Mind::open_with is gated behind cfg(test) or the test-support
feature, exactly like store_path_for. Production reaches open_checked
only through Mind::open, which takes the store's per-path lock first.
mind::tests::a_mind_has_one_owner_at_a_time (pre-existing) still pins
that a second Mind::open on the same path is refused. The full store
seal against a second in-process owner over an arbitrary MindStore stays
a recorded follow-up. lib.rs's crate doc now names Mind::open as the
owner of "may this store be this instance's mind".
F3: R5 is not binary. Two loosenings are pinned as R5b and R5c in
mind.rs, with behavioural fixtures: a foreign type with no epoch record
at all still refuses MissingIdentity, not ForeignStore (R5b); an epoch
record at the current key with a foreign value, beside a foreign type,
still refuses ForeignEpoch, not ForeignStore (R5c).
F5: gate step numbering in mind.rs's doc comment and its test comments
now read 2 (epoch), 3 (type), matching the code's actual order. docs.rs
no longer credits resolutions_of/assignments_of with reading history,
which RS-2 deleted. The two-door test in query.rs is renamed from
a_ref_whose_kind_and_id_disagree_is_refused_by_both_doors to
..._by_view, since view is the only door left.
Per the operator's ruling retiring the anchor-based mutation harness,
this batch carries no .psd1 changes; the cut9/cut10/readside mutation
files have uncommitted edits from the earlier pass (stale references to
the old test names, and R3L's target) left for a later pass to fold in
or drop.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 18:34:47 +02:00
/// or not: the scope a stewardship's sequence counts in.
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
pub ( crate ) fn assignments_of ( & self , mind : & Slug , repo : & OrgRepo ) -> impl Iterator < Item = ( & str , & PipelineStewardship ) > {
self . stewardships ( ) . filter ( move | ( _ , stewardship ) | stewardship . instance = = * mind & & stewardship . repo = = * repo )
}
/// The greatest sequence among a subject's resolutions in image or batch,
/// `0` when it has none, so the next is `latest + 1`. `own` is the
/// document being checked, excluded by content identity so that an exact
/// replay measures the same `latest` the first admission did.
pub ( crate ) fn latest_resolution ( & self , subject : & PipelineRef , own : Option < & PipelineResolution > ) -> u32 {
self . resolutions_of ( subject )
. filter ( | ( _ , resolution ) | own ! = Some ( * resolution ) )
. map ( | ( _ , resolution ) | resolution . sequence )
. max ( )
. unwrap_or ( 0 )
}
/// The sequence a derivation takes: the one the record it already derived
/// carries, when image or batch holds that record, so an exact replay
/// re-derives the same document and A9 answers with the stored receipt;
/// otherwise the next. A derivation is recognised by what it writes into
/// its record: a resolution by its outcome, an assignment by its note.
pub ( crate ) fn derived_resolution_sequence (
& self ,
subject : & PipelineRef ,
derived : impl Fn ( & ResolutionOutcome ) -> bool ,
) -> u32 {
2026-11-03 11:26:27 +01:00
self . resolutions_of ( subject )
. find ( | ( _ , resolution ) | derived ( & resolution . outcome ) )
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
. map_or_else ( | | self . latest_resolution ( subject , None ) + 1 , | ( _ , resolution ) | resolution . sequence )
}
/// The same for the assignment a hand-off derives, which notes its key.
pub ( crate ) fn derived_stewardship_sequence ( & self , mind : & Slug , repo : & OrgRepo , note : & str ) -> u32 {
self . stewardships ( )
. find ( | ( _ , stewardship ) | stewardship . instance = = * mind & & stewardship . repo = = * repo & & stewardship . note . 0 = = note )
. map_or_else ( | | self . latest_stewardship ( mind , repo , None ) + 1 , | ( _ , stewardship ) | stewardship . sequence )
}
/// The same for a repo's assignments to one mind.
pub ( crate ) fn latest_stewardship ( & self , mind : & Slug , repo : & OrgRepo , own : Option < & PipelineStewardship > ) -> u32 {
self . assignments_of ( mind , repo )
. filter ( | ( _ , stewardship ) | own ! = Some ( * stewardship ) )
. map ( | ( _ , stewardship ) | stewardship . sequence )
. max ( )
. unwrap_or ( 0 )
}
/// No resolution that is itself in force names the document. The
/// recursion is the whole rule: a withdrawn resolution stops counting, so
/// its subject is open again. `key(R)` is strictly longer than the id it
/// resolves, so the chain is bounded and this terminates.
pub ( crate ) fn in_force ( & self , kind : PipelineKind , id : & str ) -> bool {
self . in_force_unless ( kind , id , | _ | false )
}
/// In force, ignoring a resolution the caller's own document is or
/// derives: the ruling that answers a question is what resolves it, the
/// hand-off that withdraws a stewardship is what resolves that, and a
/// resolution does not resolve its own subject out from under itself.
pub ( crate ) fn in_force_unless ( & self , kind : PipelineKind , id : & str , own : impl Fn ( & PipelineResolution ) -> bool ) -> bool {
self . closing_resolution_unless ( kind , id , own ) . is_none ( )
}
/// The in-force resolution naming the document, other than `own`, if any;
/// exact rather than a tie-break because A8 and the Q19 cap admit at most
/// one.
pub ( crate ) fn closing_resolution_unless (
& self ,
kind : PipelineKind ,
id : & str ,
own : impl Fn ( & PipelineResolution ) -> bool ,
) -> Option < ( & str , & PipelineResolution ) > {
2026-11-03 11:26:27 +01:00
self . resolutions_naming ( kind , id ) . find ( | & ( key , resolution ) | ! own ( resolution ) & & self . in_force ( PipelineKind ::Resolution , key ) )
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
}
2026-10-22 23:38:20 +02:00
/// The repos a campaign's cuts may name: the repo set of the highest-revision
/// in-force target of `campaign.slug` that names one, else the campaign's own
/// opening set. The one owner of membership (ruling campaign-repo-set-home).
pub ( crate ) fn repos_in_force < ' a > ( & ' a self , campaign : & ' a PipelineCampaign ) -> & ' a [ OrgRepo ] {
self . of_kind ( PipelineKind ::Target )
. filter_map ( | ( key , document ) | match document {
PipelineDocument ::Target ( target )
if target . campaign = = campaign . slug & & ! target . repos . is_empty ( ) & & self . in_force ( PipelineKind ::Target , key ) = >
{
Some ( target )
}
_ = > None ,
} )
. max_by_key ( | target | target . revision )
. map_or ( campaign . repos . as_slice ( ) , | target | target . repos . as_slice ( ) )
}
Read a mind: views, queries, open items and history
`query.rs` is the read side, over a `&Mind<S>` with no store file, no
daemon and no index. A `PipelineDocumentView` is four fields: the id,
because a `PipelineDocument` does not carry its key and a client must
never derive one; the document; the facts of its admission; and its
status.
The facts come from the commit receipts and from their `writes` alone,
so a document a later batch cited as a strong read keeps the receipt
that wrote it, and `admitted_at` is that receipt's `committed_at` -- the
`now` admission was passed -- never the store's `stored_at`. A pipeline
document the image holds and no receipt wrote is an integrity fault and
refuses; the store has one writer and the receipt is its proof.
Status is derived per call through `docs::Docs`, the same owner the
admission rules ask, so a withdrawn resolution reopens its subject for a
reader exactly when it reopens it for a rule. `closing_resolution` is
`in_force_unless`'s own body asked for the resolution rather than the
bool, so there is no second derivation to drift.
Four reads: `view` by id, `query` over the filters (root, repo, cut,
kinds, in force, faculty, an admission window), `open_items` for one
campaign's unanswered questions, standing findings, follow-ups,
unreported specs and unjudged reports, and `history` for every
resolution a subject ever had or every assignment of a repo to this
mind, withdrawn ones included with their reasons.
A query is ordered by `(admitted_at, id)`, capped at 200, and carries
`matched`, the count before the cap, so a truncation is never a short
page that reads like the whole answer. `semantic` is accepted by the
type and refused typed until Cut 11 owns the index; no substring filter
lives here to become a second answer to "the text of a document".
`cargo test -p huginn-mind --lib`: 56 passed, 0 failed, 0 warnings
(46 + the ten tests). `cargo check --workspace` clean. No dependency, no
target, no kind, no schema, no epoch; `Cargo.toml` and `Cargo.lock`
untouched.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:22:41 +02:00
/// The resolution that closes the document, if any: the views' status,
2026-11-08 17:47:43 +01:00
/// derived where admission derives whether there is one at all. A document
/// with no in-force closer of its own reads closed by the Moved resolution of
/// the campaign it is rooted at, the Moved resolution itself excepted. The
/// fallback is the status's alone: a rule asks `in_force`, which does not
/// have it, so a moved campaign's own closures keep their standing.
Read a mind: views, queries, open items and history
`query.rs` is the read side, over a `&Mind<S>` with no store file, no
daemon and no index. A `PipelineDocumentView` is four fields: the id,
because a `PipelineDocument` does not carry its key and a client must
never derive one; the document; the facts of its admission; and its
status.
The facts come from the commit receipts and from their `writes` alone,
so a document a later batch cited as a strong read keeps the receipt
that wrote it, and `admitted_at` is that receipt's `committed_at` -- the
`now` admission was passed -- never the store's `stored_at`. A pipeline
document the image holds and no receipt wrote is an integrity fault and
refuses; the store has one writer and the receipt is its proof.
Status is derived per call through `docs::Docs`, the same owner the
admission rules ask, so a withdrawn resolution reopens its subject for a
reader exactly when it reopens it for a rule. `closing_resolution` is
`in_force_unless`'s own body asked for the resolution rather than the
bool, so there is no second derivation to drift.
Four reads: `view` by id, `query` over the filters (root, repo, cut,
kinds, in force, faculty, an admission window), `open_items` for one
campaign's unanswered questions, standing findings, follow-ups,
unreported specs and unjudged reports, and `history` for every
resolution a subject ever had or every assignment of a repo to this
mind, withdrawn ones included with their reasons.
A query is ordered by `(admitted_at, id)`, capped at 200, and carries
`matched`, the count before the cap, so a truncation is never a short
page that reads like the whole answer. `semantic` is accepted by the
type and refused typed until Cut 11 owns the index; no substring filter
lives here to become a second answer to "the text of a document".
`cargo test -p huginn-mind --lib`: 56 passed, 0 failed, 0 warnings
(46 + the ten tests). `cargo check --workspace` clean. No dependency, no
target, no kind, no schema, no epoch; `Cargo.toml` and `Cargo.lock`
untouched.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:22:41 +02:00
pub ( crate ) fn closing_resolution ( & self , kind : PipelineKind , id : & str ) -> Option < ( & str , & PipelineResolution ) > {
2026-11-08 17:47:43 +01:00
self . closing_resolution_unless ( kind , id , | _ | false ) . or_else ( | | {
let moved = self . moved_campaign ( root_and_local ( id ) . 0 ) ? ;
( kind ! = PipelineKind ::Resolution | | id ! = moved . 0 ) . then_some ( moved )
} )
}
2026-11-08 18:07:27 +01:00
/// The Moved resolution over the campaign rooted at `root`, among the held documents visible at
/// `as_of`: the one fact that freezes a root and closes everything under it. A campaign takes no
/// other resolution and a Moved cannot be withdrawn (admission refuses both), so a campaign's
/// closers are this one alone and it is always in force. The batch is not asked, so a Moved and
/// the writes it lands beside are one receipt.
2026-11-08 17:47:43 +01:00
pub ( crate ) fn moved_campaign ( & self , root : & str ) -> Option < ( & ' i str , & ' i PipelineResolution ) > {
let image : & ' i Image = self . image ;
image
. of_kind ( PipelineKind ::Campaign )
. filter ( | ( key , _ ) | root_and_local ( key ) . 0 = = root )
. flat_map ( | ( key , _ ) | image . closers_of ( PipelineKind ::Campaign , key ) )
. filter ( | ( _ , row ) | self . visible ( * row ) )
. find_map ( | ( key , row ) | match & image . row ( row ) . view . document {
2026-11-08 18:07:27 +01:00
PipelineDocument ::Resolution ( resolution @ PipelineResolution { outcome : ResolutionOutcome ::Moved { .. } , .. } ) = > Some ( ( key , resolution ) ) ,
2026-11-08 17:47:43 +01:00
_ = > None ,
} )
Read a mind: views, queries, open items and history
`query.rs` is the read side, over a `&Mind<S>` with no store file, no
daemon and no index. A `PipelineDocumentView` is four fields: the id,
because a `PipelineDocument` does not carry its key and a client must
never derive one; the document; the facts of its admission; and its
status.
The facts come from the commit receipts and from their `writes` alone,
so a document a later batch cited as a strong read keeps the receipt
that wrote it, and `admitted_at` is that receipt's `committed_at` -- the
`now` admission was passed -- never the store's `stored_at`. A pipeline
document the image holds and no receipt wrote is an integrity fault and
refuses; the store has one writer and the receipt is its proof.
Status is derived per call through `docs::Docs`, the same owner the
admission rules ask, so a withdrawn resolution reopens its subject for a
reader exactly when it reopens it for a rule. `closing_resolution` is
`in_force_unless`'s own body asked for the resolution rather than the
bool, so there is no second derivation to drift.
Four reads: `view` by id, `query` over the filters (root, repo, cut,
kinds, in force, faculty, an admission window), `open_items` for one
campaign's unanswered questions, standing findings, follow-ups,
unreported specs and unjudged reports, and `history` for every
resolution a subject ever had or every assignment of a repo to this
mind, withdrawn ones included with their reasons.
A query is ordered by `(admitted_at, id)`, capped at 200, and carries
`matched`, the count before the cap, so a truncation is never a short
page that reads like the whole answer. `semantic` is accepted by the
type and refused typed until Cut 11 owns the index; no substring filter
lives here to become a second answer to "the text of a document".
`cargo test -p huginn-mind --lib`: 56 passed, 0 failed, 0 warnings
(46 + the ten tests). `cargo check --workspace` clean. No dependency, no
target, no kind, no schema, no epoch; `Cargo.toml` and `Cargo.lock`
untouched.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:22:41 +02:00
}
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
/// Every in-force stewardship of `(mind, repo)`, ignoring the withdrawal
/// `hand_off_key` derives. The stewardship row holds one in force at a
/// time, but that exclusion can put a second back in the list: the one a
/// replayed hand-off withdrew, beside whatever stewards the repo now.
pub ( crate ) fn stewardships_of (
& self ,
mind : & Slug ,
repo : & OrgRepo ,
hand_off_key : Option < & str > ,
) -> Vec < ( & str , & PipelineStewardship ) > {
self . assignments_of ( mind , repo )
. filter ( | ( key , _ ) | {
self . in_force_unless ( PipelineKind ::Stewardship , key , | resolution | {
matches! ( & resolution . outcome , ResolutionOutcome ::Withdrawn { reason } if Some ( reason . 0. as_str ( ) ) = = hand_off_key )
} )
} )
. collect ( )
}
2026-10-22 23:38:20 +02:00
/// The in-force record, other than `base_key`, that cannot stand beside
/// `base` on its line: the one question "may this record be in force"
/// asks, whether `base` is being admitted (a stewardship's
/// `AlreadyStewarded`) or put back in force by a withdrawal. A line holds
/// one stewardship at a time, so any other stands in its way; a revision
/// is only displaced by a later one.
pub ( crate ) fn rival_in_force ( & self , base_key : & str , base : & PipelineDocument ) -> Option < & str > {
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
let kind = base . kind ( ) ;
2026-10-22 23:38:20 +02:00
self . of_kind ( kind )
. find ( | ( key , other ) | * key ! = base_key & & rivals ( base , other ) & & self . in_force ( kind , key ) )
. map ( | ( key , _ ) | key )
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
}
2026-10-09 16:30:14 +02:00
/// The in-force run, other than `run_key`, that holds `claim`: the one
/// consumption fact run-is-the-grant rests on, asked by a run's opening
/// and by the withdrawal that would put a closed run back in force.
pub ( crate ) fn claim_holder ( & self , run_key : & str , claim : & PipelineRef ) -> Option < & str > {
self . of_kind ( PipelineKind ::Run ) . find_map ( | ( other_key , document ) | match document {
PipelineDocument ::Run ( other )
if other_key ! = run_key & & other . claims . contains ( claim ) & & self . in_force ( PipelineKind ::Run , other_key ) = >
{
Some ( other_key )
}
_ = > None ,
} )
}
2026-10-09 22:48:01 +02:00
/// The in-force run of hers, other than `run_key`, that holds the slot of
2026-11-08 11:01:39 +01:00
/// the turn `run` is of (a Persona session and a Sleep run share the
/// Persona slot): ruling one-live-self-run's one live run per
/// instance and slot, asked by a run's opening and by the withdrawal that
2026-10-09 22:48:01 +02:00
/// would put a closed run back in force. An operator's run neither holds
/// the slot nor is refused for it.
pub ( crate ) fn live_holder ( & self , run_key : & str , run : & PipelineRun ) -> Option < & str > {
if run . operated_by = = RunOperator ::Operator {
return None ;
}
self . of_kind ( PipelineKind ::Run ) . find_map ( | ( other_key , document ) | match document {
PipelineDocument ::Run ( other )
if other_key ! = run_key
& & other . instance = = run . instance
2026-11-08 11:01:39 +01:00
& & other . turn . slot ( ) = = run . turn . slot ( )
2026-10-09 22:48:01 +02:00
& & other . operated_by = = RunOperator ::Mind
& & self . in_force ( PipelineKind ::Run , other_key ) = >
{
Some ( other_key )
}
_ = > None ,
} )
}
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
/// The stewardship of `(mind, repo)` a hand-off acts on: the one whose
/// withdrawal already carries `hand_off_key`, when image or batch holds
/// that withdrawal, so a replay derives the same withdrawal again and A9
/// answers with the stored receipt; otherwise the one in force. Key order
/// cannot pick between the two the exclusion leaves standing -- once a
/// repo has changed hands ten times, `n11` sorts before `n2` -- so the
/// content match picks, as it does for the sequence the other derivations
/// take.
pub ( crate ) fn stewardship_of (
& self ,
mind : & Slug ,
repo : & OrgRepo ,
hand_off_key : Option < & str > ,
) -> Option < ( & str , & PipelineStewardship ) > {
let candidates = self . stewardships_of ( mind , repo , hand_off_key ) ;
hand_off_key
. and_then ( | hand_off | {
candidates . iter ( ) . find ( | ( key , _ ) | {
2026-11-03 11:26:27 +01:00
self . resolutions_naming ( PipelineKind ::Stewardship , key ) . any ( | ( _ , resolution ) | {
matches! ( & resolution . outcome , ResolutionOutcome ::Withdrawn { reason } if reason . 0 = = hand_off )
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
} )
} )
} )
. or_else ( | | candidates . first ( ) )
. copied ( )
}
}
2026-10-22 23:38:20 +02:00
/// The line a record belongs to (rulings `supersession-lineage-2` and `-3`): the one place
/// lineage is decided. A record supersedes, and is reinstated over, only a record
/// of its own line. `None` is a kind the resolution matrix never lets be
/// superseded; the match names every kind, so a new kind fails to compile until
/// its line is stated.
#[ derive(Clone, Copy, Debug, PartialEq, Eq) ]
pub ( crate ) enum Lineage < ' a > {
/// A target: the campaign.
Campaign ( & ' a Slug ) ,
/// A cut spec: the campaign and the cut.
Cut ( & ' a Slug , & ' a Label ) ,
/// A stewardship: the instance and the repo.
Assignment ( & ' a Slug , & ' a OrgRepo ) ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
/// A memory: the instance whose mind holds it, so a consolidating memory
/// replaces only her own.
Memories ( & ' a Slug ) ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
/// A ruling, a follow-up, a research note or an idea: operator directions and re-homed work cut
2026-10-22 23:38:20 +02:00
/// across campaigns.
Global ,
}
pub ( crate ) fn line_of ( document : & PipelineDocument ) -> Option < Lineage < '_ > > {
use PipelineDocument as D ;
match document {
D ::Target ( target ) = > Some ( Lineage ::Campaign ( & target . campaign ) ) ,
D ::CutSpec ( spec ) = > Some ( Lineage ::Cut ( & spec . campaign , & spec . cut ) ) ,
D ::Stewardship ( stewardship ) = > Some ( Lineage ::Assignment ( & stewardship . instance , & stewardship . repo ) ) ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
D ::Memory ( memory ) = > Some ( Lineage ::Memories ( & memory . instance ) ) ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
D ::Ruling ( _ ) | D ::FollowUp ( _ ) | D ::Research ( _ ) | D ::Idea ( _ ) = > Some ( Lineage ::Global ) ,
2026-10-22 23:38:20 +02:00
D ::Campaign ( _ )
| D ::Question ( _ )
| D ::CutReport ( _ )
| D ::Verdict ( _ )
| D ::Finding ( _ )
| D ::Resolution ( _ )
| D ::Instance ( _ )
| D ::HandOff ( _ )
2026-10-31 05:15:15 +01:00
| D ::Run ( _ )
2026-11-06 20:17:45 +00:00
| D ::Pulse ( _ )
2026-11-06 22:04:35 +00:00
| D ::Reply ( _ )
2026-11-10 15:24:08 +00:00
| D ::Thought ( _ )
| D ::DeskAnswer ( _ ) = > None ,
2026-10-22 23:38:20 +02:00
}
}
/// Whether `other` cannot stand in force beside `base`, being on `base`'s line:
/// any other stewardship of an instance and repo, a later revision of a target
/// or cut spec. A resolution is never a base here: the cap in `resolution_rule`
/// refuses the withdrawal that would reinstate one first.
fn rivals ( base : & PipelineDocument , other : & PipelineDocument ) -> bool {
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
use PipelineDocument as D ;
2026-10-22 23:38:20 +02:00
let Some ( line ) = line_of ( base ) else { return false } ;
if line_of ( other ) ! = Some ( line ) {
return false ;
}
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
match ( base , other ) {
2026-10-22 23:38:20 +02:00
( D ::Stewardship ( _ ) , D ::Stewardship ( _ ) ) = > true ,
( D ::Target ( base ) , D ::Target ( other ) ) = > other . revision > base . revision ,
( D ::CutSpec ( base ) , D ::CutSpec ( other ) ) = > other . revision > base . revision ,
Move every derivation out of admission into docs.rs
`Docs`, `Staged`, `Held`, `kind_of_type` and `later_than` leave
`admission.rs` whole and land in `src/docs.rs`, so the read side of Cut 9
can reach the derivations without admission exporting its internals. One
owner for in force: the views will call the same `Docs` the rules do,
never a second copy.
Three edits ride along, each an extraction the views need and admission
now runs through:
- `closing_resolution_unless` is `in_force_unless`'s body, returning the
resolution that closes a document rather than a bool; `in_force_unless`
is `.is_none()` over it.
- `resolutions_of` and `assignments_of` are the scope selectors
`latest_resolution`, `latest_stewardship` and `stewardships_of` already
spelled out one at a time.
Nothing else changes: same bodies, same call sites, `admission.rs` keeps
every rule and every `docs.` call reads as before. Its module doc says
where in force lives now.
Nine cut-8 entries re-anchor because their code moved: H33, H41, H62,
H63, H65, H66 and H67 by file, H47 and H60 on the scope selectors the
extraction introduced. Their rules are unchanged, and H49's mutant still
compiles because `Docs`'s fields are `pub(crate)`.
`cargo test -p huginn-mind --lib`: 46 passed, 0 failed, 0 warnings.
`eureka-cut8-mutations.psd1` through Epiphany's harness: M0 green,
H1-H67 all killed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 21:13:03 +02:00
_ = > false ,
}
}
2026-09-29 05:16:05 +02:00
/// The referring field of a citation edge, one per leaf field that names
/// another document. The wire spelling is the field's own name, so a client
/// reads an edge's role as the field it came from.
#[ derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema) ]
#[ serde(rename_all = " snake_case " ) ]
pub enum CitationRole {
RaisedIn ,
Answers ,
Rulings ,
Questions ,
CutSpec ,
Forks ,
CutReport ,
Findings ,
Verdict ,
Source ,
Subject ,
SupersededBy ,
ResolvedBy ,
DeferredTo ,
Documents ,
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
Claims ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
Consolidates ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
Serves ,
Sources ,
RestsOn ,
Toward ,
2026-11-06 20:17:45 +00:00
Run ,
2026-11-06 22:04:35 +00:00
Reads ,
2026-11-08 13:59:06 +01:00
DayThrough ,
2026-11-10 15:24:08 +00:00
Fork ,
Answer ,
2026-09-29 05:16:05 +02:00
}
impl CitationRole {
2026-11-10 15:24:08 +00:00
pub const ALL : [ CitationRole ; 26 ] = [
2026-09-29 05:16:05 +02:00
Self ::RaisedIn ,
Self ::Answers ,
Self ::Rulings ,
Self ::Questions ,
Self ::CutSpec ,
Self ::Forks ,
Self ::CutReport ,
Self ::Findings ,
Self ::Verdict ,
Self ::Source ,
Self ::Subject ,
Self ::SupersededBy ,
Self ::ResolvedBy ,
Self ::DeferredTo ,
Self ::Documents ,
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
Self ::Claims ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
Self ::Consolidates ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
Self ::Serves ,
Self ::Sources ,
Self ::RestsOn ,
Self ::Toward ,
2026-11-06 20:17:45 +00:00
Self ::Run ,
2026-11-06 22:04:35 +00:00
Self ::Reads ,
2026-11-08 13:59:06 +01:00
Self ::DayThrough ,
2026-11-10 15:24:08 +00:00
Self ::Fork ,
Self ::Answer ,
2026-09-29 05:16:05 +02:00
] ;
/// The wire spelling, equal to the referring field's name.
pub fn name ( self ) -> & 'static str {
match self {
Self ::RaisedIn = > " raised_in " ,
Self ::Answers = > " answers " ,
Self ::Rulings = > " rulings " ,
Self ::Questions = > " questions " ,
Self ::CutSpec = > " cut_spec " ,
Self ::Forks = > " forks " ,
Self ::CutReport = > " cut_report " ,
Self ::Findings = > " findings " ,
Self ::Verdict = > " verdict " ,
Self ::Source = > " source " ,
Self ::Subject = > " subject " ,
Self ::SupersededBy = > " superseded_by " ,
Self ::ResolvedBy = > " resolved_by " ,
Self ::DeferredTo = > " deferred_to " ,
Self ::Documents = > " documents " ,
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
Self ::Claims = > " claims " ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
Self ::Consolidates = > " consolidates " ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
Self ::Serves = > " serves " ,
Self ::Sources = > " sources " ,
Self ::RestsOn = > " rests_on " ,
Self ::Toward = > " toward " ,
2026-11-06 20:17:45 +00:00
Self ::Run = > " run " ,
2026-11-06 22:04:35 +00:00
Self ::Reads = > " reads " ,
2026-11-08 13:59:06 +01:00
Self ::DayThrough = > " day_through " ,
2026-11-10 15:24:08 +00:00
Self ::Fork = > " fork " ,
Self ::Answer = > " answer " ,
2026-09-29 05:16:05 +02:00
}
}
pub fn from_name ( name : & str ) -> Option < Self > {
Self ::ALL . into_iter ( ) . find ( | role | role . name ( ) = = name )
}
/// The kind whose documents carry this field.
pub fn carrier ( self ) -> PipelineKind {
use PipelineKind as K ;
match self {
Self ::RaisedIn = > K ::Question ,
Self ::Answers = > K ::Ruling ,
Self ::Rulings | Self ::Questions = > K ::CutSpec ,
Self ::CutSpec | Self ::Forks = > K ::CutReport ,
Self ::CutReport | Self ::Findings = > K ::Verdict ,
Self ::Verdict = > K ::Finding ,
Self ::Source = > K ::FollowUp ,
2026-11-08 13:59:06 +01:00
Self ::Subject | Self ::SupersededBy | Self ::ResolvedBy | Self ::DeferredTo | Self ::DayThrough = > K ::Resolution ,
2026-09-29 05:16:05 +02:00
Self ::Documents = > K ::HandOff ,
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
Self ::Claims = > K ::Run ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
Self ::Consolidates = > K ::Memory ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
Self ::Serves | Self ::Sources = > K ::Research ,
Self ::RestsOn | Self ::Toward = > K ::Idea ,
2026-11-06 20:17:45 +00:00
Self ::Run = > K ::Reply ,
2026-11-06 22:04:35 +00:00
Self ::Reads = > K ::Thought ,
2026-11-10 15:24:08 +00:00
Self ::Fork | Self ::Answer = > K ::DeskAnswer ,
2026-09-29 05:16:05 +02:00
}
}
/// The kinds a referent of this field may be: the one kind the field is
/// typed to, or every kind for the fields typed `PipelineRef` or a full
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
/// id of any kind. "Any" is spelled as every kind, never as none.
2026-09-29 05:16:05 +02:00
pub fn target_kinds ( self ) -> Vec < PipelineKind > {
use PipelineKind as K ;
match self {
2026-11-10 15:24:08 +00:00
Self ::Answers | Self ::Questions | Self ::Forks | Self ::Fork = > vec! [ K ::Question ] ,
2026-09-29 05:16:05 +02:00
Self ::Rulings = > vec! [ K ::Ruling ] ,
Self ::CutSpec = > vec! [ K ::CutSpec ] ,
Self ::CutReport = > vec! [ K ::CutReport ] ,
Self ::Findings = > vec! [ K ::Finding ] ,
Self ::Verdict = > vec! [ K ::Verdict ] ,
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
Self ::Claims = > vec! [ K ::CutSpec , K ::Finding , K ::FollowUp ] ,
2026-11-08 13:59:06 +01:00
Self ::Consolidates | Self ::DayThrough = > vec! [ K ::Memory ] ,
2026-11-06 20:17:45 +00:00
Self ::Run = > vec! [ K ::Run ] ,
2026-11-10 15:24:08 +00:00
Self ::Answer = > vec! [ K ::DeskAnswer ] ,
2026-09-29 05:16:05 +02:00
Self ::RaisedIn
| Self ::Source
| Self ::Subject
| Self ::SupersededBy
| Self ::ResolvedBy
| Self ::DeferredTo
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
| Self ::Documents
| Self ::Serves
| Self ::Sources
| Self ::RestsOn
2026-11-06 22:04:35 +00:00
| Self ::Toward
| Self ::Reads = > PipelineKind ::ALL . to_vec ( ) ,
2026-09-29 05:16:05 +02:00
}
}
}
/// The kind segment of a full id, for the fields typed `Short` whose referent
/// may be of any kind.
pub ( crate ) fn kind_of_id ( id : & str ) -> Option < PipelineKind > {
let name = id . split ( ':' ) . nth ( 1 ) ? ;
PipelineKind ::ALL . iter ( ) . copied ( ) . find ( | kind | kind . name ( ) = = name )
}
fn cited ( kind : PipelineKind , id : & Short ) -> PipelineRef {
PipelineRef { kind , id : id . clone ( ) }
}
/// What a resolution's outcome names, by the field that names it.
pub ( crate ) fn outcome_citations ( outcome : & ResolutionOutcome ) -> Vec < ( CitationRole , PipelineRef ) > {
match outcome {
ResolutionOutcome ::Superseded { by } = > by . iter ( ) . map ( | by | ( CitationRole ::SupersededBy , by . clone ( ) ) ) . collect ( ) ,
ResolutionOutcome ::Answered { by } = > vec! [ ( CitationRole ::ResolvedBy , by . clone ( ) ) ] ,
ResolutionOutcome ::Fixed { by : Some ( by ) , .. } = > vec! [ ( CitationRole ::ResolvedBy , by . clone ( ) ) ] ,
ResolutionOutcome ::Deferred { to } = > vec! [ ( CitationRole ::DeferredTo , to . clone ( ) ) ] ,
2026-11-08 13:59:06 +01:00
ResolutionOutcome ::Slept { day_through , .. } = > day_through . iter ( ) . map ( | memory | ( CitationRole ::DayThrough , memory . clone ( ) ) ) . collect ( ) ,
2026-11-08 17:47:43 +01:00
ResolutionOutcome ::Fixed { by : None , .. }
| ResolutionOutcome ::Recorded { .. }
| ResolutionOutcome ::Withdrawn { .. }
| ResolutionOutcome ::Moved { .. } = > {
2026-09-29 05:16:05 +02:00
vec! [ ]
}
}
}
/// Every citation edge a document carries, derived from its leaf fields each
/// time it is asked and never stored: the one edge list. Admission's A7 reads
/// it to require the referents, and the read side's rows read it as their
/// references. `Fixed.commit`, `ForeignRef` precedents and the labels
/// (`depends_on`, `invariants`, `promise`) are not edges. A hand-off's
/// `documents` entry whose kind segment does not read cites nothing here;
/// admission refuses such an entry on the source side before it asks.
pub ( crate ) fn citations ( document : & PipelineDocument ) -> Vec < ( CitationRole , PipelineRef ) > {
use CitationRole as R ;
use PipelineDocument as D ;
use PipelineKind as K ;
let mut edges = Vec ::new ( ) ;
match document {
D ::Question ( question ) = > edges . extend ( question . raised_in . iter ( ) . map ( | to | ( R ::RaisedIn , to . clone ( ) ) ) ) ,
D ::Ruling ( ruling ) = > edges . extend ( ruling . answers . iter ( ) . map ( | to | ( R ::Answers , cited ( K ::Question , to ) ) ) ) ,
D ::CutSpec ( spec ) = > {
edges . extend ( spec . rulings . iter ( ) . map ( | to | ( R ::Rulings , cited ( K ::Ruling , to ) ) ) ) ;
edges . extend ( spec . questions . iter ( ) . map ( | to | ( R ::Questions , cited ( K ::Question , to ) ) ) ) ;
}
D ::CutReport ( report ) = > {
edges . push ( ( R ::CutSpec , cited ( K ::CutSpec , & report . cut_spec ) ) ) ;
edges . extend ( report . forks . iter ( ) . map ( | to | ( R ::Forks , cited ( K ::Question , to ) ) ) ) ;
}
D ::Verdict ( verdict ) = > {
edges . push ( ( R ::CutReport , cited ( K ::CutReport , & verdict . cut_report ) ) ) ;
edges . extend (
verdict
. claims
. iter ( )
. flat_map ( | claim | claim . findings . iter ( ) )
. map ( | to | ( R ::Findings , cited ( K ::Finding , to ) ) ) ,
) ;
}
D ::Finding ( finding ) = > edges . push ( ( R ::Verdict , cited ( K ::Verdict , & finding . verdict ) ) ) ,
D ::FollowUp ( follow_up ) = > edges . push ( ( R ::Source , follow_up . source . clone ( ) ) ) ,
D ::Resolution ( resolution ) = > {
edges . push ( ( R ::Subject , resolution . subject . clone ( ) ) ) ;
edges . extend ( outcome_citations ( & resolution . outcome ) ) ;
}
D ::HandOff ( hand_off ) = > edges . extend (
hand_off . documents . iter ( ) . filter_map ( | to | kind_of_id ( & to . 0 ) . map ( | kind | ( R ::Documents , cited ( kind , to ) ) ) ) ,
) ,
Mind: run admission with AlreadyClaimed, the run resolution row, the claims edge
A run's instance must be this mind. Every claim must name a document in force
(MissingReference, CitesResolvedDocument); a claim held by another run in force
is refused AlreadyClaimed { item, run }, so the claim is the one consumption
fact. A byte-identical replay of an admitted run owes its claims no fresh
freedom and answers AlreadyAdmitted. A run resolves Recorded or Withdrawn only.
Runs cite their claims under role `claims`, so cites and cited selections reach
them; the header facts carry label, operator, turn, start and claims.
The published schemas that embed PipelineKind (finding, follow_up, question,
resolution, ruling) and the two mind wire schemas are re-derived: the Run
variant, PipelineFacts::Run, AlreadyClaimed and the claims role. The leaf commit
before this one has those five stale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 16:07:19 +02:00
D ::Run ( run ) = > edges . extend ( run . claims . iter ( ) . map ( | to | ( R ::Claims , to . clone ( ) ) ) ) ,
2026-11-06 20:17:45 +00:00
D ::Reply ( reply ) = > edges . push ( ( R ::Run , reply . run . clone ( ) ) ) ,
2026-11-06 22:04:35 +00:00
D ::Thought ( thought ) = > edges . extend ( thought . reads . iter ( ) . map ( | to | ( R ::Reads , to . clone ( ) ) ) ) ,
memory: a persistent kind for what a Mind keeps (eureka-pipeline, huginn-mind)
epiphany.pipeline.memory.v2, instance-rooted `<instance>:memory:<label>`:
PipelineMemory with seven sorts (Asked, Decided, Committed, Learned, Did,
Idea, Rapport), her own text, who it is about, where it was learned, whether
directly, what it rests on, a salience that only ranks, and the memories a
consolidating one replaces.
Admission refuses a foreign instance and resolves a memory only Deferred to a
follow-up (an ask taken on), Recorded, Withdrawn or Superseded by a memory.
Memories have their own lineage so supersession stays within one mind. The
read side selects by sort, about (multi-valued) and direct; the index carries
the text; `consolidates` is a citation role.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:15:40 +01:00
D ::Memory ( memory ) = > edges . extend ( memory . consolidates . iter ( ) . map ( | to | ( R ::Consolidates , to . clone ( ) ) ) ) ,
research and idea: two kinds for what a pass finds and what could be, and the recipes known, pass and ideas (eureka-pipeline, huginn-mind, eureka-state)
epiphany.pipeline.research.v2 (one claim, typed sources, no status) and
epiphany.pipeline.idea.v2 (what could be, rests_on / toward), campaign-rooted
as <campaign>:research|idea:<pass>.<label>. Resolutions are the matrix alone;
lineage is Global; roles serves, sources, rests_on, toward; alias pass; index
text without a version bump. No faculty is told to use them yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 15:13:33 +01:00
D ::Research ( research ) = > {
edges . extend ( research . serves . iter ( ) . map ( | to | ( R ::Serves , to . clone ( ) ) ) ) ;
edges . extend ( research . sources . iter ( ) . filter_map ( | source | match source {
ResearchSource ::Document { reference } = > Some ( ( R ::Sources , reference . clone ( ) ) ) ,
_ = > None ,
} ) ) ;
}
D ::Idea ( idea ) = > {
edges . extend ( idea . rests_on . iter ( ) . map ( | to | ( R ::RestsOn , to . clone ( ) ) ) ) ;
edges . extend ( idea . toward . iter ( ) . map ( | to | ( R ::Toward , to . clone ( ) ) ) ) ;
}
2026-11-10 15:24:08 +00:00
D ::DeskAnswer ( answer ) = > {
edges . push ( ( R ::Fork , cited ( K ::Question , & answer . fork ) ) ) ;
match & answer . outcome {
DeskOutcome ::Revision { of : id } | DeskOutcome ::Retraction { retracts : id } = > edges . push ( ( R ::Answer , cited ( K ::DeskAnswer , id ) ) ) ,
DeskOutcome ::Counted | DeskOutcome ::Refused { .. } = > { }
}
}
2026-10-31 05:15:15 +01:00
D ::Campaign ( _ ) | D ::Target ( _ ) | D ::Instance ( _ ) | D ::Stewardship ( _ ) | D ::Pulse ( _ ) = > { }
2026-09-29 05:16:05 +02:00
}
edges
}
2026-10-22 23:38:20 +02:00
#[ cfg(test) ]
mod tests {
use super ::* ;
use crate ::fixtures ::* ;
use PipelineDocument as D ;
use PipelineKind as K ;
fn named ( campaign : & str , revision : u32 , repos : & [ & str ] ) -> ( String , D ) {
let D ::Target ( mut target ) = target ( revision , & [ INVARIANT ] ) else { panic! ( " a target " ) } ;
target . campaign = campaign . into ( ) ;
target . repos = repos . iter ( ) . map ( | name | repo ( name ) ) . collect ( ) ;
( format! ( " {campaign} :target:r {revision} " ) , D ::Target ( target ) )
}
/// Membership is the highest-revision target of this campaign that is in
/// force and names repos. The image is built by hand because admission
/// cannot reach it: a revision above 1 supersedes its predecessor in its
/// own batch, a target is superseded only within its campaign, and an
/// empty revision after a repo-naming one is refused, so through admission
/// a closed repo-naming target is always older than the in-force one.
///
/// Taking the lowest revision instead of the highest changes nothing there
/// either (one target per campaign is in force), so that mutation is
/// equivalent and not pinned.
#[ test ]
fn repos_in_force_is_this_campaigns_in_force_naming_target ( ) {
let D ::Campaign ( this ) = campaign ( & [ REPO ] ) else { panic! ( " a campaign " ) } ;
let ( in_force_key , in_force ) = named ( CAMPAIGN , 1 , & [ REPO , OTHER_REPO ] ) ;
let ( closed_key , closed ) = named ( CAMPAIGN , 2 , & [ " GameCult/Closed " ] ) ;
let ( foreign_key , foreign ) = named ( " other-campaign " , 3 , & [ " GameCult/Foreign " ] ) ;
let closing = resolution ( r ( K ::Target , & closed_key ) , superseded ( & [ r ( K ::Target , & in_force_key ) ] ) ) ;
2026-11-03 11:26:27 +01:00
let image = Image ::of_documents ( vec! [
( K ::Target , in_force_key , in_force ) ,
( K ::Target , closed_key , closed ) ,
( K ::Target , foreign_key , foreign ) ,
( K ::Resolution , id ( " resolution " , " target.r2.n1 " ) , closing ) ,
] ) ;
let docs = Docs ::at ( & image , image . head ) ;
2026-10-22 23:38:20 +02:00
assert_eq! ( docs . repos_in_force ( & this ) , [ repo ( REPO ) , repo ( OTHER_REPO ) ] , " neither the closed higher revision nor another campaign's higher target decides " ) ;
}
}