Oregami
Repositories/oxedyne/daimond

oxedyne/daimond/dev/probe_readmiss.mjs

1.4 KiB, 1 run

created by r2519314175:67, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1// probe_readmiss.mjs — what the file door says when a path is not there.
2//
3// It was written for `Pending.sweep`, which might only drop a tile when the
4// answer was "that file is gone" and never when it was "the door did not
5// answer". THAT SWEEP IS GONE, deleted 2026-08-15 with the draft kind it served.
6// The probe stands because the distinction does: anything that deletes on a read
7// has to tell an absence from a refusal, and this asks the door directly what it
8// says for each.
9import { open } from './harness.mjs';
10
11const s = await open({ name: 'readmiss', connect: false, defaults: false });
12const p = s.page;
13await p.waitForTimeout(1500);
14
15const out = await p.evaluate(async () => {
16 const m = await import('/pkg/oxedyne_daimond.js');
17 const say = async (label, fn) => {
18 try { const r = await fn(); return { label, threw: false, value: String(r).slice(0, 120) }; }
19 catch (e) { return { label, threw: true, name: e && e.name, msg: String(e && (e.message || e)).slice(0, 200) }; }
20 };
21 await m.write_file('probe-here.txt', 'here');
22 return [
23 await say('present file', () => m.read_file('probe-here.txt')),
24 await say('missing file', () => m.read_file('probe-gone.txt')),
25 await say('missing under a missing dir', () => m.read_file('nope/deeper/gone.eml')),
26 await say('probe of a missing file', () => m.file_probe('probe-gone.txt')),
27 ];
28});
29console.log(JSON.stringify(out, null, 2));
30await s.close();