feat: [ENG-2495] FileTaskHistoryStore: Delete + Clear API#561
feat: [ENG-2495] FileTaskHistoryStore: Delete + Clear API#561bao-byterover merged 1 commit intoproj/persis-task-historyfrom
Conversation
|
Claude finished @bao-byterover's task in 1m 57s —— View job PR Review: feat: [ENG-2495] FileTaskHistoryStore: Delete + Clear APITasks
SummaryScore: 4 / 5 Well-structured implementation that follows the existing two-tier index pattern cleanly. The tombstone-first + unlink design is sound, TDD is strictly followed with excellent test coverage for the new surface area, and the path-traversal guard is in the right place. A few correctness/consistency issues below. Issues
But Fix: check the index before reading the data file: async getById(taskId: string): Promise<TaskHistoryEntry | undefined> {
if (!TASK_ID_PATTERN.test(taskId)) return undefined
const dedup = await this.readIndexDedup()
const line = dedup.get(taskId)
if (line === undefined || '_deleted' in line) return undefined
// ...existing readFile logic
}
const live = valid.filter((id) => {
const line = dedup.get(id)
return line !== undefined && !('_deleted' in line)
})If
Add dedup before filtering: const unique = [...new Set(valid)]
const live = unique.filter(...)
await Promise.all(
taskIds.map((id) => rm(this.dataPath(id), {force: true}).catch(() => {})),
)
The comment in What's good
|
No description provided.