gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitd3edaa05d3edaa05|||PR records: HM55 start, PROCEDURES.mdTrackerd3edaa05/plugins/fs/tests/listdir-lifetime.mjs

2.1 KB

  1. import assert from 'node:assert/strict';
  2. import { mkdtempSync, writeFileSync, mkdirSync, readdirSync, rmSync } from 'node:fs';
  3. import { spawnSync } from 'node:child_process';
  4. import { join, resolve } from 'node:path';
  5. const root = resolve(import.meta.dirname, '../../..');
  6. const bin = process.env.HL_BIN || join(root, 'native/zig-out/bin/hybriel');
  7. const work = mkdtempSync(join(process.env.TMPDIR, 'listdir-lifetime-'));
  8. try {
  9. const dir = join(work, 'entries');
  10. mkdirSync(dir);
  11. for (let i = 0; i < 150; i++) writeFileSync(join(dir, String(i).padStart(64, '0') + '.txt'), 'abc');
  12. const expected = readdirSync(dir, { withFileTypes: true }).map(e => e.name);
  13. const source = join(work, 'walk.hl');
  14. writeFileSync(source, `import { listDir, writeFile } from 'hl:fs'
  15. import { args } from 'hl:proc'
  16. a = args()
  17. let rows = []
  18. iterator = listDir(a[0])
  19. writeFile(a[0] + '/late.txt', 'late')
  20. for (entry of iterator) { rows.push(entry) }
  21. console.log(JSON.stringify(rows))
  22. let early = ''
  23. for (entry of listDir(a[0])) { early = entry.name
  24. break }
  25. console.log(early)
  26. `);
  27. const native = join(work, 'walk');
  28. const build = spawnSync(bin, ['--native', source, '-o', native], { encoding: 'utf8' });
  29. assert.equal(build.status, 0, build.stdout + build.stderr);
  30. const run = spawnSync(native, [dir], { encoding: 'utf8' });
  31. assert.equal(run.status, 0, run.stdout + run.stderr);
  32. const [json, first] = run.stdout.trim().split('\n');
  33. const rows = JSON.parse(json);
  34. assert.deepEqual(rows.map(e => e.name).sort(), expected.sort());
  35. for (const e of rows) {
  36. assert.equal(e.path, join(dir, e.name));
  37. assert.equal(e.type, 'file');
  38. assert.equal(e.size, 3);
  39. assert.equal(e.mime, 'text/plain');
  40. assert.equal(typeof e.chmod, 'number');
  41. assert.equal(e.user, process.getuid());
  42. assert.equal(e.group, process.getgid());
  43. assert.deepEqual(Object.keys(e).sort(), ['chmod', 'group', 'mime', 'name', 'path', 'size', 'type', 'user']);
  44. }
  45. assert.ok(expected.includes(first) || first === 'late.txt');
  46. console.log('listDir: 150 retained eight-field entries survive exhaustion; call-time snapshot and early exit pass');
  47. } finally { rmSync(work, { recursive: true, force: true }); }

Branches

Latest commits

  • d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
  • 3059f86cMerge branch 'records-design-rule' into mainTracker
  • 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
  • d1390692Merge branch 'records-dp75b' into mainTracker
  • a4d1a7d2|||PR records: later steps checked, branch auditTracker
  • e070e16fMerge branch 'records-dp75' into mainTracker
  • 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
  • bfc4ea4dMerge branch 'ap62' into mainTracker
  • 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker
  • b9c7c3c8Merge branch 'records-dp74' into mainTracker
  • 85cfb4ae|||PR records: AP61 day61, DP74 liveTracker
  • b1496147Merge branch 'ap61' into mainTracker
  • 2047955bMerge branch 'u12-gateports' into mainTracker
  • c8da40f3|||PR AP61: re-vendor Hybriel set day61 (source a05af47c, bin a11042e5)Tracker
  • 4e018678|||PR deploy.sh: gates use Tracker's ports 8716-8719 and LC_ALL=C; README: 2 backups keptTracker
  • 0b86324aMerge branch 'records-dp73' into mainTracker
  • 9ce5f59b|||PR records: DP73 live 613ae0e; deploy.sh keeps 2 backupsTracker
  • 613ae0ecMerge branch 'bs3' into mainTracker
  • 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
  • 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker