Skip to content

Commit 7f5f35b

Browse files
byapparovclaude
andcommitted
test: address #222 review: tie-break comment, pid guard, test title
- message-v2.ts: say that desc(id) breaks ties newest first. - preload.ts: only probe positive pids; kill(0) and kill(-1) probe process groups, and no run of ours makes such a directory name. - message-stream-order.test.ts: the title says newest first, as the assertion checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015nwvfUHdM3bgMgD9Zpz7Mj
1 parent e086c99 commit 7f5f35b

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎packages/cli/src/session/message-v2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ export namespace MessageV2 {
747747
.select()
748748
.from(MessageTable)
749749
.where(eq(MessageTable.session_id, sessionID))
750-
// Messages often share a millisecond; ascending IDs keep their creation order.
750+
// Messages often share a millisecond. IDs ascend with creation, so desc(id) breaks ties newest first.
751751
.orderBy(desc(MessageTable.time_created), desc(MessageTable.id))
752752
.limit(size)
753753
.offset(offset)

‎packages/cli/test/preload.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function running(pid: number) {
2323
}
2424
const stale = (await fs.readdir(os.tmpdir())).filter((name) => {
2525
const pid = Number(name.slice(DATA_PREFIX.length))
26-
return name.startsWith(DATA_PREFIX) && Number.isInteger(pid) && pid !== process.pid && !running(pid)
26+
return name.startsWith(DATA_PREFIX) && Number.isInteger(pid) && pid > 0 && pid !== process.pid && !running(pid)
2727
})
2828
// Best effort: a directory that cannot be removed now is retried by the next run.
2929
await Promise.all(

‎packages/cli/test/session/message-stream-order.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function summary(sessionID: string, parentID: string, created: number) {
4343
// quick succession, so they often share a millisecond. The stream must still
4444
// return them newest first, or filterCompacted misses the finished compaction
4545
// and the prompt loop runs it again.
46-
test("messages created in the same millisecond stream in creation order", async () => {
46+
test("messages created in the same millisecond stream newest first", async () => {
4747
await using tmp = await tmpdir()
4848
await Instance.provide({
4949
directory: tmp.path,

0 commit comments

Comments
 (0)