viewer: journal text for asset.acquisition_linked; a test that every event type the store writes has plain-language journal text
check / check (push) Waiting to run
check / check (push) Waiting to run
The acquisition link was added after the viewer's asset work and showed its raw event name in recent activity. The new test reads the event types from the store's replay arms, so the next new event without text fails it (checked: it fails without this fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
1 parent
ee7e205f5c
commit
2e14c702c0
3 files changed
+55
-9
No files matched your search
@@ -612,3 +612,42 @@ proptest! {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Every event the store can journal reads as a sentence in the journal
|
||||
/// and recent activity, never as its raw type: the event types come from
|
||||
/// the store's own source (its replay arms), so a new event without
|
||||
/// journal text fails here. (asset.acquisition_linked showed raw,
|
||||
/// 2026-10-15.)
|
||||
#[test]
|
||||
fn every_journal_event_has_plain_language_text() {
|
||||
let src = include_str!("../../ledger-store/src/store.rs");
|
||||
let mut kinds: Vec<&str> = src
|
||||
.lines()
|
||||
.flat_map(|l| l.split('"').skip(1).step_by(2))
|
||||
.filter(|t| {
|
||||
let mut parts = t.split('.');
|
||||
matches!(
|
||||
(parts.next(), parts.next(), parts.next()),
|
||||
(Some(a), Some(b), None)
|
||||
if !a.is_empty() && !b.is_empty()
|
||||
&& a.chars().chain(b.chars()).all(|c| c.is_ascii_lowercase() || c == '_')
|
||||
)
|
||||
})
|
||||
.filter(|t| src.contains(&format!("\"{t}\" =>")) || src.contains(&format!("\"{t}\" |")))
|
||||
.collect();
|
||||
kinds.sort_unstable();
|
||||
kinds.dedup();
|
||||
assert!(kinds.len() > 30, "found only {kinds:?}");
|
||||
let f = fixture("every-event");
|
||||
for kind in kinds {
|
||||
let line = ledger_store::JournalLine {
|
||||
seq: 1,
|
||||
ts: "2026-10-15T00:00:00Z".into(),
|
||||
line_type: kind.to_string(),
|
||||
payload: serde_json::json!({}),
|
||||
prev: String::new(),
|
||||
};
|
||||
let e = ledger_gui::pages::journal::describe_any(&f.books, &line);
|
||||
assert_ne!(e.text, kind, "{kind} has no journal text");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user