soulbridge 0.0.109 → 0.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -930,14 +930,17 @@ export function openSqlite(file) {
|
|
|
930
930
|
return rows.map((row) => rowToFact(row, slots));
|
|
931
931
|
},
|
|
932
932
|
supersedeFact(oldId, newId) {
|
|
933
|
-
//
|
|
934
|
-
//
|
|
935
|
-
//
|
|
936
|
-
|
|
937
|
-
|
|
933
|
+
// A new claim ends the old one when the new claim became true — not when we happened to
|
|
934
|
+
// record it. "小林在 A 公司" ends at the layoff (10-24), not at the moment the layoff was
|
|
935
|
+
// mentioned. Falls back to the record time only when the successor has no validity start
|
|
936
|
+
// (an undated claim still replaces the old one now).
|
|
937
|
+
const successor = db
|
|
938
|
+
.prepare('SELECT created_at, valid_from FROM facts WHERE id = ?')
|
|
939
|
+
.get(newId);
|
|
940
|
+
const endedAt = Number(successor?.valid_from ?? successor?.created_at ?? Date.now());
|
|
938
941
|
withRetry(() => db
|
|
939
942
|
.prepare(`UPDATE facts SET status = '${FACT_STATUS.retracted}', superseded_by = ?, valid_until = ? WHERE id = ?`)
|
|
940
|
-
.run(newId,
|
|
943
|
+
.run(newId, endedAt, oldId));
|
|
941
944
|
},
|
|
942
945
|
/* ---------------- gaps ---------------- */
|
|
943
946
|
putGap(spec) {
|