fix(storage): derive the canonical count ledger from identity records, stamp the derivation rule, and mark legacy-derived ledgers suspect at load
This commit is contained in:
parent
204d74c161
commit
fd6b4ce4ff
4 changed files with 285 additions and 7 deletions
|
|
@ -1066,6 +1066,18 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
|
|||
protected allCountsSuspect = false
|
||||
/** One narration per session for the suspect transition (never per delete). */
|
||||
private allCountsSuspectNarrated = false
|
||||
/**
|
||||
* Which rule produced the ALL scalars currently in memory. `'identity-record'`
|
||||
* means one counted entity per metadata content leg — the honest rule: a
|
||||
* bare id-directory (a ghost or scar left by a partial-delete defect, no
|
||||
* content leg) counts zero. Set by the one-time derivation and by the
|
||||
* sanctioned recount, alongside `allCountsSuspect = false`; left `undefined`
|
||||
* when a loaded counts.json carries the ALL scalars but no stamp — the
|
||||
* legacy container-rule derivation, which forces `allCountsSuspect = true`
|
||||
* at load instead. A filesystem concern: `MemoryStorage` has no counts.json
|
||||
* and never sets this.
|
||||
*/
|
||||
protected allCountsDerivedBy?: 'identity-record'
|
||||
protected entityCounts: Map<string, number> = new Map() // type -> count
|
||||
protected verbCounts: Map<string, number> = new Map() // verb type -> count
|
||||
protected countCache: Map<string, { count: number; timestamp: number }> = new Map()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue