mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
21d36296f1
## Summary - Add backend-client types and fetch support for active workspace messages. - Add the app-server v2 `account/workspaceMessages/read` method, generated schemas, and README documentation. - Delegate workspace-message eligibility to the Codex backend feature gate; map a backend 404 to `featureEnabled: false`. ## Testing - `just write-app-server-schema` - `just test -p codex-backend-client` - `just test -p codex-app-server-protocol` - `just test -p codex-app-server workspace_messages` - `just fix -p codex-backend-client -p codex-app-server-protocol -p codex-app-server` - `just fmt` ## Stack - Base PR for #28232, which adds the TUI status-line integration.
52 lines
1.6 KiB
Rust
52 lines
1.6 KiB
Rust
use super::*;
|
|
use codex_app_server_protocol::WorkspaceMessage;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn workspace_headline_from_response_uses_first_non_empty_headline() {
|
|
let response = GetWorkspaceMessagesResponse {
|
|
feature_enabled: true,
|
|
messages: vec![
|
|
WorkspaceMessage {
|
|
message_id: "announcement-id".to_string(),
|
|
message_type: WorkspaceMessageType::Announcement,
|
|
message_body: "Announcement body".to_string(),
|
|
created_at: None,
|
|
archived_at: None,
|
|
},
|
|
WorkspaceMessage {
|
|
message_id: "empty-headline-id".to_string(),
|
|
message_type: WorkspaceMessageType::Headline,
|
|
message_body: " ".to_string(),
|
|
created_at: None,
|
|
archived_at: None,
|
|
},
|
|
WorkspaceMessage {
|
|
message_id: "headline-id".to_string(),
|
|
message_type: WorkspaceMessageType::Headline,
|
|
message_body: " Workspace headline ".to_string(),
|
|
created_at: None,
|
|
archived_at: None,
|
|
},
|
|
],
|
|
};
|
|
|
|
assert_eq!(
|
|
workspace_headline_from_response(response),
|
|
WorkspaceHeadlineFetchResult::Available(Some("Workspace headline".to_string()))
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn workspace_headline_from_response_reports_feature_disabled() {
|
|
let response = GetWorkspaceMessagesResponse {
|
|
feature_enabled: false,
|
|
messages: Vec::new(),
|
|
};
|
|
|
|
assert_eq!(
|
|
workspace_headline_from_response(response),
|
|
WorkspaceHeadlineFetchResult::FeatureDisabled
|
|
);
|
|
}
|