feat(claudbg-xokw): accept 'msgs' as alias for 'messages' in filter fields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
Elijah Voigt 2 months ago
parent f6a4bd0535
commit fd54cebd57

@ -1,10 +1,13 @@
--- ---
# claudbg-xokw # claudbg-xokw
title: 'Filter: accept ''msgs''/''messages'' as aliases for message count filter' title: 'Filter: accept ''msgs''/''messages'' as aliases for message count filter'
status: todo status: completed
type: bug type: bug
priority: normal
created_at: 2026-04-01T16:47:06Z created_at: 2026-04-01T16:47:06Z
updated_at: 2026-04-01T16:47:06Z updated_at: 2026-04-01T16:51:12Z
--- ---
For filtering, both 'msgs' and 'messages' should be accepted as field names when filtering on message count, since the UI displays the column as 'msgs'. For filtering, both 'msgs' and 'messages' should be accepted as field names when filtering on message count, since the UI displays the column as 'msgs'.
## Summary of Changes\n\nAdded 'messages' as alias for 'msgs' in filter field matching so both forms work for filtering by message count.

@ -138,7 +138,7 @@ impl Key {
"project" => Some(Key::Project), "project" => Some(Key::Project),
"id" => Some(Key::Id), "id" => Some(Key::Id),
"agents" => Some(Key::Agents), "agents" => Some(Key::Agents),
"messages" => Some(Key::Messages), "messages" | "msgs" => Some(Key::Messages),
"in" => Some(Key::In), "in" => Some(Key::In),
"out" => Some(Key::Out), "out" => Some(Key::Out),
"tokens" => Some(Key::Tokens), "tokens" => Some(Key::Tokens),
@ -230,7 +230,7 @@ fn parse_atom(atom: &str) -> Result<Predicate> {
let key = Key::parse(key_str).ok_or_else(|| { let key = Key::parse(key_str).ok_or_else(|| {
AppError::Parse(format!( AppError::Parse(format!(
"unknown filter key '{key_str}' — valid keys: model, project, id, agents, messages, in, out, tokens, date" "unknown filter key '{key_str}' — valid keys: model, project, id, agents, messages, msgs, in, out, tokens, date"
)) ))
})?; })?;
@ -509,7 +509,11 @@ mod tests {
} }
/// Build a row with the given token counts; all other fields use fixed defaults. /// Build a row with the given token counts; all other fields use fixed defaults.
fn make_row_with_tokens(full_id: &str, input_tokens: u64, output_tokens: u64) -> SessionListItem { fn make_row_with_tokens(
full_id: &str,
input_tokens: u64,
output_tokens: u64,
) -> SessionListItem {
SessionListItem { SessionListItem {
short_id: full_id.get(..8).unwrap_or(full_id).to_string(), short_id: full_id.get(..8).unwrap_or(full_id).to_string(),
full_id: full_id.to_string(), full_id: full_id.to_string(),
@ -1071,7 +1075,8 @@ mod tests {
fn in_and_out_combined() { fn in_and_out_combined() {
// Large input AND small output — very "reading-heavy" sessions. // Large input AND small output — very "reading-heavy" sessions.
let f = Filter::parse("in>10000 AND out<500").unwrap(); let f = Filter::parse("in>10000 AND out<500").unwrap();
let reading_heavy = make_row_with_tokens("aaaaaaaa-0000-0000-0000-000000000000", 50000, 200); let reading_heavy =
make_row_with_tokens("aaaaaaaa-0000-0000-0000-000000000000", 50000, 200);
let balanced = make_row_with_tokens("bbbbbbbb-0000-0000-0000-000000000000", 50000, 2000); let balanced = make_row_with_tokens("bbbbbbbb-0000-0000-0000-000000000000", 50000, 2000);
assert!(f.matches(&reading_heavy)); assert!(f.matches(&reading_heavy));
assert!(!f.matches(&balanced)); assert!(!f.matches(&balanced));

@ -56,7 +56,7 @@ const HELP_TEXT: &str = "\
project:foo substring\n\ project:foo substring\n\
id:abc substring\n\ id:abc substring\n\
agents>0 numeric\n\ agents>0 numeric\n\
messages<50 numeric\n\ messages<50 numeric (alias: msgs)\n\
in>5000 input tokens\n\ in>5000 input tokens\n\
out<1000 output tokens\n\ out<1000 output tokens\n\
tokens>50000 total tokens\n\ tokens>50000 total tokens\n\

Loading…
Cancel
Save