fix(app-server): fix optional bool annotations (#24099)

`#[serde(default)]` wasn't sufficient for our generated TS types to
reflect that clients didn't have to set them. We also need
`skip_serializing_if = "std::ops::Not::not"`. This is already a rule in
our agents.md file.
This commit is contained in:
Owen Lin
2026-05-22 09:52:53 -07:00
committed by GitHub
Unverified
parent 014f19af5f
commit cff960896c
16 changed files with 31 additions and 32 deletions
@@ -2547,8 +2547,22 @@ mod tests {
json!({
"method": "account/read",
"id": 6,
"params": {}
}),
serde_json::to_value(&request)?,
);
let request = ClientRequest::GetAccount {
request_id: RequestId::Integer(7),
params: v2::GetAccountParams {
refresh_token: true,
},
};
assert_eq!(
json!({
"method": "account/read",
"id": 7,
"params": {
"refreshToken": false
"refreshToken": true
}
}),
serde_json::to_value(&request)?,
@@ -224,7 +224,7 @@ pub struct GetAccountParams {
/// In managed auth mode this triggers the normal refresh-token flow. In
/// external auth mode this flag is ignored. Clients should refresh tokens
/// themselves and call `account/login/start` with `chatgptAuthTokens`.
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub refresh_token: bool,
}
@@ -357,7 +357,7 @@ pub enum ConfigWriteErrorCode {
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ConfigReadParams {
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub include_layers: bool,
/// Optional working directory to resolve project config layers. If specified,
/// return the effective config as seen from that directory (i.e., including any
@@ -14,6 +14,7 @@ pub struct FeedbackUploadParams {
pub reason: Option<String>,
#[ts(optional = nullable)]
pub thread_id: Option<String>,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub include_logs: bool,
#[ts(optional = nullable)]
pub extra_log_files: Option<Vec<PathBuf>>,
@@ -162,13 +162,13 @@ pub struct ThreadStartParams {
/// If true, opt into emitting raw Responses API items on the event stream.
/// This is for internal use only (e.g. Codex Cloud).
#[experimental("thread/start.experimentalRawEvents")]
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub experimental_raw_events: bool,
/// Deprecated and ignored by app-server. Kept only so older clients can
/// continue sending the field while rollout persistence always uses the
/// limited history policy.
#[experimental("thread/start.persistFullHistory")]
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub persist_extended_history: bool,
}
@@ -401,7 +401,7 @@ pub struct ThreadResumeParams {
/// continue sending the field while rollout persistence always uses the
/// limited history policy.
#[experimental("thread/resume.persistFullHistory")]
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub persist_extended_history: bool,
}
@@ -518,7 +518,7 @@ pub struct ThreadForkParams {
/// continue sending the field while rollout persistence always uses the
/// limited history policy.
#[experimental("thread/fork.persistFullHistory")]
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub persist_extended_history: bool,
}
@@ -1132,7 +1132,7 @@ pub enum ThreadActiveFlag {
pub struct ThreadReadParams {
pub thread_id: String,
/// When true, include turns and their items from rollout history.
#[serde(default)]
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub include_turns: bool,
}