File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1777,8 +1777,11 @@ export function createStore(path) {
17771777 /** Scope 修正审计(单条记忆,新→旧)。审计回放与候选复核用。 */
17781778 function listScopeChanges ( memoryId , { limit = 50 } = { } ) {
17791779 const lim = Number . isInteger ( limit ) && limit > 0 ? Math . min ( limit , 200 ) : 50 ;
1780+ // tiebreaker 用 rowid(追加写入的单调序)而非 id:decided_at 只有毫秒精度,
1781+ // 连续两次修正落在同一毫秒时 UUID 排序是随机的(CI windows/node24 抓到的
1782+ // 真实 flake)——审计回放要求「最新一条」确定。
17801783 const rows = db . prepare (
1781- "SELECT * FROM scope_changes WHERE memory_id = ? ORDER BY decided_at DESC, id DESC LIMIT ?"
1784+ "SELECT * FROM scope_changes WHERE memory_id = ? ORDER BY decided_at DESC, rowid DESC LIMIT ?"
17821785 ) . all ( memoryId , lim ) ;
17831786 return rows . map ( toScopeChange ) ;
17841787 }
Original file line number Diff line number Diff line change @@ -1777,8 +1777,11 @@ export function createStore(path) {
17771777 /** Scope 修正审计(单条记忆,新→旧)。审计回放与候选复核用。 */
17781778 function listScopeChanges ( memoryId , { limit = 50 } = { } ) {
17791779 const lim = Number . isInteger ( limit ) && limit > 0 ? Math . min ( limit , 200 ) : 50 ;
1780+ // tiebreaker 用 rowid(追加写入的单调序)而非 id:decided_at 只有毫秒精度,
1781+ // 连续两次修正落在同一毫秒时 UUID 排序是随机的(CI windows/node24 抓到的
1782+ // 真实 flake)——审计回放要求「最新一条」确定。
17801783 const rows = db . prepare (
1781- "SELECT * FROM scope_changes WHERE memory_id = ? ORDER BY decided_at DESC, id DESC LIMIT ?"
1784+ "SELECT * FROM scope_changes WHERE memory_id = ? ORDER BY decided_at DESC, rowid DESC LIMIT ?"
17821785 ) . all ( memoryId , lim ) ;
17831786 return rows . map ( toScopeChange ) ;
17841787 }
You can’t perform that action at this time.
0 commit comments