Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

test(ledger): classify owned snapshot entries through directory records

haelyracc12310b6918
diff --git a/tests/docs/story-lifecycle-ledger.test.js b/tests/docs/story-lifecycle-ledger.test.js
index 63c6863c5..d541dc748 100644
--- a/tests/docs/story-lifecycle-ledger.test.js
+++ b/tests/docs/story-lifecycle-ledger.test.js
@@ -81,9 +81,11 @@ const storyFiles = (root) => fs.readdirSync(path.join(root, '.stories')).filter(
function snapshot(dir) {
if (!fs.existsSync(dir)) return null;
- return Object.fromEntries(fs.readdirSync(dir).sort().map((name) => {
+ return Object.fromEntries(fs.readdirSync(dir, { withFileTypes: true })
+ .sort((left, right) => left.name.localeCompare(right.name)).map((entry) => {
+ const name = entry.name;
const file = path.join(dir, name);
- if (fs.lstatSync(file).isDirectory()) return [name, snapshot(file)];
+ if (entry.isDirectory()) return [name, snapshot(file)];
const fd = fs.openSync(file, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
try {
assert.ok(fs.fstatSync(fd).isFile(), 'snapshot requires a regular file');