Add Epiphany map proposal surface
This commit is contained in:
parent
cecf0c676c
commit
7eb449b0a9
13 changed files with 701 additions and 27 deletions
|
|
@ -346,6 +346,11 @@ client_request_definitions! {
|
|||
params: v2::ThreadEpiphanyDistillParams,
|
||||
response: v2::ThreadEpiphanyDistillResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/propose")]
|
||||
ThreadEpiphanyPropose => "thread/epiphany/propose" {
|
||||
params: v2::ThreadEpiphanyProposeParams,
|
||||
response: v2::ThreadEpiphanyProposeResponse,
|
||||
},
|
||||
#[experimental("thread/epiphany/promote")]
|
||||
ThreadEpiphanyPromote => "thread/epiphany/promote" {
|
||||
params: v2::ThreadEpiphanyPromoteParams,
|
||||
|
|
@ -1777,6 +1782,46 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_propose_response() -> Result<()> {
|
||||
let response = ClientResponse::ThreadEpiphanyPropose {
|
||||
request_id: RequestId::Integer(12),
|
||||
response: v2::ThreadEpiphanyProposeResponse {
|
||||
expected_revision: 7,
|
||||
patch: v2::ThreadEpiphanyUpdatePatch {
|
||||
churn: Some(codex_protocol::protocol::EpiphanyChurnState {
|
||||
understanding_status: "proposal_ready".to_string(),
|
||||
diff_pressure: "low".to_string(),
|
||||
graph_freshness: Some("proposal".to_string()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
assert_eq!(response.id(), &RequestId::Integer(12));
|
||||
assert_eq!(response.method(), "thread/epiphany/propose");
|
||||
assert_eq!(
|
||||
json!({
|
||||
"method": "thread/epiphany/propose",
|
||||
"id": 12,
|
||||
"response": {
|
||||
"expectedRevision": 7,
|
||||
"patch": {
|
||||
"churn": {
|
||||
"understanding_status": "proposal_ready",
|
||||
"diff_pressure": "low",
|
||||
"graph_freshness": "proposal"
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
serde_json::to_value(&response)?,
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn serialize_thread_epiphany_promote_response() -> Result<()> {
|
||||
let response = ClientResponse::ThreadEpiphanyPromote {
|
||||
|
|
@ -2378,6 +2423,19 @@ mod tests {
|
|||
assert_eq!(reason, Some("thread/epiphany/distill"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_propose_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyPropose {
|
||||
request_id: RequestId::Integer(1),
|
||||
params: v2::ThreadEpiphanyProposeParams {
|
||||
thread_id: "thr_123".to_string(),
|
||||
observation_ids: vec!["obs-123".to_string()],
|
||||
},
|
||||
};
|
||||
let reason = crate::experimental_api::ExperimentalApi::experimental_reason(&request);
|
||||
assert_eq!(reason, Some("thread/epiphany/propose"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_epiphany_promote_is_marked_experimental() {
|
||||
let request = ClientRequest::ThreadEpiphanyPromote {
|
||||
|
|
|
|||
|
|
@ -3957,6 +3957,23 @@ pub struct ThreadEpiphanyDistillResponse {
|
|||
pub patch: ThreadEpiphanyUpdatePatch,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyProposeParams {
|
||||
pub thread_id: String,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub observation_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadEpiphanyProposeResponse {
|
||||
pub expected_revision: u64,
|
||||
pub patch: ThreadEpiphanyUpdatePatch,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
|
|
|||
Reference in a new issue