mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:19:04 +00:00
Revert thread recencyAt for sidebar ordering (#28655)
## Why Revert #27910 to remove the newly introduced thread `recencyAt` persistence and API behavior from `main`. ## What changed This reverts commit `fac3158c2a783095768076489815f361fa9b0db4`, including the state migration, thread-store propagation, app-server API surface, generated schemas, and related tests. ## Validation Not run before opening; relying on CI for the initial fast signal.
This commit is contained in:
1 parent
0a3ad4c4ba
commit
cb15c64760
67 files changed
+95
-1150
No files matched your search
@@ -1,129 +0,0 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use sqlx::Row;
|
||||
use sqlx::migrate::Migrator;
|
||||
use sqlx::sqlite::SqlitePoolOptions;
|
||||
|
||||
use super::STATE_MIGRATOR;
|
||||
|
||||
fn migrator_through(version: i64) -> Migrator {
|
||||
Migrator {
|
||||
migrations: Cow::Owned(
|
||||
STATE_MIGRATOR
|
||||
.migrations
|
||||
.iter()
|
||||
.filter(|migration| migration.version <= version)
|
||||
.cloned()
|
||||
.collect(),
|
||||
),
|
||||
ignore_missing: STATE_MIGRATOR.ignore_missing,
|
||||
locking: STATE_MIGRATOR.locking,
|
||||
table_name: STATE_MIGRATOR.table_name.clone(),
|
||||
create_schemas: STATE_MIGRATOR.create_schemas.clone(),
|
||||
no_tx: STATE_MIGRATOR.no_tx,
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn recency_migration_backfills_and_seeds_old_binary_inserts() {
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(1)
|
||||
.connect("sqlite::memory:")
|
||||
.await
|
||||
.expect("in-memory database should open");
|
||||
migrator_through(/*version*/ 37)
|
||||
.run(&pool)
|
||||
.await
|
||||
.expect("pre-recency migrations should apply");
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO threads (
|
||||
id,
|
||||
rollout_path,
|
||||
created_at,
|
||||
updated_at,
|
||||
created_at_ms,
|
||||
updated_at_ms,
|
||||
source,
|
||||
model_provider,
|
||||
cwd,
|
||||
title,
|
||||
sandbox_policy,
|
||||
approval_mode
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"#,
|
||||
)
|
||||
.bind("00000000-0000-0000-0000-000000000001")
|
||||
.bind("/tmp/first.jsonl")
|
||||
.bind(1_700_000_000_i64)
|
||||
.bind(1_700_000_100_i64)
|
||||
.bind(1_700_000_000_123_i64)
|
||||
.bind(1_700_000_100_456_i64)
|
||||
.bind("cli")
|
||||
.bind("openai")
|
||||
.bind("/tmp")
|
||||
.bind("")
|
||||
.bind("read-only")
|
||||
.bind("on-request")
|
||||
.execute(&pool)
|
||||
.await
|
||||
.expect("legacy row should insert");
|
||||
|
||||
STATE_MIGRATOR
|
||||
.run(&pool)
|
||||
.await
|
||||
.expect("recency migration should apply");
|
||||
|
||||
let backfilled = sqlx::query(
|
||||
"SELECT updated_at, updated_at_ms, recency_at, recency_at_ms FROM threads WHERE id = ?",
|
||||
)
|
||||
.bind("00000000-0000-0000-0000-000000000001")
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.expect("backfilled row should load");
|
||||
assert_eq!(backfilled.get::<i64, _>("recency_at"), 1_700_000_100);
|
||||
assert_eq!(backfilled.get::<i64, _>("recency_at_ms"), 1_700_000_100_456);
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT INTO threads (
|
||||
id,
|
||||
rollout_path,
|
||||
created_at,
|
||||
updated_at,
|
||||
created_at_ms,
|
||||
updated_at_ms,
|
||||
source,
|
||||
model_provider,
|
||||
cwd,
|
||||
title,
|
||||
sandbox_policy,
|
||||
approval_mode
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"#,
|
||||
)
|
||||
.bind("00000000-0000-0000-0000-000000000002")
|
||||
.bind("/tmp/second.jsonl")
|
||||
.bind(1_700_000_200_i64)
|
||||
.bind(1_700_000_300_i64)
|
||||
.bind(1_700_000_200_123_i64)
|
||||
.bind(1_700_000_300_456_i64)
|
||||
.bind("cli")
|
||||
.bind("openai")
|
||||
.bind("/tmp")
|
||||
.bind("")
|
||||
.bind("read-only")
|
||||
.bind("on-request")
|
||||
.execute(&pool)
|
||||
.await
|
||||
.expect("old-binary row should insert");
|
||||
|
||||
let seeded = sqlx::query("SELECT recency_at, recency_at_ms FROM threads WHERE id = ?")
|
||||
.bind("00000000-0000-0000-0000-000000000002")
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.expect("old-binary row should load");
|
||||
assert_eq!(seeded.get::<i64, _>("recency_at"), 1_700_000_300);
|
||||
assert_eq!(seeded.get::<i64, _>("recency_at_ms"), 1_700_000_300_456);
|
||||
}
|
||||
Reference in new issue
Block a user