cursedbelt-server 4.48.0 → 4.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/activity/store.d.ts +1 -1
- package/dist/server/analytics/injectedScripts.d.ts +1 -1
- package/dist/server/analytics/injectedScripts.js +1 -1
- package/dist/server/analytics/webAnalytics.d.ts +1 -1
- package/dist/server/analytics/webAnalytics.js +1 -1
- package/dist/server/auth/loginThrottleDurable.d.ts +3 -3
- package/dist/server/auth/loginThrottleDurable.js +3 -3
- package/dist/server/auth/passwordCost.js +1 -1
- package/dist/server/ctgrChunkDurable.d.ts +1 -1
- package/dist/server/ctgrChunkDurable.js +1 -1
- package/dist/server/d1/backup.d.ts +1 -1
- package/dist/server/d1/backup.js +1 -1
- package/dist/server/d1/http.d.ts +2 -2
- package/dist/server/d1/http.js +2 -2
- package/dist/server/d1/invocation.js +1 -1
- package/dist/server/d1/limits.d.ts +1 -1
- package/dist/server/d1/limits.js +1 -1
- package/dist/server/d1/pullD1.d.ts +4 -1
- package/dist/server/d1/pullD1.js +5 -2
- package/dist/server/d1/scheduling.d.ts +1 -1
- package/dist/server/d1/scheduling.js +1 -1
- package/dist/server/d1/types.d.ts +1 -1
- package/dist/server/d1/types.js +1 -1
- package/dist/server/d1/values.d.ts +1 -1
- package/dist/server/d1/values.js +1 -1
- package/dist/server/dropzone/index.d.ts +1 -0
- package/dist/server/dropzone/index.js +1 -0
- package/dist/server/dropzone/report.d.ts +188 -0
- package/dist/server/dropzone/report.js +430 -0
- package/dist/server/dropzone/scan.d.ts +22 -3
- package/dist/server/dropzone/scan.js +46 -1
- package/dist/server/engagement/index.d.ts +1 -1
- package/dist/server/engagement/index.js +1 -1
- package/dist/server/guard/argon2Binding.js +1 -1
- package/dist/server/guard/kdfWorkerEntry.js +2 -2
- package/dist/server/incidents/index.d.ts +1 -1
- package/dist/server/incidents/index.js +1 -1
- package/dist/server/incidents/store.d.ts +1 -1
- package/dist/server/incidents/store.js +1 -1
- package/dist/server/jobs/timeout.d.ts +1 -1
- package/dist/server/jobs/timeout.js +1 -1
- package/dist/server/master-lock/accountsPage.d.ts +1 -1
- package/dist/server/master-lock/accountsPage.js +2 -2
- package/dist/server/master-lock/guard.js +1 -1
- package/dist/server/master-lock/lockPage.d.ts +1 -1
- package/dist/server/master-lock/lockPage.js +2 -2
- package/dist/server/master-lock/masterLock.d.ts +2 -2
- package/dist/server/master-lock/masterLock.js +2 -2
- package/dist/server/metrics/normalizeRoute.js +1 -1
- package/dist/server/metrics/telemetrySink.d.ts +2 -2
- package/dist/server/metrics/telemetrySink.js +1 -1
- package/dist/server/middleware/zValidator.js +2 -2
- package/dist/server/notifications/hub.js +1 -1
- package/dist/server/requestLog/requestMetrics.d.ts +2 -2
- package/dist/server/requestLog/requestMetrics.js +2 -2
- package/dist/server/retention/archive.d.ts +1 -1
- package/dist/server/retention/archive.js +2 -2
- package/dist/server/satellite/config.js +2 -2
- package/dist/server/satellite/door.d.ts +1 -1
- package/dist/server/sharing/contract.d.ts +1 -1
- package/dist/server/storage/binaryStore.d.ts +1 -1
- package/dist/server/storage/binaryStore.js +3 -3
- package/dist/server/storage/derivatives.d.ts +2 -2
- package/dist/server/storage/derivatives.js +2 -2
- package/dist/server/storage/files/adapter.d.ts +2 -2
- package/dist/server/storage/files/adapter.js +10 -10
- package/dist/server/storage/files/catalogue.d.ts +1 -1
- package/dist/server/storage/files/catalogue.js +4 -4
- package/dist/server/storage/files/chunkedUpload.d.ts +2 -2
- package/dist/server/storage/files/chunkedUpload.js +1 -1
- package/dist/server/storage/files/fileRoutes.d.ts +1 -1
- package/dist/server/storage/files/fileRoutes.js +4 -4
- package/dist/server/storage/files/mimeByExt.js +1 -1
- package/dist/server/storage/files/stack.d.ts +2 -2
- package/dist/server/storage/files/types.d.ts +4 -4
- package/dist/server/storage/files/types.js +1 -1
- package/dist/server/storage/index.js +1 -1
- package/dist/server/storage/objectStoreMediaStore.js +1 -1
- package/dist/server/storage/transcodeJobs.js +5 -5
- package/dist/server/storage/types.d.ts +1 -1
- package/dist/server/storage/types.js +1 -1
- package/dist/server/storage/videoDerivativeKeys.d.ts +1 -1
- package/dist/server/storage/videoDerivativeKeys.js +1 -1
- package/dist/server/storage/videoProcessor.js +1 -1
- package/dist/server/sync/status.d.ts +1 -1
- package/dist/server/zipStream.d.ts +1 -1
- package/dist/server/zipStream.js +1 -1
- package/docs/activity.md +2 -2
- package/docs/retention.md +2 -2
- package/package.json +1 -1
- package/src/leafSubpathsImportNothing.spec.ts +1 -1
- package/src/namedSubpathsResolve.spec.ts +1 -1
- package/src/noTimerDialsAPeer.spec.ts +1 -1
- package/src/nodeBuiltinsAreProbedByCalling.spec.ts +1 -1
- package/src/publishShape.spec.ts +1 -1
- package/src/server/activity/store.ts +1 -1
- package/src/server/analytics/injectedScripts.spec.ts +1 -1
- package/src/server/analytics/injectedScripts.ts +1 -1
- package/src/server/analytics/webAnalytics.ts +1 -1
- package/src/server/auth/loginThrottleDurable.ts +3 -3
- package/src/server/auth/passwordCost.ts +1 -1
- package/src/server/bench/cpuBudget.spec.ts +1 -1
- package/src/server/bench/tail.spec.ts +1 -1
- package/src/server/ctgrChunkDurable.ts +1 -1
- package/src/server/d1/backup.spec.ts +1 -1
- package/src/server/d1/backup.ts +1 -1
- package/src/server/d1/http.ts +2 -2
- package/src/server/d1/invocation.spec.ts +1 -1
- package/src/server/d1/invocation.ts +1 -1
- package/src/server/d1/limits.ts +1 -1
- package/src/server/d1/pullD1.spec.ts +9 -1
- package/src/server/d1/pullD1.ts +5 -2
- package/src/server/d1/scheduling.ts +1 -1
- package/src/server/d1/types.ts +1 -1
- package/src/server/d1/values.ts +1 -1
- package/src/server/dropzone/index.ts +8 -0
- package/src/server/dropzone/report.spec.ts +275 -0
- package/src/server/dropzone/report.ts +568 -0
- package/src/server/dropzone/scan.spec.ts +2 -2
- package/src/server/dropzone/scan.ts +68 -5
- package/src/server/engagement/engagement.spec.ts +1 -1
- package/src/server/engagement/index.ts +1 -1
- package/src/server/google-oauth/googleOAuth.spec.ts +1 -1
- package/src/server/guard/argon2Binding.ts +1 -1
- package/src/server/guard/kdfWorkerEntry.ts +2 -2
- package/src/server/incidents/index.ts +1 -1
- package/src/server/incidents/store.ts +1 -1
- package/src/server/jobs/timeout.ts +1 -1
- package/src/server/master-lock/accountsPage.spec.ts +2 -2
- package/src/server/master-lock/accountsPage.ts +2 -2
- package/src/server/master-lock/beaconNeverReachesTheWall.spec.ts +2 -2
- package/src/server/master-lock/guard.spec.ts +2 -2
- package/src/server/master-lock/guard.ts +1 -1
- package/src/server/master-lock/lockPage.spec.ts +1 -1
- package/src/server/master-lock/lockPage.ts +2 -2
- package/src/server/master-lock/masterLock.spec.ts +1 -1
- package/src/server/master-lock/masterLock.ts +2 -2
- package/src/server/master-lock/sessions.spec.ts +1 -1
- package/src/server/metrics/normalizeRoute.ts +1 -1
- package/src/server/metrics/telemetrySink.ts +3 -3
- package/src/server/middleware/bodyLimit.spec.ts +1 -1
- package/src/server/middleware/zValidator.spec.ts +3 -3
- package/src/server/middleware/zValidator.ts +3 -3
- package/src/server/notifications/hub.ts +1 -1
- package/src/server/requestLog/requestMetrics.spec.ts +2 -2
- package/src/server/requestLog/requestMetrics.ts +3 -3
- package/src/server/retention/archive.spec.ts +2 -2
- package/src/server/retention/archive.ts +2 -2
- package/src/server/satellite/config.ts +2 -2
- package/src/server/satellite/door.ts +1 -1
- package/src/server/satellite/satellite.spec.ts +1 -1
- package/src/server/sharing/contract.ts +1 -1
- package/src/server/storage/binaryServerProcessing.spec.ts +1 -1
- package/src/server/storage/binaryServerProcessing.ts +4 -4
- package/src/server/storage/binaryStore.spec.ts +6 -6
- package/src/server/storage/binaryStore.ts +4 -4
- package/src/server/storage/chunked.integration.spec.ts +2 -2
- package/src/server/storage/derivatives.ts +2 -2
- package/src/server/storage/fileUploadClient.integration.spec.ts +1 -1
- package/src/server/storage/files/adapter.photo.spec.ts +2 -2
- package/src/server/storage/files/adapter.spec.ts +3 -3
- package/src/server/storage/files/adapter.ts +10 -10
- package/src/server/storage/files/catalogue.spec.ts +1 -1
- package/src/server/storage/files/catalogue.ts +4 -4
- package/src/server/storage/files/chunkedUpload.spec.ts +5 -5
- package/src/server/storage/files/chunkedUpload.ts +3 -3
- package/src/server/storage/files/fileRoutes.spec.ts +3 -3
- package/src/server/storage/files/fileRoutes.ts +5 -5
- package/src/server/storage/files/mimeByExt.ts +1 -1
- package/src/server/storage/files/stack.ts +3 -3
- package/src/server/storage/files/types.ts +6 -6
- package/src/server/storage/index.ts +1 -1
- package/src/server/storage/objectStoreMediaStore.ts +1 -1
- package/src/server/storage/sources.ts +1 -1
- package/src/server/storage/transcodeJobs.ts +5 -5
- package/src/server/storage/types.ts +2 -2
- package/src/server/storage/uploadSession.spec.ts +1 -1
- package/src/server/storage/videoDerivativeKeys.spec.ts +3 -3
- package/src/server/storage/videoDerivativeKeys.ts +1 -1
- package/src/server/storage/videoProcessor.ts +1 -1
- package/src/server/sync/status.ts +1 -1
- package/src/server/sync/timer.spec.ts +1 -1
- package/src/server/worker-argon2/index.spec.ts +1 -1
- package/src/server/zipStream.spec.ts +2 -2
- package/src/server/zipStream.ts +1 -1
- package/src/shippedFilesAreTracked.spec.ts +2 -2
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a dropzone sweep is doing, written down for station's Uploads page (forge task 3588; family's and music's sweeps since its follow-up).
|
|
3
|
+
*
|
|
4
|
+
* > *"I need station or binaries to show me in progress info about ingestions such as dropzone work
|
|
5
|
+
* > … status, size, file counts, time started/ended, duration, estimated completion time … If there
|
|
6
|
+
* > are file lists they should be paginated in cases where there are huge upload sets like I have
|
|
7
|
+
* > ongoing from databundle volume right now. If there's an issue or something needs to be plugged in
|
|
8
|
+
* > or set back up it should make it clear to me."* — the owner, 2026-10-22
|
|
9
|
+
*
|
|
10
|
+
* The sweep is the only thing that knows what "waiting for room" or "the drive is not plugged in"
|
|
11
|
+
* means for a file, so it says so here rather than leaving a reader to re-derive it from the log.
|
|
12
|
+
* Three files in the sweep's own state folder (`$FORGE_STATE/state/<app>-ingest/`) — station lists
|
|
13
|
+
* every app that writes them, with no list of apps:
|
|
14
|
+
*
|
|
15
|
+
* · **`progress.json`** — the sweep (running or how it ended) and every SOURCE: each top-level
|
|
16
|
+
* folder or link in an account folder is one (a linked drive folder, a dropped `Vacation 2024/`),
|
|
17
|
+
* and loose files at an account's root are one more. Per source: what it holds, what is done, what
|
|
18
|
+
* waits for room or for its drive, what failed, the file going in now (with the binary-server key
|
|
19
|
+
* its parts stage under, so station can show that file's own progress), and its drive. Rewritten
|
|
20
|
+
* whole (temp + rename) at most every {@link WRITE_EVERY_MS}, and always at a sweep's end.
|
|
21
|
+
* · **`files.jsonl`** — one line per file that reached an outcome (added, duplicate, parked,
|
|
22
|
+
* blocked, failed), appended as it happens: the paginated "done" list and the throughput curve.
|
|
23
|
+
* The first time, a caller's `settled` answer backfills what an earlier run already filed.
|
|
24
|
+
* Moved aside to `files.1.jsonl` past {@link JOURNAL_ROTATE_BYTES}.
|
|
25
|
+
* · **`queue.jsonl`** — every file found this sweep that has NOT reached an outcome, with its state;
|
|
26
|
+
* rewritten whole when the walk is done and at the end. The paginated "still to go" list.
|
|
27
|
+
*
|
|
28
|
+
* 🔴 Only the sweep writes them, and only a reader reads them: nothing here decides anything about a
|
|
29
|
+
* file. A write that fails is logged once and costs the page its freshness, never the sweep its run —
|
|
30
|
+
* every hook is guarded. `UPLOADS_CONTRACT` in station's `src/uploads.ts` is the reader's copy of the
|
|
31
|
+
* shape; `v` changes when a field changes meaning.
|
|
32
|
+
*
|
|
33
|
+
* `sweepDropzone` drives one by itself (its `report` option); a sweep of its own (collections') calls
|
|
34
|
+
* the hooks where it decides.
|
|
35
|
+
*/
|
|
36
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, readlinkSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
37
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
38
|
+
export const PROGRESS_VERSION = 1;
|
|
39
|
+
export const PROGRESS_FILE = "progress.json";
|
|
40
|
+
export const FILES_JOURNAL = "files.jsonl";
|
|
41
|
+
export const QUEUE_FILE = "queue.jsonl";
|
|
42
|
+
/** The page polls every few seconds; the file need not be fresher than that. */
|
|
43
|
+
export const WRITE_EVERY_MS = 2_000;
|
|
44
|
+
export const JOURNAL_ROTATE_BYTES = 64 * 1024 ** 2;
|
|
45
|
+
/** A finished source stays listed this long, so "what finished today" is on the page. */
|
|
46
|
+
export const FINISHED_KEPT_MS = 7 * 24 * 60 * 60 * 1000;
|
|
47
|
+
/** The name of the source that holds an account's loose files. */
|
|
48
|
+
export const LOOSE_FILES = "Loose files";
|
|
49
|
+
const zero = () => ({ files: 0, bytes: 0 });
|
|
50
|
+
const add = (t, bytes) => {
|
|
51
|
+
t.files++;
|
|
52
|
+
t.bytes += bytes;
|
|
53
|
+
};
|
|
54
|
+
/** The source a file belongs to: its account plus the first segment of its path, or the loose files. */
|
|
55
|
+
export function sourceIdOf(accountId, relativePath) {
|
|
56
|
+
const slash = relativePath.indexOf("/");
|
|
57
|
+
if (slash < 0)
|
|
58
|
+
return { id: `${accountId}:`, label: LOOSE_FILES, top: null };
|
|
59
|
+
const top = relativePath.slice(0, slash);
|
|
60
|
+
return { id: `${accountId}:${top}`, label: top, top };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* One sweep's reporter. `ingest.ts` makes it before the walk and hands its hooks to `sweepFiles`.
|
|
64
|
+
*/
|
|
65
|
+
export function createIngestReporter(o) {
|
|
66
|
+
const now = o.now ?? Date.now;
|
|
67
|
+
const iso = () => new Date(now()).toISOString();
|
|
68
|
+
const progressPath = join(o.stateDir, PROGRESS_FILE);
|
|
69
|
+
const journalPath = join(o.stateDir, FILES_JOURNAL);
|
|
70
|
+
const queuePath = join(o.stateDir, QUEUE_FILE);
|
|
71
|
+
let warned = false;
|
|
72
|
+
const safely = (what, fn) => {
|
|
73
|
+
try {
|
|
74
|
+
fn();
|
|
75
|
+
}
|
|
76
|
+
catch (cause) {
|
|
77
|
+
if (!warned)
|
|
78
|
+
(o.warn ?? console.warn)(` ? could not write the ${what} station reads (${cause instanceof Error ? cause.message : String(cause)}); the sweep carries on`);
|
|
79
|
+
warned = true;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const previous = readProgress(progressPath);
|
|
83
|
+
const prevSources = new Map((previous?.sources ?? []).map((s) => [s.id, s]));
|
|
84
|
+
const accountLabel = new Map(o.accounts.map((a) => [a.id, a.label]));
|
|
85
|
+
const startedAt = iso();
|
|
86
|
+
const sweep = { pid: o.pid ?? process.pid, startedAt, finishedAt: null, state: "running", phase: "starting" };
|
|
87
|
+
const tracked = new Map();
|
|
88
|
+
const outcomes = new Map();
|
|
89
|
+
const current = new Map();
|
|
90
|
+
/** Sources this sweep could not walk at all: their link's drive is not there. */
|
|
91
|
+
const unreachable = new Map();
|
|
92
|
+
/** The oldest settled date of each source's files — when a linked run really began. */
|
|
93
|
+
const firstSettled = new Map();
|
|
94
|
+
/** …and the newest — when a linked run last filed anything, before this sweep. */
|
|
95
|
+
const lastSettled = new Map();
|
|
96
|
+
let walked = false;
|
|
97
|
+
let lastWrite = 0;
|
|
98
|
+
const keyOf = (file) => `${file.accountId}\0${file.path}`;
|
|
99
|
+
const outcomeOf = (source) => {
|
|
100
|
+
let o2 = outcomes.get(source);
|
|
101
|
+
if (!o2) {
|
|
102
|
+
o2 = { added: 0, duplicate: 0, blocked: 0, parked: 0, failed: zero(), done: zero(), last: null };
|
|
103
|
+
outcomes.set(source, o2);
|
|
104
|
+
}
|
|
105
|
+
return o2;
|
|
106
|
+
};
|
|
107
|
+
/** Each account folder's top-level links: name → real target. */
|
|
108
|
+
const links = new Map();
|
|
109
|
+
for (const account of o.accounts) {
|
|
110
|
+
let names = [];
|
|
111
|
+
try {
|
|
112
|
+
names = readdirSync(account.dir);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
for (const name of names) {
|
|
118
|
+
const full = join(account.dir, name);
|
|
119
|
+
try {
|
|
120
|
+
links.set(`${account.id}:${name}`, resolve(dirname(full), readlinkSync(full)));
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
/* not a link */
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const driveOf = (target) => {
|
|
128
|
+
try {
|
|
129
|
+
return o.driveOf?.(target);
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
function sources() {
|
|
136
|
+
const out = new Map();
|
|
137
|
+
const base = (id, accountId, label, top) => {
|
|
138
|
+
const prev = prevSources.get(id);
|
|
139
|
+
const target = top ? links.get(`${accountId}:${top}`) : undefined;
|
|
140
|
+
const account = o.accounts.find((a) => a.id === accountId);
|
|
141
|
+
const drive = target ? driveOf(target) : undefined;
|
|
142
|
+
return {
|
|
143
|
+
id,
|
|
144
|
+
account: { id: accountId, label: accountLabel.get(accountId) ?? accountId },
|
|
145
|
+
label,
|
|
146
|
+
kind: target ? "linked" : top ? "folder" : "loose",
|
|
147
|
+
path: account ? (top ? join(account.dir, top) : account.dir) : (prev?.path ?? ""),
|
|
148
|
+
...(target ? { target, ...(drive ? { drive } : {}) } : {}),
|
|
149
|
+
startedAt: prev && (prev.finishedAt === null || target) ? prev.startedAt : (firstSettled.get(id) ?? startedAt),
|
|
150
|
+
finishedAt: null,
|
|
151
|
+
lastOutcomeAt: prev?.lastOutcomeAt ?? lastSettled.get(id) ?? null,
|
|
152
|
+
total: zero(),
|
|
153
|
+
done: zero(),
|
|
154
|
+
added: 0,
|
|
155
|
+
duplicate: 0,
|
|
156
|
+
blocked: 0,
|
|
157
|
+
parked: 0,
|
|
158
|
+
queued: zero(),
|
|
159
|
+
waitingForRoom: zero(),
|
|
160
|
+
waitingForDrive: zero(),
|
|
161
|
+
skipped: zero(),
|
|
162
|
+
failed: zero(),
|
|
163
|
+
current: null,
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
for (const t of tracked.values()) {
|
|
167
|
+
let s = out.get(t.source);
|
|
168
|
+
if (!s) {
|
|
169
|
+
const { label, top } = sourceIdOf(t.file.accountId, t.file.relativePath);
|
|
170
|
+
s = base(t.source, t.file.accountId, label, top);
|
|
171
|
+
out.set(t.source, s);
|
|
172
|
+
}
|
|
173
|
+
add(s.total, t.file.size);
|
|
174
|
+
if (t.state === "done")
|
|
175
|
+
add(s.done, t.file.size);
|
|
176
|
+
else if (t.state === "queued" || t.state === "uploading" || t.state === "copying")
|
|
177
|
+
add(s.queued, t.file.size);
|
|
178
|
+
else if (t.state === "waiting-room")
|
|
179
|
+
add(s.waitingForRoom, t.file.size);
|
|
180
|
+
else if (t.state === "waiting-drive")
|
|
181
|
+
add(s.waitingForDrive, t.file.size);
|
|
182
|
+
else if (t.state === "skipped")
|
|
183
|
+
add(s.skipped, t.file.size);
|
|
184
|
+
else if (t.state === "failed")
|
|
185
|
+
add(s.failed, t.file.size);
|
|
186
|
+
}
|
|
187
|
+
// A source whose drive is not there could not be walked: it keeps what it last knew, all waiting.
|
|
188
|
+
for (const [id, u] of unreachable) {
|
|
189
|
+
if (out.has(id))
|
|
190
|
+
continue;
|
|
191
|
+
const s = base(id, u.accountId, u.top, u.top);
|
|
192
|
+
const prev = prevSources.get(id);
|
|
193
|
+
if (prev) {
|
|
194
|
+
s.total = { ...prev.total };
|
|
195
|
+
s.done = { ...prev.done };
|
|
196
|
+
s.added = prev.added;
|
|
197
|
+
s.duplicate = prev.duplicate;
|
|
198
|
+
s.blocked = prev.blocked;
|
|
199
|
+
s.parked = prev.parked;
|
|
200
|
+
s.failed = { ...prev.failed };
|
|
201
|
+
s.waitingForDrive = { files: Math.max(0, prev.total.files - prev.done.files - prev.failed.files), bytes: Math.max(0, prev.total.bytes - prev.done.bytes - prev.failed.bytes) };
|
|
202
|
+
}
|
|
203
|
+
out.set(id, s);
|
|
204
|
+
}
|
|
205
|
+
for (const s of out.values()) {
|
|
206
|
+
const o2 = outcomes.get(s.id);
|
|
207
|
+
const prev = prevSources.get(s.id);
|
|
208
|
+
// A folder that is not a link EMPTIES as it is filed: what an unfinished run filed before
|
|
209
|
+
// this sweep is gone from the walk, so it is carried. A link's files stay and are counted.
|
|
210
|
+
if (s.kind !== "linked" && prev && prev.finishedAt === null && !unreachable.has(s.id)) {
|
|
211
|
+
s.total.files += prev.done.files;
|
|
212
|
+
s.total.bytes += prev.done.bytes;
|
|
213
|
+
s.done.files += prev.done.files;
|
|
214
|
+
s.done.bytes += prev.done.bytes;
|
|
215
|
+
s.added += prev.added;
|
|
216
|
+
s.duplicate += prev.duplicate;
|
|
217
|
+
s.blocked += prev.blocked;
|
|
218
|
+
s.parked += prev.parked;
|
|
219
|
+
}
|
|
220
|
+
if (o2) {
|
|
221
|
+
s.added += o2.added;
|
|
222
|
+
s.duplicate += o2.duplicate;
|
|
223
|
+
s.blocked += o2.blocked;
|
|
224
|
+
s.parked += o2.parked;
|
|
225
|
+
if (o2.last)
|
|
226
|
+
s.lastOutcomeAt = o2.last;
|
|
227
|
+
}
|
|
228
|
+
s.current = current.get(s.id) ?? null;
|
|
229
|
+
// Skipped files (an unfinished download, an alias with no target) are shown but do not hold a run open.
|
|
230
|
+
const left = s.queued.files + s.waitingForRoom.files + s.waitingForDrive.files;
|
|
231
|
+
if (walked && left === 0 && !unreachable.has(s.id))
|
|
232
|
+
s.finishedAt = prev?.finishedAt && s.done.files === prev.done.files ? prev.finishedAt : (s.lastOutcomeAt ?? iso());
|
|
233
|
+
}
|
|
234
|
+
// A source that is no longer there (a folder filed to the last file, an unlinked link) keeps its
|
|
235
|
+
// row as finished for a week; one this sweep did not reach yet (the walk is not done) keeps its row as is.
|
|
236
|
+
for (const prev of prevSources.values()) {
|
|
237
|
+
if (out.has(prev.id))
|
|
238
|
+
continue;
|
|
239
|
+
if (!walked) {
|
|
240
|
+
out.set(prev.id, prev);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const finishedAt = prev.finishedAt ?? prev.lastOutcomeAt ?? iso();
|
|
244
|
+
if (now() - Date.parse(finishedAt) > FINISHED_KEPT_MS)
|
|
245
|
+
continue;
|
|
246
|
+
out.set(prev.id, {
|
|
247
|
+
...prev,
|
|
248
|
+
finishedAt,
|
|
249
|
+
queued: zero(),
|
|
250
|
+
waitingForRoom: zero(),
|
|
251
|
+
waitingForDrive: zero(),
|
|
252
|
+
skipped: zero(),
|
|
253
|
+
current: null,
|
|
254
|
+
// What was left when it went is not done — a folder the owner took back out reads as such.
|
|
255
|
+
total: prev.finishedAt ? prev.total : { files: prev.done.files + prev.failed.files, bytes: prev.done.bytes + prev.failed.bytes },
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
return [...out.values()].sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
|
|
259
|
+
}
|
|
260
|
+
function writeProgress(force = false) {
|
|
261
|
+
if (!force && now() - lastWrite < WRITE_EVERY_MS)
|
|
262
|
+
return;
|
|
263
|
+
lastWrite = now();
|
|
264
|
+
const record = {
|
|
265
|
+
v: PROGRESS_VERSION,
|
|
266
|
+
app: o.app,
|
|
267
|
+
job: o.job,
|
|
268
|
+
everySeconds: o.everySeconds,
|
|
269
|
+
dropzone: o.dropzone,
|
|
270
|
+
updatedAt: iso(),
|
|
271
|
+
sweep,
|
|
272
|
+
accounts: o.accounts.length ? o.accounts.map((a) => ({ id: a.id, label: a.label })) : (previous?.accounts ?? []),
|
|
273
|
+
room: o.room?.() ?? null,
|
|
274
|
+
sources: sources(),
|
|
275
|
+
};
|
|
276
|
+
safely("progress", () => {
|
|
277
|
+
mkdirSync(o.stateDir, { recursive: true });
|
|
278
|
+
writeFileSync(`${progressPath}.tmp`, `${JSON.stringify(record)}\n`);
|
|
279
|
+
renameSync(`${progressPath}.tmp`, progressPath);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function writeQueue() {
|
|
283
|
+
const lines = [];
|
|
284
|
+
for (const t of tracked.values())
|
|
285
|
+
if (t.state !== "done")
|
|
286
|
+
lines.push(JSON.stringify({ source: t.source, path: t.file.relativePath, bytes: t.file.size, state: t.state }));
|
|
287
|
+
safely("queue", () => {
|
|
288
|
+
mkdirSync(o.stateDir, { recursive: true });
|
|
289
|
+
writeFileSync(`${queuePath}.tmp`, lines.length ? `${lines.join("\n")}\n` : "");
|
|
290
|
+
renameSync(`${queuePath}.tmp`, queuePath);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function journal(line) {
|
|
294
|
+
safely("file journal", () => {
|
|
295
|
+
mkdirSync(o.stateDir, { recursive: true });
|
|
296
|
+
appendFileSync(journalPath, `${JSON.stringify(line)}\n`);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
const set = (file, state, force = false) => {
|
|
300
|
+
const t = tracked.get(keyOf(file));
|
|
301
|
+
if (t)
|
|
302
|
+
t.state = state;
|
|
303
|
+
writeProgress(force);
|
|
304
|
+
};
|
|
305
|
+
safely("file journal", () => {
|
|
306
|
+
if (existsSync(journalPath) && statSync(journalPath).size > JOURNAL_ROTATE_BYTES)
|
|
307
|
+
renameSync(journalPath, join(o.stateDir, `${basename(FILES_JOURNAL, ".jsonl")}.1.jsonl`));
|
|
308
|
+
});
|
|
309
|
+
const startJournal = !existsSync(journalPath) && !existsSync(join(o.stateDir, `${basename(FILES_JOURNAL, ".jsonl")}.1.jsonl`));
|
|
310
|
+
safely("progress", () => writeProgress(true));
|
|
311
|
+
/**
|
|
312
|
+
* 🔴 Every hook is GUARDED: the reporter runs inside the live sweep, and nothing it gets wrong may
|
|
313
|
+
* cost a file its import. A throw is logged once and the page goes stale; the sweep carries on.
|
|
314
|
+
*/
|
|
315
|
+
const guarded = (what, fn) => (...args) => safely(what, () => fn(...args));
|
|
316
|
+
const hooks = {
|
|
317
|
+
/** The walk is about to start. */
|
|
318
|
+
walking() {
|
|
319
|
+
sweep.phase = "walking";
|
|
320
|
+
writeProgress(true);
|
|
321
|
+
},
|
|
322
|
+
/** A link whose target cannot be reached right now. */
|
|
323
|
+
unreachable(accountId, relativePath, target) {
|
|
324
|
+
// The link itself — at the account folder's top, so its path IS its first segment.
|
|
325
|
+
const top = relativePath.split("/")[0];
|
|
326
|
+
if (top)
|
|
327
|
+
unreachable.set(`${accountId}:${top}`, { accountId, top, target });
|
|
328
|
+
},
|
|
329
|
+
/**
|
|
330
|
+
* Everything the walk found. A file `settled` says an earlier run filed is `done`; the first time
|
|
331
|
+
* the journal is started, those settled files are written into it, at their own dates.
|
|
332
|
+
*/
|
|
333
|
+
found(files, settled) {
|
|
334
|
+
const backfill = [];
|
|
335
|
+
for (const file of files) {
|
|
336
|
+
const { id } = sourceIdOf(file.accountId, file.relativePath);
|
|
337
|
+
const entry = settled?.(file);
|
|
338
|
+
tracked.set(keyOf(file), { file, source: id, state: entry?.outcome ? "done" : "queued" });
|
|
339
|
+
if (entry?.outcome && (!firstSettled.has(id) || Date.parse(entry.at) < Date.parse(firstSettled.get(id) ?? "")))
|
|
340
|
+
firstSettled.set(id, entry.at);
|
|
341
|
+
if (entry?.outcome && (!lastSettled.has(id) || Date.parse(entry.at) > Date.parse(lastSettled.get(id) ?? "")))
|
|
342
|
+
lastSettled.set(id, entry.at);
|
|
343
|
+
if (entry?.outcome && startJournal)
|
|
344
|
+
backfill.push({ at: entry.at, source: id, account: file.accountId, path: file.relativePath, bytes: file.size, outcome: entry.outcome, ...(entry.itemId ? { itemId: entry.itemId } : {}), backfilled: true });
|
|
345
|
+
}
|
|
346
|
+
if (backfill.length > 0) {
|
|
347
|
+
backfill.sort((a, b) => Date.parse(a.at) - Date.parse(b.at));
|
|
348
|
+
safely("file journal", () => {
|
|
349
|
+
mkdirSync(o.stateDir, { recursive: true });
|
|
350
|
+
appendFileSync(journalPath, `${backfill.map((l) => JSON.stringify(l)).join("\n")}\n`);
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
walked = true;
|
|
354
|
+
sweep.phase = "filing";
|
|
355
|
+
writeQueue();
|
|
356
|
+
writeProgress(true);
|
|
357
|
+
},
|
|
358
|
+
/** `SweepDeps.progress` — what the sweep decided about a file before (or instead of) filing it. */
|
|
359
|
+
progress: {
|
|
360
|
+
waiting(file, why) {
|
|
361
|
+
set(file, why === "done" ? "done" : why === "room" ? "waiting-room" : why === "drive" ? "waiting-drive" : why);
|
|
362
|
+
},
|
|
363
|
+
uploading(file, key) {
|
|
364
|
+
const { id } = sourceIdOf(file.accountId, file.relativePath);
|
|
365
|
+
current.set(id, { path: file.relativePath, bytes: file.size, key, startedAt: iso() });
|
|
366
|
+
// Forced: the file going in is the line the page leads with.
|
|
367
|
+
set(file, "uploading", true);
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
/** `SweepDeps.onResult` — a file reached its outcome. */
|
|
371
|
+
result(file, result) {
|
|
372
|
+
const { id } = sourceIdOf(file.accountId, file.relativePath);
|
|
373
|
+
const o2 = outcomeOf(id);
|
|
374
|
+
const at = iso();
|
|
375
|
+
o2.last = at;
|
|
376
|
+
if (current.get(id)?.path === file.relativePath)
|
|
377
|
+
current.delete(id);
|
|
378
|
+
if (result.outcome === "failed") {
|
|
379
|
+
add(o2.failed, file.size);
|
|
380
|
+
set(file, "failed");
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
o2[result.outcome]++;
|
|
384
|
+
add(o2.done, file.size);
|
|
385
|
+
set(file, "done");
|
|
386
|
+
}
|
|
387
|
+
journal({
|
|
388
|
+
at,
|
|
389
|
+
source: id,
|
|
390
|
+
account: file.accountId,
|
|
391
|
+
path: file.relativePath,
|
|
392
|
+
bytes: file.size,
|
|
393
|
+
outcome: result.outcome,
|
|
394
|
+
...("detail" in result && result.detail ? { detail: result.detail.slice(0, 400) } : {}),
|
|
395
|
+
...("itemId" in result && result.itemId ? { itemId: result.itemId } : {}),
|
|
396
|
+
});
|
|
397
|
+
},
|
|
398
|
+
/** The sweep is over — `error` when it stopped on one. Only the first call counts. */
|
|
399
|
+
finish(error) {
|
|
400
|
+
if (sweep.finishedAt)
|
|
401
|
+
return;
|
|
402
|
+
sweep.phase = "done";
|
|
403
|
+
sweep.finishedAt = iso();
|
|
404
|
+
sweep.state = error ? "failed" : "finished";
|
|
405
|
+
if (error)
|
|
406
|
+
sweep.error = error.slice(0, 600);
|
|
407
|
+
current.clear();
|
|
408
|
+
if (walked)
|
|
409
|
+
writeQueue();
|
|
410
|
+
writeProgress(true);
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
return {
|
|
414
|
+
walking: guarded("progress", hooks.walking),
|
|
415
|
+
unreachable: guarded("progress", hooks.unreachable),
|
|
416
|
+
found: guarded("progress", hooks.found),
|
|
417
|
+
progress: { waiting: guarded("progress", hooks.progress.waiting), uploading: guarded("progress", hooks.progress.uploading) },
|
|
418
|
+
result: guarded("file journal", hooks.result),
|
|
419
|
+
finish: guarded("progress", hooks.finish),
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
export function readProgress(path) {
|
|
423
|
+
try {
|
|
424
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
425
|
+
return raw && raw.v === PROGRESS_VERSION && Array.isArray(raw.sources) ? raw : null;
|
|
426
|
+
}
|
|
427
|
+
catch {
|
|
428
|
+
return null;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* should not stall uploading the rest of the in progress uploads"* — and it generalizes: a
|
|
32
32
|
* dropzone with one unreadable file in it must still drain the other 4,000.
|
|
33
33
|
*/
|
|
34
|
+
import type { IngestReporter, ReportResult } from "./report.js";
|
|
34
35
|
/** A file the sweep found, with everything a handler needs to decide about it. */
|
|
35
36
|
export interface DroppedFile {
|
|
36
37
|
/** Absolute path on disk. */
|
|
@@ -99,7 +100,7 @@ export interface ScanOptions {
|
|
|
99
100
|
*
|
|
100
101
|
* 🔴 Load-bearing for sidecar art, and it cannot be done later. A folder's `cover.jpg` is
|
|
101
102
|
* only reachable while the directory still exists, and filing the audio out of it removes
|
|
102
|
-
* the
|
|
103
|
+
* the neighbors — by the time anything else could look, they are gone. Capturing on the
|
|
103
104
|
* walk also costs one `readdir` per directory instead of one per file, which on a 6,000
|
|
104
105
|
* track library is the difference between seconds and minutes.
|
|
105
106
|
*/
|
|
@@ -149,8 +150,20 @@ export declare function isStable(file: DroppedFile, stabilityMs?: number): Promi
|
|
|
149
150
|
* files that must survive.
|
|
150
151
|
*/
|
|
151
152
|
export declare function pruneEmptyDirs(root: string, dir?: string): Promise<number>;
|
|
152
|
-
/**
|
|
153
|
-
|
|
153
|
+
/**
|
|
154
|
+
* What the app supplies: what to do with one file. `uploading(key)` names the binary-server key its
|
|
155
|
+
* bytes stage under, once the handler knows it — station's Uploads page shows that transfer's own
|
|
156
|
+
* progress on the file's row.
|
|
157
|
+
*/
|
|
158
|
+
export type DropHandler = (file: DroppedFile, ctx: {
|
|
159
|
+
uploading(key: string): void;
|
|
160
|
+
}) => Promise<DropOutcome>;
|
|
161
|
+
/**
|
|
162
|
+
* A sweep's outcome in the words station's Uploads page reads (`report.ts`) — `null` for `held`, which
|
|
163
|
+
* is a standing state rather than an event: the file stays where it is and every sweep meets it
|
|
164
|
+
* again, so it is shown as left alone (`skipped`) instead of journaled every five minutes.
|
|
165
|
+
*/
|
|
166
|
+
export declare function reportResultOf(outcome: DropOutcome): ReportResult | null;
|
|
154
167
|
/**
|
|
155
168
|
* Walk a dropzone, hand every file to `handle`, and leave nothing behind that was dealt with.
|
|
156
169
|
*
|
|
@@ -161,6 +174,12 @@ export type DropHandler = (file: DroppedFile) => Promise<DropOutcome>;
|
|
|
161
174
|
export declare function sweepDropzone(root: string, handle: DropHandler, opts?: ScanOptions & {
|
|
162
175
|
dryRun?: boolean;
|
|
163
176
|
onProgress?: (done: number, total: number) => void;
|
|
177
|
+
/**
|
|
178
|
+
* Write what the sweep is doing for station's Uploads page (`createIngestReporter`). The dropzone
|
|
179
|
+
* is ONE account, id `""`: each top-level folder is a source, loose files one more. Never on a
|
|
180
|
+
* dry run, which files nothing. Every hook is guarded — a reporter fault never costs a file.
|
|
181
|
+
*/
|
|
182
|
+
report?: IngestReporter;
|
|
164
183
|
}): Promise<SweepReport>;
|
|
165
184
|
/** A one-line summary — every consumer prints one, and they should read alike. */
|
|
166
185
|
export declare const describeSweep: (report: SweepReport) => string;
|
|
@@ -185,6 +185,27 @@ export async function pruneEmptyDirs(root, dir = root) {
|
|
|
185
185
|
return removed; // not empty — the right outcome, and not an error
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* A sweep's outcome in the words station's Uploads page reads (`report.ts`) — `null` for `held`, which
|
|
190
|
+
* is a standing state rather than an event: the file stays where it is and every sweep meets it
|
|
191
|
+
* again, so it is shown as left alone (`skipped`) instead of journaled every five minutes.
|
|
192
|
+
*/
|
|
193
|
+
export function reportResultOf(outcome) {
|
|
194
|
+
const detail = outcome.detail ? { detail: outcome.detail } : {};
|
|
195
|
+
switch (outcome.kind) {
|
|
196
|
+
case "stored":
|
|
197
|
+
return { outcome: "added", ...detail };
|
|
198
|
+
case "duplicate":
|
|
199
|
+
return { outcome: "duplicate", ...detail };
|
|
200
|
+
// Refused by the app's own rule (a format it does not take) — not filed, and not a failure.
|
|
201
|
+
case "discard":
|
|
202
|
+
return { outcome: "blocked", detail: outcome.detail ?? "not something this app files" };
|
|
203
|
+
case "held":
|
|
204
|
+
return null;
|
|
205
|
+
case "failed":
|
|
206
|
+
return { outcome: "failed", detail: outcome.detail };
|
|
207
|
+
}
|
|
208
|
+
}
|
|
188
209
|
/**
|
|
189
210
|
* Walk a dropzone, hand every file to `handle`, and leave nothing behind that was dealt with.
|
|
190
211
|
*
|
|
@@ -193,6 +214,19 @@ export async function pruneEmptyDirs(root, dir = root) {
|
|
|
193
214
|
* silently. A handler says what happened; this decides what that means for the file on disk.
|
|
194
215
|
*/
|
|
195
216
|
export async function sweepDropzone(root, handle, opts = {}) {
|
|
217
|
+
const reporter = opts.dryRun ? undefined : opts.report;
|
|
218
|
+
try {
|
|
219
|
+
const report = await sweep(root, handle, opts, reporter);
|
|
220
|
+
reporter?.finish();
|
|
221
|
+
return report;
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
reporter?.finish(error instanceof Error ? error.message : String(error));
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async function sweep(root, handle, opts, reporter) {
|
|
229
|
+
const as = (file) => ({ accountId: "", path: file.path, relativePath: file.relativePath, size: file.size });
|
|
196
230
|
const report = {
|
|
197
231
|
scanned: 0,
|
|
198
232
|
stored: 0,
|
|
@@ -205,17 +239,23 @@ export async function sweepDropzone(root, handle, opts = {}) {
|
|
|
205
239
|
emptyDirsRemoved: 0,
|
|
206
240
|
remaining: 0,
|
|
207
241
|
};
|
|
242
|
+
reporter?.walking();
|
|
208
243
|
const files = await scanDropzone(root, opts);
|
|
244
|
+
reporter?.found(files.map(as));
|
|
209
245
|
for (const [index, file] of files.entries()) {
|
|
210
246
|
report.scanned++;
|
|
211
247
|
opts.onProgress?.(index + 1, files.length);
|
|
212
248
|
if (!(await isStable(file, opts.stabilityMs))) {
|
|
213
249
|
report.unstable.push(file.relativePath);
|
|
250
|
+
reporter?.progress.waiting(as(file), "copying");
|
|
214
251
|
continue;
|
|
215
252
|
}
|
|
216
253
|
let outcome;
|
|
254
|
+
reporter?.progress.uploading(as(file), "");
|
|
217
255
|
try {
|
|
218
|
-
outcome = opts.dryRun
|
|
256
|
+
outcome = opts.dryRun
|
|
257
|
+
? { kind: "held", detail: "dry run" }
|
|
258
|
+
: await handle(file, { uploading: (key) => reporter?.progress.uploading(as(file), key) });
|
|
219
259
|
}
|
|
220
260
|
catch (error) {
|
|
221
261
|
// Rule 3: a handler that throws costs one file, never the sweep.
|
|
@@ -224,6 +264,11 @@ export async function sweepDropzone(root, handle, opts = {}) {
|
|
|
224
264
|
detail: error instanceof Error ? error.message : String(error),
|
|
225
265
|
};
|
|
226
266
|
}
|
|
267
|
+
const result = reportResultOf(outcome);
|
|
268
|
+
if (result)
|
|
269
|
+
reporter?.result(as(file), result);
|
|
270
|
+
else
|
|
271
|
+
reporter?.progress.waiting(as(file), "skipped");
|
|
227
272
|
switch (outcome.kind) {
|
|
228
273
|
case "stored":
|
|
229
274
|
case "duplicate":
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `policy.ts` holds the three privacy rules that make it safe to run USER-KEYED analytics
|
|
8
8
|
* inside private household apps, and four copies of a privacy promise is four promises, with
|
|
9
9
|
* nothing keeping them the same — three of the twelve files had already forked (in `music`,
|
|
10
|
-
* doc comments only; the
|
|
10
|
+
* doc comments only; the behavior was identical in all four, so the plurality's text is what
|
|
11
11
|
* came across). The browser half — the beacon — is React and lives in the design system's tier;
|
|
12
12
|
* it depends on nothing here but the wire shape `POST <mount>/view {place}`.
|
|
13
13
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `policy.ts` holds the three privacy rules that make it safe to run USER-KEYED analytics
|
|
8
8
|
* inside private household apps, and four copies of a privacy promise is four promises, with
|
|
9
9
|
* nothing keeping them the same — three of the twelve files had already forked (in `music`,
|
|
10
|
-
* doc comments only; the
|
|
10
|
+
* doc comments only; the behavior was identical in all four, so the plurality's text is what
|
|
11
11
|
* came across). The browser half — the beacon — is React and lives in the design system's tier;
|
|
12
12
|
* it depends on nothing here but the wire shape `POST <mount>/view {place}`.
|
|
13
13
|
*
|
|
@@ -66,7 +66,7 @@ export const argon2idDeriverFrom = (binding) => {
|
|
|
66
66
|
// 0x10 and 0x13 ARE the Argon2 version identifiers: the spec, the reference
|
|
67
67
|
// implementation and every envelope on disk write them in hex. Biome's autofix
|
|
68
68
|
// rewrites them as 16 and 19 — the same map and a worse one, because nobody
|
|
69
|
-
// reading an `$argon2id$v=19$` record would
|
|
69
|
+
// reading an `$argon2id$v=19$` record would recognize the decimal.
|
|
70
70
|
// biome-ignore lint/complexity/useSimpleNumberKeys: see above — hex IS the spec's spelling
|
|
71
71
|
const NODE_RS_VERSION = { 0x10: 0, 0x13: 1 };
|
|
72
72
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The SHIPPED KDF worker entry (05 §B6).
|
|
3
3
|
*
|
|
4
|
-
* Unlike a
|
|
5
|
-
* because every
|
|
4
|
+
* Unlike a marshaling worker — where every marshaler declares its own entry
|
|
5
|
+
* because every marshaler has its own schema — there is exactly ONE password
|
|
6
6
|
* KDF in the platform (Law #7), so there is exactly one entry and the framework
|
|
7
7
|
* ships it. A host does not write this file; it points
|
|
8
8
|
* `createKdfWorkerPasswordVerifier({ entry: kdfWorkerEntryUrl() })` at it.
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* something is new.
|
|
30
30
|
* - {@link runIncidentSweep} — runs checks; a check that THROWS resolves
|
|
31
31
|
* nothing, so a broken detector can never announce that an outage is over.
|
|
32
|
-
* - channels — in-app (the fleet's existing notification
|
|
32
|
+
* - channels — in-app (the fleet's existing notification center), email, and a
|
|
33
33
|
* text message from this Mac that reads `chat.db` back to prove it left.
|
|
34
34
|
* - {@link createIncidentNotifier} — composes the three-sentence message and
|
|
35
35
|
* sends it on OPEN, on ESCALATE and on RESOLVE. Never on an observation.
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* something is new.
|
|
30
30
|
* - {@link runIncidentSweep} — runs checks; a check that THROWS resolves
|
|
31
31
|
* nothing, so a broken detector can never announce that an outage is over.
|
|
32
|
-
* - channels — in-app (the fleet's existing notification
|
|
32
|
+
* - channels — in-app (the fleet's existing notification center), email, and a
|
|
33
33
|
* text message from this Mac that reads `chat.db` back to prove it left.
|
|
34
34
|
* - {@link createIncidentNotifier} — composes the three-sentence message and
|
|
35
35
|
* sends it on OPEN, on ESCALATE and on RESOLVE. Never on an observation.
|
|
@@ -34,7 +34,7 @@ import { type Incident, type IncidentReport, type IncidentTransitions } from "./
|
|
|
34
34
|
* bytes free, items failed, commits behind — and a string slipping in there is
|
|
35
35
|
* how a file name reaches an SMS. See the header of `types.ts`.
|
|
36
36
|
*
|
|
37
|
-
* It throws rather than
|
|
37
|
+
* It throws rather than sanitizing, because a detector author meets the failure
|
|
38
38
|
* in their own test run, which is the only moment the mistake is cheap.
|
|
39
39
|
*/
|
|
40
40
|
export declare function assertNoContent(report: IncidentReport): void;
|
|
@@ -28,7 +28,7 @@ const toIncident = (r) => ({
|
|
|
28
28
|
* bytes free, items failed, commits behind — and a string slipping in there is
|
|
29
29
|
* how a file name reaches an SMS. See the header of `types.ts`.
|
|
30
30
|
*
|
|
31
|
-
* It throws rather than
|
|
31
|
+
* It throws rather than sanitizing, because a detector author meets the failure
|
|
32
32
|
* in their own test run, which is the only moment the mistake is cheap.
|
|
33
33
|
*/
|
|
34
34
|
export function assertNoContent(report) {
|
|
@@ -15,7 +15,7 @@ export declare class JobTimeoutError extends Error {
|
|
|
15
15
|
* Resolve/reject with `promise`, but reject with a {@link JobTimeoutError} if it
|
|
16
16
|
* has not settled within `timeoutMs`. `onTimeout` fires on timeout — the runner
|
|
17
17
|
* uses it to abort the handler's context signal so a cooperative handler can
|
|
18
|
-
* short-circuit (a pending promise cannot be force-
|
|
18
|
+
* short-circuit (a pending promise cannot be force-canceled).
|
|
19
19
|
*
|
|
20
20
|
* Order matters: the timeout promise is rejected BEFORE `onTimeout` runs. Aborting
|
|
21
21
|
* the signal can synchronously resolve a cooperative handler; if that resolution
|