Fix log file sorting by using timestamp-first filename format
Some checks failed
CI / test (pull_request) Has been cancelled
Some checks failed
CI / test (pull_request) Has been cancelled
Filenames are now timestamp_sha.jsonl instead of sha_timestamp.jsonl. This makes alphabetical sort equal to chronological sort, eliminating fragile string parsing and ensuring commit SHAs are ordered by their most recent log file timestamp. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7408c02d64
commit
96aedc8239
|
|
@ -47,7 +47,7 @@ mkdirSync(logsDir, { recursive: true })
|
|||
|
||||
function createLogFile(): string {
|
||||
const timestamp = new Date().toISOString().replace(/[:.]/g, "-")
|
||||
return `${logsDir}/${releaseSha}_${timestamp}.jsonl`
|
||||
return `${logsDir}/${timestamp}_${releaseSha}.jsonl`
|
||||
}
|
||||
|
||||
export function listLogFiles(): string[] {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ function Sidebar({ files, selectedFile }: { files: string[]; selectedFile?: stri
|
|||
// Group files by sha, sorted by most recent file in each group
|
||||
const grouped: Record<string, string[]> = {}
|
||||
for (const file of files) {
|
||||
const sha = file.split("_")[0] || "unknown"
|
||||
const sha = file.replace(".jsonl", "").split("_").pop() || "unknown"
|
||||
const list = grouped[sha] || (grouped[sha] = [])
|
||||
list.push(file)
|
||||
}
|
||||
|
|
@ -130,8 +130,8 @@ function Sidebar({ files, selectedFile }: { files: string[]; selectedFile?: stri
|
|||
<div style="padding: 4px 16px; color: #6b7280; font-size: 11px; font-family: monospace">{sha}</div>
|
||||
{shaFiles.map((file) => {
|
||||
const isSelected = file === selectedFile
|
||||
// Parse ISO timestamp back from filename: sha_2026-03-10T02-56-59-938Z.jsonl
|
||||
const isoStr = file.replace(/^[^_]+_/, "").replace(".jsonl", "").replace(/T(\d{2})-(\d{2})-(\d{2})-(\d+)Z/, "T$1:$2:$3.$4Z")
|
||||
// Parse ISO timestamp back from filename: 2026-03-10T02-56-59-938Z_sha.jsonl
|
||||
const isoStr = file.replace(/_[^_]+\.jsonl$/, "").replace(/T(\d{2})-(\d{2})-(\d{2})-(\d+)Z/, "T$1:$2:$3.$4Z")
|
||||
const bg = isSelected ? "#2a2a2a" : "transparent"
|
||||
return (
|
||||
<a
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user