aboutsummaryrefslogtreecommitdiff
path: root/modules/test/test-memory-graph.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-11-02 21:15:28 +0100
committerAgando <roduccomm@gmail.com>2026-11-02 21:15:28 +0100
commit3b894c31c456592a21b36a7696423ad0936edab7 (patch)
tree3f23f9a313d351dff0740de90aef56a9cca4d8f9 /modules/test/test-memory-graph.js
parent35ca5324ca5a0b3e1e6f02663e1e44d6e06e50ba (diff)
fix(newos4): memory-graph loads stop rewriting user data; unknown sizes say unknown
Three follow-ups from the merge review, each with the assertion that pins it. module-memory-graph.js - _normalizeEdges no longer mutates stored weights. It capped legacy 'failed' edges from 0.8 to 0.2 in memory, and the next debounced save made that permanent - an irreversible migration of the user's graph with no schema version. The cap moved to _effectiveWeight(), which ranking (showStats "Strongest relationships"), the session view and prune() now use; the stored record is left exactly as written. - config.json is stamped version: 2 so a future format change can migrate deliberately. ext/webdav.js - the two fallback parsers emit size: null instead of 0. They cannot see the size column, and 0 rendered as "0 B" - the same "every file looks empty" symptom as the parseInt bug fixed in e639c2d, one regex miss away. - _formatSize(null) renders '—' (unknown) rather than '0 B'; 0 still renders '0 B'. module-aiassist.js - the lock timeout now says what to do: "AI is still busy with another turn (waited Ns). Wait for it to finish, or run 'ai-stop' and retry - the running turn's lock is left alone." It used to be a dead-end string. Tests: test-memory-graph 39 (T6.4 rewritten to the read-time contract: stored weight stays 0.8, effective 0.2, success unaffected), test-webdav-sizes 28 (A14d null -> '—'). maintain 26/26, live v4.6.141: _effectiveWeight 0.2 with the edge object unchanged, _formatSize(null) '—', '0 B' still '0 B'.
Diffstat (limited to 'modules/test/test-memory-graph.js')
-rw-r--r--modules/test/test-memory-graph.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/test/test-memory-graph.js b/modules/test/test-memory-graph.js
index d4fe37a..8c3bb6e 100644
--- a/modules/test/test-memory-graph.js
+++ b/modules/test/test-memory-graph.js
@@ -220,8 +220,15 @@ const sessionOf = d => 'session-session-' + Math.floor(new Date(d).getTime() / 8
mg2._edges.every(e => Array.isArray(e.source_agents) && typeof e.weight === 'number'),
JSON.stringify(mg2._edges));
const legFailed = mg2._edges.find(e => e.type === 'failed');
- ok('T6.4 a legacy 0.8 failure is capped below success on load',
- !!legFailed && legFailed.weight < 0.5, 'weight ' + (legFailed || {}).weight);
+ // The cap is applied at READ time, not by rewriting the store: a load must not mutate
+ // user data (the next debounced save would have made it permanent, silently).
+ ok('T6.4a a legacy 0.8 failure is NOT rewritten on load',
+ !!legFailed && legFailed.weight === 0.8, 'stored weight ' + (legFailed || {}).weight);
+ ok('T6.4b it ranks at 0.2 through _effectiveWeight',
+ !!legFailed && mg2._effectiveWeight(legFailed) === 0.2, 'effective ' + (legFailed && mg2._effectiveWeight(legFailed)));
+ ok('T6.4c a success edge keeps its own weight',
+ mg2._effectiveWeight({ type: 'used', weight: 0.5 }) === 0.5,
+ String(mg2._effectiveWeight({ type: 'used', weight: 0.5 })));
ok('T6.5 unrelated legacy weights are untouched',
(mg2._edges.find(e => e.type === 'executed') || {}).weight === 0.6,
String((mg2._edges.find(e => e.type === 'executed') || {}).weight));