Skip to content

Commit f4feb11

Browse files
committed
fix(ipc): ensure JSON timestamp always checked in cleanupIpcStubs
The previous logic only checked JSON timestamp when mtime indicated the file wasn't stale, causing CI failures when filesystem mtime was unreliable. Now always checks both indicators with OR logic.
1 parent 53bbd3f commit f4feb11

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/ipc.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -378,19 +378,19 @@ export async function cleanupIpcStubs(appName: string): Promise<void> {
378378
// Check both filesystem mtime and JSON timestamp for more reliable detection
379379
const stats = await fs.stat(filePath)
380380
const mtimeAge = now - stats.mtimeMs
381-
382-
// Also check the timestamp inside the JSON file for accuracy
383381
let isStale = mtimeAge > maxAgeMs
384-
if (!isStale) {
385-
try {
386-
const content = await fs.readFile(filePath, 'utf8')
387-
const parsed = JSON.parse(content)
388-
const validated = IpcStubSchema.parse(parsed)
389-
const contentAge = now - validated.timestamp
390-
isStale = contentAge > maxAgeMs
391-
} catch {
392-
// If we can't read/parse the file, rely on mtime
393-
}
382+
383+
// Always check the timestamp inside the JSON file for accuracy
384+
// This is more reliable than filesystem mtime in some environments
385+
try {
386+
const content = await fs.readFile(filePath, 'utf8')
387+
const parsed = JSON.parse(content)
388+
const validated = IpcStubSchema.parse(parsed)
389+
const contentAge = now - validated.timestamp
390+
// File is stale if EITHER check indicates staleness
391+
isStale = isStale || contentAge > maxAgeMs
392+
} catch {
393+
// If we can't read/parse the file, rely on mtime check
394394
}
395395

396396
if (isStale) {

0 commit comments

Comments
 (0)