[codex] cover app-owned HTTP requests [ci changed_files]

This commit is contained in:
Cooper Gamble
2026-06-03 23:44:25 +00:00
parent ec2e111e04
commit d766866d3c
52 changed files with 1415 additions and 358 deletions
@@ -77,6 +77,18 @@ fn stores_state_in_one_file_per_surface() {
);
}
#[test]
fn derives_an_independent_surface_selection() {
let codex_home = TempDir::new().expect("tempdir");
let cli = HttpStateContext::new(codex_home.path().to_path_buf(), HttpStateSurface::CodexCli);
let desktop = cli.for_surface(HttpStateSurface::CodexDesktop);
desktop.set_surface(HttpStateSurface::CodexVscode);
assert_eq!(cli.surface(), HttpStateSurface::CodexCli);
assert_eq!(desktop.surface(), HttpStateSurface::CodexVscode);
}
#[test]
fn compare_and_set_rejects_a_stale_prior_value() {
let codex_home = TempDir::new().expect("tempdir");
+7
View File
@@ -247,6 +247,13 @@ impl HttpStateContext {
true
}
pub fn for_surface(&self, surface: HttpStateSurface) -> Self {
Self {
store: self.store.clone(),
surface: Arc::new(RwLock::new(surface)),
}
}
pub fn get_for_surface(&self, surface: HttpStateSurface) -> io::Result<Option<String>> {
self.store.get(surface)
}