You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(safeWriteJson): return SafeWriteResult with dataWritten for cache synchronization #1304
safeWriteJson currently returns Promise<void>. When a merge callback is provided, the caller has no way to know what was actually written to disk without re-reading the file or capturing the merge result via a closure (the current workaround in writeTaskFile).
Proposal
Change the return type to Promise<SafeWriteResult>:
dataWritten is the value passed to JSON.stringify after the merge callback runs. Callers can use it to update their in-memory cache without a closure side-effect or an extra read.
Why
Eliminates the closure-capture pattern in TaskHistoryStore.writeTaskFile (lines 885-893)
Enables future consumers of safeWriteJson to synchronize their cache without a workaround
Aligns with the broader goal of making the merge result a first-class return value
Scope
Update safeWriteJson signature and implementation
Update all call sites (TaskHistoryStore, migration, import)
Activity