Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions crates/switchyard-desktop/src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub struct Entry {
pub session_id: Option<String>,
#[serde(default)]
pub turn_id: Option<String>,
/// The caller-set origin header, such as `codex` or `claude`, when the harness sent one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • crates/switchyard-desktop/src/history.rs:22-24 — confirmed, no issue: origin is additive with #[serde(default)], and no struct-literal construction of Entry exists in the crate, so nothing else needs updating. The test now asserts both the present and absent cases.

#[serde(default)]
pub origin: Option<String>,
#[serde(default)]
pub route_id: String,
#[serde(default)]
Expand All @@ -31,3 +34,19 @@ pub struct Entry {
#[serde(default)]
pub cost: Option<switchyard_costs::RecordedCost>,
}

#[cfg(test)]
mod tests {
use super::Entry;

#[test]
fn origin_is_optional() {
let with: Entry =
serde_json::from_str(r#"{"ts":"2026-10-08T12:00:00Z","model":"m","origin":"claude"}"#)
.expect("entry");
assert_eq!(with.origin.as_deref(), Some("claude"));
let without: Entry =
serde_json::from_str(r#"{"ts":"2026-10-08T12:00:00Z","model":"m"}"#).expect("entry");
assert!(without.origin.is_none());
}
}
3 changes: 2 additions & 1 deletion crates/switchyard-desktop/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//! Desktop settings, server checks, and installation support.
//! Desktop settings, server checks, installation support, and harness transcript reading.

pub mod config;
pub mod health;
pub mod history;
pub mod install;
pub mod rollup;
pub mod transcripts;
Loading
Loading