fix(platform): Phase 729 dual-heal gossip keys and HyperDB extract
Repair corrupted voice/stage/screen dual-heal mixins (wrong thread gossip keys and heal contexts). Regenerate 14 dual-heal legacy json mixins with per-entry keysField/initMethod; add json-export-gossip-registry alignment tables and platform-hyperdb-sync.js from index.js. Behavior unchanged; mesh dedupe now matches dedicated export mixins where aligned. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
'use strict'
|
||||
|
||||
/** HyperDB uint fields must be positive integers. */
|
||||
function coerceSyncUint (v, fallback = 0) {
|
||||
const n = Number(v)
|
||||
const fb = Math.max(1, Math.floor(Number(fallback) || 1))
|
||||
if (!Number.isFinite(n) || n <= 0) return fb
|
||||
return Math.floor(n)
|
||||
}
|
||||
|
||||
function sanitizeMessageForHyperDb (msg) {
|
||||
if (!msg || typeof msg !== 'object') return msg
|
||||
const row = { ...msg }
|
||||
row.createdAt = coerceSyncUint(row.createdAt, Date.now())
|
||||
if (row.editedAt != null && row.editedAt !== '') {
|
||||
const ed = Number(row.editedAt)
|
||||
row.editedAt =
|
||||
Number.isFinite(ed) && ed > 0 ? Math.floor(ed) : null
|
||||
}
|
||||
return row
|
||||
}
|
||||
|
||||
function sanitizeMemberForHyperDb (mem) {
|
||||
if (!mem || typeof mem !== 'object') return mem
|
||||
const row = { ...mem }
|
||||
row.joinedAt = coerceSyncUint(row.joinedAt, Date.now())
|
||||
if (row.updatedAt != null) row.updatedAt = coerceSyncUint(row.updatedAt, row.joinedAt)
|
||||
if (row.createdAt != null) row.createdAt = coerceSyncUint(row.createdAt, row.joinedAt)
|
||||
return row
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
coerceSyncUint,
|
||||
sanitizeMessageForHyperDb,
|
||||
sanitizeMemberForHyperDb
|
||||
}
|
||||
Reference in New Issue
Block a user