aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-world-model.js
diff options
context:
space:
mode:
authorAgando <roduccomm@gmail.com>2026-10-23 21:35:02 +0200
committerAgando <roduccomm@gmail.com>2026-10-23 21:35:02 +0200
commit6af7c8ddfbd1d18a0d10cecd9c5d5eb398749570 (patch)
tree03b2643e373217dbf08d16850bd1b7ad2047ac16 /modules/core/module-world-model.js
parentfcee056449e500941ea1ee00db66b0fd7d9d3f44 (diff)
fix(newos4): the virtual /sys entry leaked into listings, trees and counts (v4.6.88-90)
One phantom entry, three symptoms: - ls() injected 'sys' whenever it was called without a path, so 'cd _agents; ls' advertised a sys directory that does not exist, and list_files('_agents/sys') answered 'Directory not found' — the reported false negative. Injection is now gated on dir === root. - tree() pushed the same virtual name into the walk and dereferenced it, throwing mid-output on every root listing. Guarded. - _gatherFileInfo() walked into /sys and counted a synthetic subtree: 146 files / 114 dirs for a 44-file / 15-dir store. Virtual entries are skipped. Verified: root still lists sys; _agents and skills do not; tree('') completes; world model total (44) equals an independent walk of fs.root (44), agree: true.
Diffstat (limited to 'modules/core/module-world-model.js')
-rw-r--r--modules/core/module-world-model.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/core/module-world-model.js b/modules/core/module-world-model.js
index 54a17e4..6e8f3c3 100644
--- a/modules/core/module-world-model.js
+++ b/modules/core/module-world-model.js
@@ -203,6 +203,11 @@ class WorldModelModule {
const entries = fs.ls(path);
if (!entries) return;
for (const e of entries) {
+ // /sys is synthesized by ls() on demand and has no node behind it. Walking into it
+ // counted a synthetic subtree (114 dirs / 146 files in a store that holds 43 files),
+ // which is the "the counts disagree" report: two different populations were both
+ // printed as "files".
+ if (e._virtual) continue;
if (e.type === 'file') fileCount++;
else { dirCount++; walk(path === '/' ? '/' + e.name : path + '/' + e.name); }
}