dsh-memu-memory 1.4.3 → 1.4.5
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.
- package/AGENTS.md +3 -1
- package/CHANGELOG.md +15 -0
- package/README.md +34 -15
- package/README.zh.md +35 -13
- package/assets/screenshots/drawer.jpg +0 -0
- package/assets/screenshots/libraries.jpg +0 -0
- package/assets/screenshots/mobile.jpg +0 -0
- package/assets/screenshots/relations.jpg +0 -0
- package/assets/screenshots/settings.jpg +0 -0
- package/assets/screenshots/webui-dark.jpg +0 -0
- package/assets/screenshots/webui-memory.jpg +0 -0
- package/docs/client-conventions.md +19 -3
- package/docs/contributing.md +4 -2
- package/docs/env-and-commands.md +9 -1
- package/docs/graph-scale.md +214 -0
- package/docs/lexicon-recall.md +100 -0
- package/docs/mcp-porting.md +8 -6
- package/docs/memory-semantics.md +35 -3
- package/docs/pending-work.md +3 -1
- package/docs/retention.md +83 -0
- package/docs/rt-index.md +452 -0
- package/docs/scale-performance.md +101 -0
- package/docs/token-budget.md +92 -0
- package/docs/troubleshooting.md +50 -11
- package/lib/auto-link/apply.js +7 -2
- package/lib/auto-link/candidates.js +32 -10
- package/lib/backup.js +67 -32
- package/lib/binding-diagnostics.js +1 -1
- package/lib/bounded-cache.js +80 -0
- package/lib/client.js +2096 -409
- package/lib/consolidation-ledger.js +21 -4
- package/lib/consolidation-worker.js +14 -1
- package/lib/cycle.js +16 -11
- package/lib/diagnostic-context.js +372 -0
- package/lib/diagnostics.js +147 -61
- package/lib/embedding-download.js +7 -8
- package/lib/engine-sources.js +286 -0
- package/lib/engine.js +23 -10
- package/lib/entity-repair.js +43 -13
- package/lib/entity-review.js +64 -0
- package/lib/environment-check.js +348 -36
- package/lib/feedback.js +25 -0
- package/lib/global-graph.js +46 -2
- package/lib/graph-adjacency-index.js +525 -0
- package/lib/graph-overview.js +293 -0
- package/lib/graph.js +658 -105
- package/lib/inbound.js +44 -15
- package/lib/index-pages.js +57 -0
- package/lib/index.js +44 -6
- package/lib/inject.js +119 -50
- package/lib/lexicon-rt-source.js +25 -0
- package/lib/lexicon-rt-worker.js +26 -0
- package/lib/lexicon-rt.js +224 -0
- package/lib/lexicon-scope.js +56 -5
- package/lib/lexicon.js +143 -54
- package/lib/local-vector-service.js +3 -0
- package/lib/maintenance-ledger.js +542 -12
- package/lib/managed-runtime.js +260 -80
- package/lib/media.js +1 -1
- package/lib/memory.js +564 -131
- package/lib/port-surface.js +96 -11
- package/lib/preset-mount.js +13 -7
- package/lib/private.js +47 -21
- package/lib/recall-cache.js +20 -34
- package/lib/retention.js +173 -0
- package/lib/rpc.js +135 -52
- package/lib/rt-index/builder.js +209 -0
- package/lib/rt-index/format.js +231 -0
- package/lib/rt-index/manifest.js +105 -0
- package/lib/rt-index/reader.js +673 -0
- package/lib/rt-index-retention.js +151 -0
- package/lib/rt-index-service.js +283 -0
- package/lib/rt-index-worker.js +21 -0
- package/lib/salient-wake.js +55 -4
- package/lib/state.js +195 -24
- package/lib/temporal.js +39 -13
- package/lib/token-measurement.js +126 -0
- package/lib/tools.js +101 -6
- package/lib/turn-log.js +108 -3
- package/lib/webui/graph-layout-worker.js +68 -0
- package/lib/webui/graph-local-physics.js +390 -0
- package/lib/webui/graph-spatial-grid.js +64 -0
- package/lib/webui/graph-view.bundle.js +6 -1
- package/lib/webui/graph-view.js +478 -135
- package/lib/webui/graph-webgl-renderer.js +74 -0
- package/lib/webui/standalone.js +1 -1
- package/lib/worker-pool.js +38 -7
- package/package.json +3 -2
- package/scripts/acceptance-local.mjs +4 -10
- package/scripts/bench-all-libraries.mjs +47 -0
- package/scripts/check-classic-graph-browser.mjs +189 -0
- package/scripts/check-client-browser.mjs +929 -0
- package/scripts/check-graph-browser.mjs +6 -0
- package/scripts/check-graph-elastic-browser.mjs +139 -0
- package/scripts/check-memory-review-browser.mjs +124 -0
- package/scripts/entity-dedupe.mjs +19 -3
- package/scripts/graph-artifact-provenance.mjs +30 -0
- package/scripts/graph-freeze-manifest.mjs +129 -0
- package/scripts/graph-geometry-fixture.mjs +40 -0
- package/scripts/graph-physics-bench.mjs +218 -0
- package/scripts/graph-scale-bench.mjs +213 -0
- package/scripts/graph-scale-memory.mjs +48 -0
- package/scripts/graph-service-bench.mjs +72 -0
- package/scripts/make-readme-shots.mjs +17 -5
- package/scripts/preview.mjs +1 -0
- package/scripts/rebuild-rt.mjs +18 -0
- package/scripts/scale-bench.mjs +183 -0
- package/scripts/simulate-injection.mjs +47 -8
- package/scripts/verify-host-fixtures.mjs +108 -0
- package/scripts/verify-host-recovery.mjs +565 -0
- package/scripts/verify-vector-recovery.mjs +740 -0
- package/tests/auto-link-candidates.test.mjs +20 -0
- package/tests/browser.test.mjs +16 -2
- package/tests/client-export.test.mjs +16 -1
- package/tests/client-pagination.test.mjs +1495 -0
- package/tests/client-render.test.mjs +223 -28
- package/tests/consolidation-fork.test.mjs +97 -13
- package/tests/consolidation-ledger.test.mjs +17 -1
- package/tests/diagnostic-entity-candidates.test.mjs +54 -0
- package/tests/diagnostic-report.test.mjs +429 -0
- package/tests/diagnostic-wiring.test.mjs +88 -0
- package/tests/diagnostics.test.mjs +27 -0
- package/tests/embedding-download.test.mjs +44 -0
- package/tests/engine-source-settings.test.mjs +69 -0
- package/tests/engine-sources.test.mjs +145 -0
- package/tests/entity-dedupe.test.mjs +143 -0
- package/tests/entity-merge-review.test.mjs +363 -0
- package/tests/entity-merge.test.mjs +12 -4
- package/tests/entity-review.test.mjs +87 -0
- package/tests/environment-check.test.mjs +51 -1
- package/tests/feedback.test.mjs +95 -0
- package/tests/graph-adjacency-index.test.mjs +536 -0
- package/tests/graph-cascade.test.mjs +229 -0
- package/tests/graph-import-diagnostic.test.mjs +25 -0
- package/tests/graph-overview.test.mjs +709 -0
- package/tests/graph-session-authorization.test.mjs +419 -0
- package/tests/graph-view-geometry.test.mjs +426 -0
- package/tests/graph-view-scale.test.mjs +88 -0
- package/tests/graph-view.test.mjs +444 -5
- package/tests/graph.test.mjs +43 -0
- package/tests/help-page.test.mjs +128 -54
- package/tests/inbound.test.mjs +19 -0
- package/tests/index-pagination.test.mjs +113 -0
- package/tests/index-read-view.test.mjs +212 -0
- package/tests/inject-guide.test.mjs +9 -0
- package/tests/injection-dedupe.test.mjs +213 -0
- package/tests/lexicon-recall.test.mjs +641 -0
- package/tests/lexicon-rt-lifecycle.test.mjs +196 -0
- package/tests/lexicon-rt.test.mjs +468 -0
- package/tests/local-embedding-worker.test.mjs +38 -0
- package/tests/local-vector-service.test.mjs +32 -3
- package/tests/maintenance-compat.test.mjs +128 -0
- package/tests/maintenance-settlement.test.mjs +1003 -0
- package/tests/managed-memory.test.mjs +39 -11
- package/tests/managed-runtime.test.mjs +109 -0
- package/tests/memory-fields.test.mjs +24 -12
- package/tests/observed-evidence.test.mjs +52 -0
- package/tests/port-surface.test.mjs +93 -1
- package/tests/preset-mount.test.mjs +12 -4
- package/tests/recall-cache.test.mjs +56 -3
- package/tests/recall-dedup.test.mjs +63 -2
- package/tests/retention.test.mjs +260 -0
- package/tests/rt-index-cross-library.test.mjs +230 -0
- package/tests/rt-index-integration.test.mjs +194 -0
- package/tests/rt-index-retention.test.mjs +552 -0
- package/tests/rt-index-scale.test.mjs +204 -0
- package/tests/rt-index.test.mjs +705 -0
- package/tests/salient-date-boundaries.test.mjs +121 -0
- package/tests/salient-wake.test.mjs +29 -0
- package/tests/scale-bench.test.mjs +53 -0
- package/tests/settings-plumbing.test.mjs +25 -0
- package/tests/simulate-injection.test.mjs +15 -1
- package/tests/standalone-navigation.test.mjs +44 -0
- package/tests/state.test.mjs +51 -0
- package/tests/temporal-precision.test.mjs +102 -0
- package/tests/temporal.test.mjs +10 -6
- package/tests/token-measurement.test.mjs +98 -0
- package/tests/tool-schema.test.mjs +41 -5
- package/tests/tools.test.mjs +6 -3
- package/tests/turn-token-budget.test.mjs +149 -0
- package/tests/webui-auth.test.mjs +57 -1
- package/tests/webui.test.mjs +40 -15
- package/tests/worker-lifecycle.test.mjs +2 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import test from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import fs from 'node:fs'
|
|
4
|
+
import os from 'node:os'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
|
|
7
|
+
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'dsh-rt-integration-'))
|
|
8
|
+
process.env.DSH_MEMU_HOME = home
|
|
9
|
+
process.env.DSH_MEMU_MEMORY_HOME = home
|
|
10
|
+
process.env.DSH_MEMU_RT_MIN_ENTRIES = '1'
|
|
11
|
+
process.env.DSH_MEMU_RT_INDEX = 'on'
|
|
12
|
+
const state = await import('../lib/state.js')
|
|
13
|
+
const paths = await import('../lib/paths.js')
|
|
14
|
+
const memory = await import('../lib/memory.js')
|
|
15
|
+
const { buildCorpus, bm25, tokenize } = await import('../lib/text-retrieval.js')
|
|
16
|
+
const service = await import('../lib/rt-index-service.js')
|
|
17
|
+
const warnings = []
|
|
18
|
+
paths.setWarnSink(message => warnings.push(message))
|
|
19
|
+
state.updateSettings({ memoryBackend: 'agent', autoLinkMode: 'off', relevanceThreshold: 0 })
|
|
20
|
+
test.after(async () => {
|
|
21
|
+
await service.closeRtIndexService()
|
|
22
|
+
state.flushState()
|
|
23
|
+
fs.rmSync(home, { recursive: true, force: true })
|
|
24
|
+
})
|
|
25
|
+
let serial = 0
|
|
26
|
+
function fixture(extra = {}) {
|
|
27
|
+
const cwd = path.join(home, 'workspace-' + serial++)
|
|
28
|
+
const library = state.createLibrary({ name: 'rt integration', cwd })
|
|
29
|
+
const sessionId = 'rt-session-' + serial
|
|
30
|
+
state.ensureSession(sessionId, { cwd, libraryId: library.id })
|
|
31
|
+
state.setSessionBinding(sessionId, { memoryContext: { characterId: 'alice' } })
|
|
32
|
+
const at = new Date().toISOString()
|
|
33
|
+
const entry = (title, content, additions = {}) => ({ title, content, status: 'active', layer: 'long_term', strength: 1,
|
|
34
|
+
visibility: 'shared', createdAt: at, updatedAt: at, ...additions })
|
|
35
|
+
const entries = {
|
|
36
|
+
'mem-rt-harbor': entry('harbor deployment', 'harbor release uses blue quartz validation and operator checklist'),
|
|
37
|
+
'mem-rt-citrus': entry('citrus recipe', 'sweet citrus salad uses fresh cucumber and garden herbs'),
|
|
38
|
+
'mem-rt-secret': entry('harbor secret', 'private hidden harbor', { visibility: 'secret' }),
|
|
39
|
+
'mem-rt-bob': entry('harbor other character', 'hidden bob harbor', { context: { characterId: 'bob' } }),
|
|
40
|
+
'mem-rt-date': entry('telescope appointment', 'the observatory appointment is reserved', { absolute_date: '2026-12-04' }),
|
|
41
|
+
...extra,
|
|
42
|
+
}
|
|
43
|
+
state.savePrivateIndex(library.id, { version: 1, entries })
|
|
44
|
+
assert.equal(service.rebuildRt(library.id).ok, true)
|
|
45
|
+
const exec = { agent: { session: { header: { id: sessionId } } } }
|
|
46
|
+
return { library, sessionId, exec }
|
|
47
|
+
}
|
|
48
|
+
const ids = result => result.files.map(file => file.name)
|
|
49
|
+
const recall = (fixture, query = 'harbor') => memory.privateRecall({ exec: fixture.exec, query, purpose: 'automatic', topK: 5, relevanceThreshold: 0 })
|
|
50
|
+
|
|
51
|
+
test('published postings preserve actual recalled ids, ranking, dates and private eligibility', async () => {
|
|
52
|
+
const f = fixture()
|
|
53
|
+
const index = state.readPrivateIndex(f.library.id)
|
|
54
|
+
assert.equal(service.rtSource(index), service.rtSource(index), 'stable admitted source must not invalidate a warm query view')
|
|
55
|
+
process.env.DSH_MEMU_RT_INDEX = 'off'
|
|
56
|
+
const source = await recall(f)
|
|
57
|
+
process.env.DSH_MEMU_RT_INDEX = 'on'
|
|
58
|
+
const indexed = await recall(f)
|
|
59
|
+
assert.deepEqual(ids(indexed), ids(source))
|
|
60
|
+
assert.deepEqual(ids(indexed), ['mem-rt-harbor'])
|
|
61
|
+
assert.equal(indexed.files[0].lexical, source.files[0].lexical)
|
|
62
|
+
const date = await recall(f, '2026-12-04')
|
|
63
|
+
assert.ok(ids(date).includes('mem-rt-date'))
|
|
64
|
+
state.setSessionBinding(f.sessionId, { memoryContext: { characterId: 'bob' } })
|
|
65
|
+
assert.ok(ids(await recall(f)).includes('mem-rt-bob'))
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('large source fallback streams query statistics with exact BM25, date and shadow parity', async () => {
|
|
69
|
+
const extra = {}
|
|
70
|
+
const at = new Date().toISOString()
|
|
71
|
+
for (let i = 0; i < 2050; i++) extra['mem-stream-' + i] = {
|
|
72
|
+
title: 'background record ' + i, content: 'ordinary archive filler ' + i + (i % 31 ? ' 花园约定' : ' 星光计划'),
|
|
73
|
+
status: 'active', layer: 'long_term', visibility: 'shared', createdAt: at, updatedAt: at,
|
|
74
|
+
}
|
|
75
|
+
const f = fixture(extra)
|
|
76
|
+
const index = state.readPrivateIndex(f.library.id)
|
|
77
|
+
const documents = Object.entries(index.entries).filter(([id]) => !['mem-rt-secret', 'mem-rt-bob'].includes(id))
|
|
78
|
+
.map(([id, entry]) => ({ id, title: entry.title, content: entry.content }))
|
|
79
|
+
const corpus = buildCorpus(documents)
|
|
80
|
+
const expected = bm25(tokenize('harbor quartz'), corpus.docs.get('mem-rt-harbor'), corpus)
|
|
81
|
+
const initialCache = memory.lexicalCacheStats().bytes
|
|
82
|
+
const snapshots = []
|
|
83
|
+
try {
|
|
84
|
+
for (const mode of ['off', 'shadow', 'on']) {
|
|
85
|
+
process.env.DSH_MEMU_RT_INDEX = mode
|
|
86
|
+
const text = await recall(f, 'harbor quartz')
|
|
87
|
+
assert.deepEqual(ids(text), ['mem-rt-harbor'])
|
|
88
|
+
assert.equal(text.files[0].lexical, expected, `${mode} must retain the independent source BM25 formula`)
|
|
89
|
+
assert.ok(!text.errors?.some(error => error.includes('MISMATCH')))
|
|
90
|
+
const date = await recall(f, 'harbor quartz 2026-12-04')
|
|
91
|
+
assert.ok(ids(date).includes('mem-rt-date'))
|
|
92
|
+
snapshots.push(date.files.map(file => [file.name, file.lexical, file.lexicalEvidence]))
|
|
93
|
+
}
|
|
94
|
+
assert.deepEqual(snapshots[0], snapshots[1])
|
|
95
|
+
assert.deepEqual(snapshots[0], snapshots[2])
|
|
96
|
+
assert.equal(memory.lexicalCacheStats().bytes, initialCache, 'large oracle does not retain a second whole corpus')
|
|
97
|
+
} finally { process.env.DSH_MEMU_RT_INDEX = 'on' }
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('deletion and same-size corruption of rt files fall back with ids and visible diagnostic', async () => {
|
|
101
|
+
const f = fixture()
|
|
102
|
+
await recall(f)
|
|
103
|
+
const root = service.indexLocation({ directory: service.rtDirectory(), libraryId: f.library.id }).root
|
|
104
|
+
const pointer = JSON.parse(fs.readFileSync(path.join(root, 'current.json'), 'utf8'))
|
|
105
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, pointer.generation, 'manifest.json'), 'utf8'))
|
|
106
|
+
const postings = path.join(root, 'segments', manifest.segments[0].id, 'postings.bin')
|
|
107
|
+
const bytes = fs.readFileSync(postings)
|
|
108
|
+
bytes[bytes.length - 1] ^= 1
|
|
109
|
+
fs.writeFileSync(postings, bytes)
|
|
110
|
+
const corrupt = await recall(f)
|
|
111
|
+
assert.ok(ids(corrupt).includes('mem-rt-harbor'))
|
|
112
|
+
assert.ok(corrupt.errors?.some(error => error.includes('RT_')))
|
|
113
|
+
assert.match(state.getSessionBinding(f.sessionId).lastRecallError, /RT_/)
|
|
114
|
+
assert.ok(warnings.some(message => message.includes('derived recall')))
|
|
115
|
+
// This path was resolved under this test's own newly-created home.
|
|
116
|
+
assert.ok(root.startsWith(path.resolve(home) + path.sep))
|
|
117
|
+
fs.rmSync(root, { recursive: true, force: true })
|
|
118
|
+
assert.ok(ids(await recall(f)).includes('mem-rt-harbor'))
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
test('committed writes update postings and exact body reads without reusing stale views', async () => {
|
|
122
|
+
const f = fixture()
|
|
123
|
+
await recall(f)
|
|
124
|
+
state.updatePrivateIndex(f.library.id, index => {
|
|
125
|
+
index.entries['mem-rt-harbor'].content = 'A violet observatory prism is recorded. Unicode: \u{1F31F}.'
|
|
126
|
+
index.entries['mem-rt-harbor'].title = 'violet prism'
|
|
127
|
+
delete index.entries['mem-rt-citrus']
|
|
128
|
+
})
|
|
129
|
+
const updated = await recall(f, 'violet prism')
|
|
130
|
+
assert.ok(ids(updated).includes('mem-rt-harbor'))
|
|
131
|
+
assert.ok(!ids(await recall(f, 'citrus')).includes('mem-rt-citrus'))
|
|
132
|
+
const body = memory.readMemoryByRef({ exec: f.exec, id: 'mem-rt-harbor', limitChars: 8000 })
|
|
133
|
+
assert.equal(body.body, 'A violet observatory prism is recorded. Unicode: \u{1F31F}.')
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('shadow mode keeps source results and records score/order comparison', async () => {
|
|
137
|
+
const f = fixture()
|
|
138
|
+
const before = service.rtServiceDiagnostics()
|
|
139
|
+
process.env.DSH_MEMU_RT_INDEX = 'shadow'
|
|
140
|
+
assert.deepEqual(ids(await recall(f)), ['mem-rt-harbor'])
|
|
141
|
+
const after = service.rtServiceDiagnostics()
|
|
142
|
+
assert.equal(after.shadowQueries, before.shadowQueries + 1)
|
|
143
|
+
assert.equal(after.shadowMismatches, before.shadowMismatches)
|
|
144
|
+
const body = memory.readMemoryByRef({ exec: f.exec, id: 'mem-rt-harbor', limitChars: 8000 })
|
|
145
|
+
assert.equal(body.body, state.readPrivateIndex(f.library.id).entries['mem-rt-harbor'].content)
|
|
146
|
+
assert.equal(service.rtServiceDiagnostics().shadowBodies, before.shadowBodies + 1)
|
|
147
|
+
process.env.DSH_MEMU_RT_INDEX = 'on'
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
test('missing derived files rebuild in an isolated worker after source fallback', async () => {
|
|
151
|
+
const f = fixture()
|
|
152
|
+
const root = service.indexLocation({ directory: service.rtDirectory(), libraryId: f.library.id }).root
|
|
153
|
+
assert.ok(root.startsWith(path.resolve(home) + path.sep))
|
|
154
|
+
fs.rmSync(root, { recursive: true, force: true })
|
|
155
|
+
const before = service.rtServiceDiagnostics().builds
|
|
156
|
+
assert.deepEqual(ids(await recall(f)), ['mem-rt-harbor'])
|
|
157
|
+
const deadline = Date.now() + 20000
|
|
158
|
+
while (Date.now() < deadline && !fs.existsSync(path.join(root, 'current.json'))) {
|
|
159
|
+
await new Promise(resolve => setTimeout(resolve, 30))
|
|
160
|
+
}
|
|
161
|
+
assert.ok(fs.existsSync(path.join(root, 'current.json')), 'background rebuild published a pointer')
|
|
162
|
+
while (Date.now() < deadline && service.rtServiceDiagnostics().builds <= before) {
|
|
163
|
+
await new Promise(resolve => setTimeout(resolve, 30))
|
|
164
|
+
}
|
|
165
|
+
assert.ok(service.rtServiceDiagnostics().builds > before)
|
|
166
|
+
assert.deepEqual(ids(await recall(f)), ['mem-rt-harbor'])
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
test('a shadow-only body mismatch returns canonical text and reports a numeric diagnostic', () => {
|
|
170
|
+
const f = fixture()
|
|
171
|
+
process.env.DSH_MEMU_RT_INDEX = 'shadow'
|
|
172
|
+
const index = state.readPrivateIndex(f.library.id)
|
|
173
|
+
const context = service.getRtQueryView({ index, libraryId: f.library.id, cacheKey: 'shadow-body-audit', isVisible: () => true })
|
|
174
|
+
const original = context.controller.readBody
|
|
175
|
+
const before = service.rtServiceDiagnostics()
|
|
176
|
+
context.controller.readBody = () => ({ body: 'incorrect derived-only text', backend: 'rt', fallback: null })
|
|
177
|
+
try {
|
|
178
|
+
assert.equal(memory.readMemoryByRef({ exec: f.exec, id: 'mem-rt-harbor' }).body, index.entries['mem-rt-harbor'].content)
|
|
179
|
+
assert.equal(service.rtServiceDiagnostics().shadowBodyMismatches, before.shadowBodyMismatches + 1)
|
|
180
|
+
assert.ok(warnings.some(message => message.includes('RT_SHADOW_BODY_MISMATCH')))
|
|
181
|
+
} finally {
|
|
182
|
+
context.controller.readBody = original
|
|
183
|
+
process.env.DSH_MEMU_RT_INDEX = 'on'
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
test('a derived hook failure cannot turn a committed authoritative write into failure', () => {
|
|
188
|
+
const f = fixture()
|
|
189
|
+
const off = state.onIndexCommit(() => { throw new Error('derived sidecar unavailable') })
|
|
190
|
+
try {
|
|
191
|
+
state.updatePrivateIndex(f.library.id, index => { index.entries['mem-rt-harbor'].title = 'safe committed title' })
|
|
192
|
+
assert.equal(state.readPrivateIndex(f.library.id).entries['mem-rt-harbor'].title, 'safe committed title')
|
|
193
|
+
} finally { off() }
|
|
194
|
+
})
|