docs(goose): cite where Goose writes its UTC timestamps

Goose's session_manager.rs creates sessions with CURRENT_TIMESTAMP and
bumps updated_at with datetime('now'), both zoneless UTC text. The test
fixture now declares the same column defaults.
This commit is contained in:
Resham Joshi 2026-11-06 05:49:11 -08:00
parent bb390cba9c
commit fd8c228e36
2 changed files with 5 additions and 3 deletions

View file

@ -196,8 +196,9 @@ function createParser(source: SessionSource, seenKeys: Set<string>): SessionPars
const userMessage = getFirstUserMessage(db, sessionId)
const raw = session.updated_at || session.created_at || ''
// SQLite's CURRENT_TIMESTAMP text is UTC without a zone; Date reads
// that shape as local time.
// Goose writes these with SQLite CURRENT_TIMESTAMP / datetime('now')
// (crates/goose/src/session/session_manager.rs): UTC text with no zone,
// which Date would read as local time.
let ts = new Date(/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d+)?$/.test(raw) ? raw.replace(' ', 'T') + 'Z' : raw)
if (isNaN(ts.getTime())) ts = new Date()

View file

@ -38,7 +38,8 @@ sqliteDescribe('Goose timestamps', () => {
}
const db = new DatabaseSync(dbPath)
db.exec(`
CREATE TABLE sessions (id TEXT PRIMARY KEY, name TEXT, working_dir TEXT, created_at TIMESTAMP, updated_at TIMESTAMP,
CREATE TABLE sessions (id TEXT PRIMARY KEY, name TEXT, working_dir TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
accumulated_input_tokens INTEGER, accumulated_output_tokens INTEGER, provider_name TEXT, model_config_json TEXT);
CREATE TABLE messages (session_id TEXT, message_id TEXT, role TEXT, content_json TEXT, created_timestamp INTEGER);
INSERT INTO sessions VALUES ('s1', 't', '/w', '2026-10-01 23:30:00', '2026-10-01 23:30:00', 100, 20, 'openai', '{"model_name":"gpt-5.4"}');