cursedbelt-server 4.48.0 → 4.48.1
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/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/scan.d.ts +1 -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 +1 -1
- 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/scan.spec.ts +2 -2
- package/src/server/dropzone/scan.ts +1 -1
- 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
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* ── 🔴 Four properties this file exists to guarantee ────────────────────────
|
|
22
|
-
* 1. **Append only.** No update verb, no delete verb, no `TRUNCATE`.
|
|
22
|
+
* 1. **Append only.** No update verb, no delete verb, no `TRUNCATE`. Aging
|
|
23
23
|
* rows out is the fleet retention standard's job, through a declaration the
|
|
24
24
|
* owner can see (`satellite-kit/retention`) — never a silent cutoff here.
|
|
25
25
|
* 2. **A source is READ, never copied.** `share_events` stays the canonical
|
|
@@ -39,7 +39,7 @@ export interface InjectedScript {
|
|
|
39
39
|
* Every `<script src=…>` in `html` whose origin is NOT `pageUrl`'s.
|
|
40
40
|
*
|
|
41
41
|
* Inline scripts are ignored: they are the page's own (most shells here ship one, a pre-paint
|
|
42
|
-
*
|
|
42
|
+
* color-scheme script) and a CSP that refuses them is a different finding from this one.
|
|
43
43
|
* `data:` and `blob:` are ignored for the same reason — neither is a host anything could have
|
|
44
44
|
* injected.
|
|
45
45
|
*/
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* Every `<script src=…>` in `html` whose origin is NOT `pageUrl`'s.
|
|
33
33
|
*
|
|
34
34
|
* Inline scripts are ignored: they are the page's own (most shells here ship one, a pre-paint
|
|
35
|
-
*
|
|
35
|
+
* color-scheme script) and a CSP that refuses them is a different finding from this one.
|
|
36
36
|
* `data:` and `blob:` are ignored for the same reason — neither is a host anything could have
|
|
37
37
|
* injected.
|
|
38
38
|
*/
|
|
@@ -120,7 +120,7 @@ export declare const WEB_ANALYTICS_PUBLIC_HOST = "cursedalchemy.com";
|
|
|
120
120
|
*
|
|
121
121
|
* A device in GET-only mode (`cursedbelt-core/ctgr-client`) sits behind something that drops
|
|
122
122
|
* every non-GET, and the beacon reports with a POST to the page's `/cdn-cgi/rum`. It cannot be
|
|
123
|
-
*
|
|
123
|
+
* tunneled the way our own API is — the script is Cloudflare's — so there it only ever failed,
|
|
124
124
|
* a red line per page view, and recorded nothing. Not loading it loses no data (2026-10-08).
|
|
125
125
|
*
|
|
126
126
|
* The guard reads the URL as well as `localStorage.ctgr`: this script runs before the app's
|
|
@@ -127,7 +127,7 @@ export const WEB_ANALYTICS_PUBLIC_HOST = "cursedalchemy.com";
|
|
|
127
127
|
*
|
|
128
128
|
* A device in GET-only mode (`cursedbelt-core/ctgr-client`) sits behind something that drops
|
|
129
129
|
* every non-GET, and the beacon reports with a POST to the page's `/cdn-cgi/rum`. It cannot be
|
|
130
|
-
*
|
|
130
|
+
* tunneled the way our own API is — the script is Cloudflare's — so there it only ever failed,
|
|
131
131
|
* a red line per page view, and recorded nothing. Not loading it loses no data (2026-10-08).
|
|
132
132
|
*
|
|
133
133
|
* The guard reads the URL as well as `localStorage.ctgr`: this script runs before the app's
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* spread across N isolates gets N × the global allowance the header calls "the actual defense".
|
|
12
12
|
*
|
|
13
13
|
* A Durable Object is the exact shape of the fix: one instance addressed by name, requests to it
|
|
14
|
-
*
|
|
14
|
+
* serialized, so every isolate in every colo meets the same counts. It runs the SAME
|
|
15
15
|
* `createLoginThrottle` algorithm — nothing here re-decides a threshold or a delay — and persists
|
|
16
16
|
* the ledger to the object's storage after every change, so the object's own eviction (minutes
|
|
17
17
|
* idle, measured on patterns' live object) forgets nothing either.
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* The throttle is checked BEFORE argon2, on every attempt, and the point of checking first is
|
|
21
21
|
* that a refused attempt is cheap. A D1 read-modify-write per attempt is a query against the
|
|
22
22
|
* invocation's 1,000-query budget and, worse, not atomic across concurrent invocations: two
|
|
23
|
-
* guesses that snapshot the same count both write count+1. The object
|
|
23
|
+
* guesses that snapshot the same count both write count+1. The object serializes for free.
|
|
24
24
|
*
|
|
25
25
|
* ── `attempt` is one operation, not two ─────────────────────────────────────
|
|
26
|
-
* `/throttle/attempt` checks and charges in one
|
|
26
|
+
* `/throttle/attempt` checks and charges in one serialized step, so a burst of concurrent guesses
|
|
27
27
|
* is admitted only up to the threshold rather than all at once against one stale count. See
|
|
28
28
|
* `loginThrottle.ts`'s `attempt` section.
|
|
29
29
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* spread across N isolates gets N × the global allowance the header calls "the actual defense".
|
|
12
12
|
*
|
|
13
13
|
* A Durable Object is the exact shape of the fix: one instance addressed by name, requests to it
|
|
14
|
-
*
|
|
14
|
+
* serialized, so every isolate in every colo meets the same counts. It runs the SAME
|
|
15
15
|
* `createLoginThrottle` algorithm — nothing here re-decides a threshold or a delay — and persists
|
|
16
16
|
* the ledger to the object's storage after every change, so the object's own eviction (minutes
|
|
17
17
|
* idle, measured on patterns' live object) forgets nothing either.
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
* The throttle is checked BEFORE argon2, on every attempt, and the point of checking first is
|
|
21
21
|
* that a refused attempt is cheap. A D1 read-modify-write per attempt is a query against the
|
|
22
22
|
* invocation's 1,000-query budget and, worse, not atomic across concurrent invocations: two
|
|
23
|
-
* guesses that snapshot the same count both write count+1. The object
|
|
23
|
+
* guesses that snapshot the same count both write count+1. The object serializes for free.
|
|
24
24
|
*
|
|
25
25
|
* ── `attempt` is one operation, not two ─────────────────────────────────────
|
|
26
|
-
* `/throttle/attempt` checks and charges in one
|
|
26
|
+
* `/throttle/attempt` checks and charges in one serialized step, so a burst of concurrent guesses
|
|
27
27
|
* is admitted only up to the threshold rather than all at once against one stale count. See
|
|
28
28
|
* `loginThrottle.ts`'s `attempt` section.
|
|
29
29
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* production cost 52.85 s
|
|
15
15
|
* test cost 7.32 s
|
|
16
16
|
*
|
|
17
|
-
* Eighty-six
|
|
17
|
+
* Eighty-six percent of what was, that morning, the largest single workspace in
|
|
18
18
|
* `verify:scoped` — paid by every agent on every branch touching auth or any shared
|
|
19
19
|
* package, and again on every union gate.
|
|
20
20
|
*
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* ── One object per payload ───────────────────────────────────────────────────
|
|
20
20
|
* Addressed by `ctgr:<_cid>` (a `crypto.randomUUID()` the client mints per request), so the
|
|
21
|
-
* chunks of one request are
|
|
21
|
+
* chunks of one request are serialized through one object and different requests never
|
|
22
22
|
* contend. The partial lives in the object's memory: chunks arrive milliseconds apart, the idle
|
|
23
23
|
* TTL is 30 s, and an object is only evicted after minutes idle — a partial it loses is one a
|
|
24
24
|
* deploy would have lost too. An object holding nothing costs nothing.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* ── One object per payload ───────────────────────────────────────────────────
|
|
20
20
|
* Addressed by `ctgr:<_cid>` (a `crypto.randomUUID()` the client mints per request), so the
|
|
21
|
-
* chunks of one request are
|
|
21
|
+
* chunks of one request are serialized through one object and different requests never
|
|
22
22
|
* contend. The partial lives in the object's memory: chunks arrive milliseconds apart, the idle
|
|
23
23
|
* TTL is 30 s, and an object is only evicted after minutes idle — a partial it loses is one a
|
|
24
24
|
* deploy would have lost too. An object holding nothing costs nothing.
|
|
@@ -63,7 +63,7 @@ export interface TimeTravelOpts {
|
|
|
63
63
|
/**
|
|
64
64
|
* The D1 implementation: record the coordinate, because retention is automatic.
|
|
65
65
|
*
|
|
66
|
-
* 🔴 It reports `needsPeriodicCapture: false`, and a scheduler must
|
|
66
|
+
* 🔴 It reports `needsPeriodicCapture: false`, and a scheduler must honor that rather
|
|
67
67
|
* than calling `capture()` on a timer — a nightly no-op job that logs "backup complete"
|
|
68
68
|
* is worse than no job, because it reads as evidence.
|
|
69
69
|
*/
|
package/dist/server/d1/backup.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
/**
|
|
37
37
|
* The D1 implementation: record the coordinate, because retention is automatic.
|
|
38
38
|
*
|
|
39
|
-
* 🔴 It reports `needsPeriodicCapture: false`, and a scheduler must
|
|
39
|
+
* 🔴 It reports `needsPeriodicCapture: false`, and a scheduler must honor that rather
|
|
40
40
|
* than calling `capture()` on a timer — a nightly no-op job that logs "backup complete"
|
|
41
41
|
* is worse than no job, because it reads as evidence.
|
|
42
42
|
*/
|
package/dist/server/d1/http.d.ts
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* the only other door into D1 was a per-app bearer route on the Worker for each one.
|
|
11
11
|
*
|
|
12
12
|
* So the Mac gets the same {@link D1LikeDatabase} a Worker holds, pointed at the same
|
|
13
|
-
* database, and the app's own
|
|
13
|
+
* database, and the app's own catalog code runs unchanged against production — ONE writer
|
|
14
14
|
* of the rows, one schema, one set of statements.
|
|
15
15
|
*
|
|
16
16
|
* ── How ──────────────────────────────────────────────────────────────────────────────────
|
|
17
17
|
* It is a {@link D1BindingLike} over `POST /accounts/:account/d1/database/:db/query` (and
|
|
18
|
-
* `/raw`), handed to {@link createRemoteD1} — so every value
|
|
18
|
+
* `/raw`), handed to {@link createRemoteD1} — so every value normalization, limit check and
|
|
19
19
|
* `success: false` guard is the binding driver's own, not a second copy that could drift.
|
|
20
20
|
* `batch()` sends `{ batch: [...] }`, which D1 runs as one unit exactly as a binding's batch
|
|
21
21
|
* does: measured 2026-09-23 on a throwaway database, a batch whose second statement violated
|
package/dist/server/d1/http.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* the only other door into D1 was a per-app bearer route on the Worker for each one.
|
|
11
11
|
*
|
|
12
12
|
* So the Mac gets the same {@link D1LikeDatabase} a Worker holds, pointed at the same
|
|
13
|
-
* database, and the app's own
|
|
13
|
+
* database, and the app's own catalog code runs unchanged against production — ONE writer
|
|
14
14
|
* of the rows, one schema, one set of statements.
|
|
15
15
|
*
|
|
16
16
|
* ── How ──────────────────────────────────────────────────────────────────────────────────
|
|
17
17
|
* It is a {@link D1BindingLike} over `POST /accounts/:account/d1/database/:db/query` (and
|
|
18
|
-
* `/raw`), handed to {@link createRemoteD1} — so every value
|
|
18
|
+
* `/raw`), handed to {@link createRemoteD1} — so every value normalization, limit check and
|
|
19
19
|
* `success: false` guard is the binding driver's own, not a second copy that could drift.
|
|
20
20
|
* `batch()` sends `{ batch: [...] }`, which D1 runs as one unit exactly as a binding's batch
|
|
21
21
|
* does: measured 2026-09-23 on a throwaway database, a batch whose second statement violated
|
|
@@ -135,7 +135,7 @@ export function perInvocation(db, opts = {}) {
|
|
|
135
135
|
throw new RangeError(`max must be a positive integer, got ${max}`);
|
|
136
136
|
}
|
|
137
137
|
if (max > LIMITS.queriesPerInvocation) {
|
|
138
|
-
throw new D1LimitError('queries per Worker invocation', max, LIMITS.queriesPerInvocation, 'A budget above D1\'s own cap cannot be
|
|
138
|
+
throw new D1LimitError('queries per Worker invocation', max, LIMITS.queriesPerInvocation, 'A budget above D1\'s own cap cannot be honored — the service refuses first. Lower it, or split the work across invocations.');
|
|
139
139
|
}
|
|
140
140
|
const budget = new Budget(max);
|
|
141
141
|
return {
|
|
@@ -93,7 +93,7 @@ export declare function chunkForBind<T>(items: readonly T[], paramsPerItem: numb
|
|
|
93
93
|
* `WHERE … ORDER BY … LIMIT ? OFFSET ?` page and the `COUNT(*)` beside it), and on a write
|
|
94
94
|
* it trades one atomic statement for a batch that is atomic only per chunk. `json_each`
|
|
95
95
|
* over a JSON array is one parameter however long the list is, keeps the statement whole,
|
|
96
|
-
* and SQLite still drives the column's index through the
|
|
96
|
+
* and SQLite still drives the column's index through the materialized set.
|
|
97
97
|
*
|
|
98
98
|
* The array travels as one TEXT value, so the ceiling moves from 100 ids to
|
|
99
99
|
* `LIMITS.valueBytes` (2 MB) of JSON — about 70,000 of this fleet's 25-character ids — and
|
package/dist/server/d1/limits.js
CHANGED
|
@@ -203,7 +203,7 @@ export function chunkForBind(items, paramsPerItem) {
|
|
|
203
203
|
* `WHERE … ORDER BY … LIMIT ? OFFSET ?` page and the `COUNT(*)` beside it), and on a write
|
|
204
204
|
* it trades one atomic statement for a batch that is atomic only per chunk. `json_each`
|
|
205
205
|
* over a JSON array is one parameter however long the list is, keeps the statement whole,
|
|
206
|
-
* and SQLite still drives the column's index through the
|
|
206
|
+
* and SQLite still drives the column's index through the materialized set.
|
|
207
207
|
*
|
|
208
208
|
* The array travels as one TEXT value, so the ceiling moves from 100 ids to
|
|
209
209
|
* `LIMITS.valueBytes` (2 MB) of JSON — about 70,000 of this fleet's 25-character ids — and
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* a 6-field expression with a leading seconds column, and this repo already contains three
|
|
32
32
|
* jobs declared `'* * * * * *'` — once per second. Those cannot become Cron Triggers at
|
|
33
33
|
* all, and {@link classifySchedule} says so by name instead of silently rounding them up to
|
|
34
|
-
* a minute, which would change
|
|
34
|
+
* a minute, which would change behavior in production and nowhere else.
|
|
35
35
|
*/
|
|
36
36
|
import type { D1LikeDatabase } from './types.js';
|
|
37
37
|
/** The Workers primitive a piece of scheduled work maps onto. */
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* a 6-field expression with a leading seconds column, and this repo already contains three
|
|
32
32
|
* jobs declared `'* * * * * *'` — once per second. Those cannot become Cron Triggers at
|
|
33
33
|
* all, and {@link classifySchedule} says so by name instead of silently rounding them up to
|
|
34
|
-
* a minute, which would change
|
|
34
|
+
* a minute, which would change behavior in production and nowhere else.
|
|
35
35
|
*/
|
|
36
36
|
/** Cloudflare Queues: $0.40 per million operations, first million free each month. */
|
|
37
37
|
const QUEUE_USD_PER_MILLION = 0.4;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
*
|
|
41
41
|
* D1 has no interactive transaction — there is no `BEGIN`/`COMMIT` over HTTP, only
|
|
42
42
|
* {@link D1LikeDatabase.batch}, which is atomic and runs as one round trip. A local
|
|
43
|
-
* driver that happily
|
|
43
|
+
* driver that happily honored `BEGIN` would be the sync-vs-async trap a third time, so
|
|
44
44
|
* {@link D1UnsupportedError} is thrown by both. Wrap the statements in `batch()` instead;
|
|
45
45
|
* it is atomic on D1 and wrapped in a real `bun:sqlite` transaction locally, so the
|
|
46
46
|
* guarantee is the same.
|
package/dist/server/d1/types.js
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
*
|
|
41
41
|
* D1 has no interactive transaction — there is no `BEGIN`/`COMMIT` over HTTP, only
|
|
42
42
|
* {@link D1LikeDatabase.batch}, which is atomic and runs as one round trip. A local
|
|
43
|
-
* driver that happily
|
|
43
|
+
* driver that happily honored `BEGIN` would be the sync-vs-async trap a third time, so
|
|
44
44
|
* {@link D1UnsupportedError} is thrown by both. Wrap the statements in `batch()` instead;
|
|
45
45
|
* it is atomic on D1 and wrapped in a real `bun:sqlite` transaction locally, so the
|
|
46
46
|
* guarantee is the same.
|
|
@@ -36,7 +36,7 @@ export declare const normalizeBinds: (values: readonly unknown[]) => D1LikeBinda
|
|
|
36
36
|
* Only a leading `SELECT` is claimed, because that is the one keyword that is
|
|
37
37
|
* unambiguous: `WITH … INSERT … RETURNING` and `INSERT … RETURNING` both return rows AND
|
|
38
38
|
* write. Anything this returns `false` for is measured exactly instead (see
|
|
39
|
-
* `local.ts`), so a statement shape this does not
|
|
39
|
+
* `local.ts`), so a statement shape this does not recognize costs two extra queries —
|
|
40
40
|
* never a wrong number.
|
|
41
41
|
*/
|
|
42
42
|
export declare const isPureReadSql: (sql: string) => boolean;
|
package/dist/server/d1/values.js
CHANGED
|
@@ -84,7 +84,7 @@ const LEADING_NOISE = /^(?:\s|--[^\n]*\n?|\/\*[\s\S]*?\*\/)+/;
|
|
|
84
84
|
* Only a leading `SELECT` is claimed, because that is the one keyword that is
|
|
85
85
|
* unambiguous: `WITH … INSERT … RETURNING` and `INSERT … RETURNING` both return rows AND
|
|
86
86
|
* write. Anything this returns `false` for is measured exactly instead (see
|
|
87
|
-
* `local.ts`), so a statement shape this does not
|
|
87
|
+
* `local.ts`), so a statement shape this does not recognize costs two extra queries —
|
|
88
88
|
* never a wrong number.
|
|
89
89
|
*/
|
|
90
90
|
export const isPureReadSql = (sql) => /^select\b/i.test(sql.replace(LEADING_NOISE, ''));
|
|
@@ -99,7 +99,7 @@ export interface ScanOptions {
|
|
|
99
99
|
*
|
|
100
100
|
* 🔴 Load-bearing for sidecar art, and it cannot be done later. A folder's `cover.jpg` is
|
|
101
101
|
* only reachable while the directory still exists, and filing the audio out of it removes
|
|
102
|
-
* the
|
|
102
|
+
* the neighbors — by the time anything else could look, they are gone. Capturing on the
|
|
103
103
|
* walk also costs one `readdir` per directory instead of one per file, which on a 6,000
|
|
104
104
|
* track library is the difference between seconds and minutes.
|
|
105
105
|
*/
|
|
@@ -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
|
|
@@ -19,7 +19,7 @@ export class JobTimeoutError extends Error {
|
|
|
19
19
|
* Resolve/reject with `promise`, but reject with a {@link JobTimeoutError} if it
|
|
20
20
|
* has not settled within `timeoutMs`. `onTimeout` fires on timeout — the runner
|
|
21
21
|
* uses it to abort the handler's context signal so a cooperative handler can
|
|
22
|
-
* short-circuit (a pending promise cannot be force-
|
|
22
|
+
* short-circuit (a pending promise cannot be force-canceled).
|
|
23
23
|
*
|
|
24
24
|
* Order matters: the timeout promise is rejected BEFORE `onTimeout` runs. Aborting
|
|
25
25
|
* the signal can synchronously resolve a cooperative handler; if that resolution
|
|
@@ -18,7 +18,7 @@ export { MASTER_LOCK_MIN_PASSWORD_LENGTH } from "./lockPage.js";
|
|
|
18
18
|
* The document.
|
|
19
19
|
*
|
|
20
20
|
* It links the LOCK's stylesheet first and its own second, so the two pages share one set of
|
|
21
|
-
*
|
|
21
|
+
* color tokens and a change to the palette cannot land on only one of them.
|
|
22
22
|
*/
|
|
23
23
|
export declare function accountsPageHtml(options: LockPageOptions): string;
|
|
24
24
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* ── Why it is here and not in the app ───────────────────────────────────────
|
|
5
5
|
* `cursedbelt@2.5.1`'s React `MasterLockMenuItems` dialog minted a FRESH `kdf` salt on every
|
|
6
6
|
* rotation, which is what the wire looked like before accounts existed. Every account on an
|
|
7
|
-
* app now derives under ONE shared descriptor, so
|
|
7
|
+
* app now derives under ONE shared descriptor, so honoring that salt would store a verifier
|
|
8
8
|
* hash nothing could ever match: the owner sets a new password, the rotation logs him out,
|
|
9
9
|
* and neither the old nor the new one opens the app. `guard.ts` therefore answers that shape
|
|
10
10
|
* `409 {"error":"stale-client"}`. That is the safe failure; this page is the fix.
|
|
@@ -54,7 +54,7 @@ export { MASTER_LOCK_MIN_PASSWORD_LENGTH } from "./lockPage.js";
|
|
|
54
54
|
* The document.
|
|
55
55
|
*
|
|
56
56
|
* It links the LOCK's stylesheet first and its own second, so the two pages share one set of
|
|
57
|
-
*
|
|
57
|
+
* color tokens and a change to the palette cannot land on only one of them.
|
|
58
58
|
*/
|
|
59
59
|
export function accountsPageHtml(options) {
|
|
60
60
|
const label = escapeHtml(options.appLabel);
|
|
@@ -209,7 +209,7 @@ export function createMasterLockGuard(options) {
|
|
|
209
209
|
* owner would set a new password, be logged out by the rotation, and find that
|
|
210
210
|
* neither the old nor the new one opens the app.
|
|
211
211
|
*
|
|
212
|
-
* There is no safe way to
|
|
212
|
+
* There is no safe way to honor it either, since every account on this app shares
|
|
213
213
|
* one descriptor. So it is refused, loudly, with the one thing that distinguishes
|
|
214
214
|
* it from a wrong password.
|
|
215
215
|
*/
|
|
@@ -37,7 +37,7 @@ export declare function lockPageHtml(options: LockPageOptions): string;
|
|
|
37
37
|
export declare const LOCK_STYLE = ":root{color-scheme:light dark;\n --ml-bg:#f4f5f7;--ml-card:#ffffff;--ml-text:#14171c;--ml-muted:#69707c;--ml-border:#d9dde3;\n --ml-accent:#1f6feb;--ml-accent-text:#ffffff;--ml-danger:#b42318;\n --ml-shadow:0 18px 48px rgba(16,18,22,.14)}\n@media (prefers-color-scheme:dark){:root{\n --ml-bg:#0d0f13;--ml-card:#171a20;--ml-text:#e7eaef;--ml-muted:#8b93a1;--ml-border:#2b3039;\n --ml-accent:#4f8cf7;--ml-accent-text:#0b0d11;--ml-danger:#f97066;\n --ml-shadow:0 18px 48px rgba(0,0,0,.55)}}\n*{box-sizing:border-box}\nbody{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;\n background:var(--ml-bg);color:var(--ml-text);\n font:15px/1.55 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n.card{width:100%;max-width:23rem;background:var(--ml-card);border:1px solid var(--ml-border);\n border-radius:16px;padding:28px 26px 24px;box-shadow:var(--ml-shadow);text-align:center}\n.glyph{font-size:30px;line-height:1;margin-bottom:10px}\nh1{margin:0 0 6px;font-size:18px;font-weight:650;letter-spacing:-.01em}\n.note{margin:0 0 20px;font-size:13px;color:var(--ml-muted)}\n.field{display:block;text-align:left;margin-bottom:14px}\n.field span{display:block;font-size:12px;font-weight:600;color:var(--ml-muted);margin-bottom:6px}\ninput{width:100%;height:40px;padding:0 12px;border:1px solid var(--ml-border);border-radius:9px;\n background:var(--ml-bg);color:inherit;font:inherit;font-size:16px}\ninput:focus{outline:2px solid var(--ml-accent);outline-offset:1px;border-color:transparent}\nbutton{width:100%;height:40px;border:0;border-radius:9px;background:var(--ml-accent);\n color:var(--ml-accent-text);font:inherit;font-weight:600;cursor:pointer}\nbutton[disabled]{opacity:.6;cursor:progress}\n.status{margin:14px 0 0;min-height:1.2em;font-size:12.5px;color:var(--ml-muted)}\n.status[data-tone=\"error\"]{color:var(--ml-danger)}\n.field span em{font-style:normal;font-weight:500;text-transform:none;opacity:.7}\nbutton.quiet{margin-top:10px;height:32px;background:none;color:var(--ml-muted);font-weight:500;\n font-size:12.5px;text-decoration:underline;text-underline-offset:3px}\nbutton.quiet:hover{color:var(--ml-text)}\nbutton.quiet[disabled]{opacity:.5}\n.hints{margin:10px 0 0;padding:12px 14px;text-align:left;border:1px solid var(--ml-border);\n border-radius:10px;background:var(--ml-bg);font-size:12.5px}\n.hints dt{font-weight:650;color:var(--ml-text)}\n.hints dd{margin:2px 0 10px;color:var(--ml-muted);overflow-wrap:anywhere}\n.hints dd:last-child{margin-bottom:0}\n.secret{position:relative;display:block}\n.secret input{padding-right:48px}\n.secret .reveal{position:absolute;right:5px;top:50%;transform:translateY(-50%);width:36px;height:32px;\n display:grid;place-items:center;padding:0;border-radius:7px;background:none;color:var(--ml-muted)}\n.secret .reveal svg{width:18px;height:18px}\n.secret .reveal .eye-off,.secret .reveal[aria-pressed=\"true\"] .eye{display:none}\n.secret .reveal[aria-pressed=\"true\"] .eye-off{display:block}\n.secret .reveal:hover{color:var(--ml-text);background:var(--ml-card)}\n.secret .reveal:focus-visible{outline:2px solid var(--ml-accent);outline-offset:1px}\n";
|
|
38
38
|
export declare function withRevealToggles(html: string): string;
|
|
39
39
|
/**
|
|
40
|
-
* The toggle's
|
|
40
|
+
* The toggle's behavior, as browser source. It flips the input BEFORE it to `text` and back,
|
|
41
41
|
* keeps `aria-pressed`/`aria-label` true to what is on screen, and returns every field to
|
|
42
42
|
* `password` when its form submits — so a manager saving the credential sees a password field.
|
|
43
43
|
* Publishes itself on `globalThis`, the seam `lockPage.spec.ts` drives it through.
|
|
@@ -157,7 +157,7 @@ button.quiet[disabled]{opacity:.5}
|
|
|
157
157
|
*
|
|
158
158
|
* Markup: {@link withRevealToggles} wraps each `type="password"` input in `.secret` with a
|
|
159
159
|
* `<button type="button" data-reveal>` after it — the inputs keep every attribute, `autocomplete`
|
|
160
|
-
* included, so a password manager still sees a password field.
|
|
160
|
+
* included, so a password manager still sees a password field. Behavior:
|
|
161
161
|
* {@link MASTER_LOCK_REVEAL_SOURCE}, interpolated into BOTH same-origin scripts, because the wall's
|
|
162
162
|
* CSP is `script-src 'self'` and allows no inline script (`MASTER_LOCK_CSP`, pinned by
|
|
163
163
|
* `beaconNeverReachesTheWall.spec.ts`). Nothing about the CSP changes for this.
|
|
@@ -174,7 +174,7 @@ export function withRevealToggles(html) {
|
|
|
174
174
|
return html.replace(/(<input\b[^>]*\btype="password"[^>]*>)/g, `<span class="secret">$1<button type="button" class="reveal" data-reveal aria-label="Show password" aria-pressed="false">${EYE}${EYE_OFF}</button></span>`);
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
|
-
* The toggle's
|
|
177
|
+
* The toggle's behavior, as browser source. It flips the input BEFORE it to `text` and back,
|
|
178
178
|
* keeps `aria-pressed`/`aria-label` true to what is on screen, and returns every field to
|
|
179
179
|
* `password` when its form submits — so a manager saving the credential sees a password field.
|
|
180
180
|
* Publishes itself on `globalThis`, the seam `lockPage.spec.ts` drives it through.
|
|
@@ -286,7 +286,7 @@ export declare class MasterLock {
|
|
|
286
286
|
*
|
|
287
287
|
* `null` means "no live unlock is presented here", which is the only thing that may
|
|
288
288
|
* ever refuse a request. It deliberately does not fall back to {@link unlocked}: that
|
|
289
|
-
* reads "somebody's device is open", and
|
|
289
|
+
* reads "somebody's device is open", and honoring it would make the unlock AMBIENT —
|
|
290
290
|
* a second browser signed in as the owner would walk through having typed nothing, and
|
|
291
291
|
* would then be served whichever tenant happened to be open. While an app had one
|
|
292
292
|
* password that was merely sloppy; with several it hands the wrong library to the
|
|
@@ -325,7 +325,7 @@ export declare class MasterLock {
|
|
|
325
325
|
* answer's latency says nothing the answer itself does not.
|
|
326
326
|
*
|
|
327
327
|
* 🔴 **Every account is tried, and the loop does not stop at the first match.**
|
|
328
|
-
* Stopping early is the obvious
|
|
328
|
+
* Stopping early is the obvious optimization and it is a timing oracle: a password
|
|
329
329
|
* matching the first account would answer in one argon2id and a wrong one in N, so the
|
|
330
330
|
* shape of the reply would say how many tenants exist and roughly where in the list
|
|
331
331
|
* this one sits. The cost is bounded by how many passwords the owner has made — single
|
|
@@ -226,7 +226,7 @@ export class MasterLock {
|
|
|
226
226
|
*
|
|
227
227
|
* `null` means "no live unlock is presented here", which is the only thing that may
|
|
228
228
|
* ever refuse a request. It deliberately does not fall back to {@link unlocked}: that
|
|
229
|
-
* reads "somebody's device is open", and
|
|
229
|
+
* reads "somebody's device is open", and honoring it would make the unlock AMBIENT —
|
|
230
230
|
* a second browser signed in as the owner would walk through having typed nothing, and
|
|
231
231
|
* would then be served whichever tenant happened to be open. While an app had one
|
|
232
232
|
* password that was merely sloppy; with several it hands the wrong library to the
|
|
@@ -291,7 +291,7 @@ export class MasterLock {
|
|
|
291
291
|
* answer's latency says nothing the answer itself does not.
|
|
292
292
|
*
|
|
293
293
|
* 🔴 **Every account is tried, and the loop does not stop at the first match.**
|
|
294
|
-
* Stopping early is the obvious
|
|
294
|
+
* Stopping early is the obvious optimization and it is a timing oracle: a password
|
|
295
295
|
* matching the first account would answer in one argon2id and a wrong one in N, so the
|
|
296
296
|
* shape of the reply would say how many tenants exist and roughly where in the list
|
|
297
297
|
* this one sits. The cost is bounded by how many passwords the owner has made — single
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (e.g. `/api/v1/notes/:id`). The method is tracked separately.
|
|
4
4
|
*
|
|
5
5
|
* Two wrinkles, same as the old Express normalizer:
|
|
6
|
-
* 1. ctgr GET-
|
|
6
|
+
* 1. ctgr GET-tunneled mutations match the `/ctgr<xx>` twin route — we map them
|
|
7
7
|
* back to the real verb + path so a POST and its ctgr twin aggregate together.
|
|
8
8
|
* 2. Unmatched requests (404s, static, the SPA fallback) have no matched route
|
|
9
9
|
* pattern, so we collapse dynamic-looking segments to avoid unbounded
|
|
@@ -26,7 +26,7 @@ import { type MetricRow } from './metricsBuffer.js';
|
|
|
26
26
|
* run concurrently in many datacentres, so a `/metrics` scrape reaches ONE
|
|
27
27
|
* arbitrary isolate holding a random fraction of the counters. The in-process
|
|
28
28
|
* registry has nowhere to live. (A Durable Object does have a durable identity
|
|
29
|
-
* *and* memory, and is the real `prom-client`
|
|
29
|
+
* *and* memory, and is the real `prom-client` analog — but it is a whole
|
|
30
30
|
* stateful object to operate for counters Analytics Engine already aggregates.
|
|
31
31
|
* Prometheus itself also needs an always-on host to scrape FROM, and that host
|
|
32
32
|
* is the Mac this fleet is trying to switch off.)
|
|
@@ -44,7 +44,7 @@ import { type MetricRow } from './metricsBuffer.js';
|
|
|
44
44
|
* Worker supplies the real binding at runtime).
|
|
45
45
|
*
|
|
46
46
|
* Platform limits, which {@link toDataPoint} respects:
|
|
47
|
-
* **1** index of ≤96 bytes, ≤**20** blobs
|
|
47
|
+
* **1** index of ≤96 bytes, ≤**20** blobs totaling ≤5120 bytes, ≤**20** doubles.
|
|
48
48
|
*/
|
|
49
49
|
export interface AnalyticsEngineDataset {
|
|
50
50
|
writeDataPoint(point: {
|
|
@@ -34,7 +34,7 @@ function truncateUtf8(value, maxBytes) {
|
|
|
34
34
|
if (encoded.length <= maxBytes)
|
|
35
35
|
return value;
|
|
36
36
|
return new TextDecoder('utf-8', { fatal: false }).decode(encoded.subarray(0, maxBytes)).replace(
|
|
37
|
-
// A cut through a multi-byte sequence decodes to U+FFFD; drop that trailing
|
|
37
|
+
// A cut through a multi-byte sequence decodes to U+FFFD; drop that trailing artifact.
|
|
38
38
|
/�+$/, '');
|
|
39
39
|
}
|
|
40
40
|
const num = (value) => typeof value === 'number' && Number.isFinite(value) ? value : -1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { validationEnvelope } from '../errors.js';
|
|
2
2
|
/**
|
|
3
3
|
* Read the value a target validates against. The body targets (`json`/`form`) prefer
|
|
4
|
-
* the ctgr-decoded body so a
|
|
5
|
-
* URL-bound targets (`query`/`param`) are never
|
|
4
|
+
* the ctgr-decoded body so a tunneled mutation validates its real payload; the
|
|
5
|
+
* URL-bound targets (`query`/`param`) are never tunneled (GETs go direct) and read
|
|
6
6
|
* from the live request. A query object collapses single-valued keys to a string so
|
|
7
7
|
* `z.string()`/`z.coerce.number()` field schemas see a scalar (repeated keys stay an
|
|
8
8
|
* array) — matching Hono's own validator semantics.
|
|
@@ -25,7 +25,7 @@ export function createNotificationHub(options = {}) {
|
|
|
25
25
|
if (!set)
|
|
26
26
|
return;
|
|
27
27
|
// Snapshot: a listener may unsubscribe itself while being called (a
|
|
28
|
-
// stream that has just been
|
|
28
|
+
// stream that has just been canceled does exactly that).
|
|
29
29
|
for (const listener of [...set]) {
|
|
30
30
|
try {
|
|
31
31
|
listener(event);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ── Why it is here (4.21.0) ─────────────────────────────────────────────────
|
|
7
7
|
* `apps/family` and `apps/roms` held this module byte-identically (task 265's rollout), and
|
|
8
8
|
* `check-copies` counted it as five copy groups. The API, the header marker and the migration name
|
|
9
|
-
* are exactly the apps' — a live corpus is
|
|
9
|
+
* are exactly the apps' — a live corpus is recognized by `METRICS_APPLICATION_ID` and by the
|
|
10
10
|
* `0001_request_metrics` row in its migrations table, so changing either would make every
|
|
11
11
|
* existing `metrics.sqlite` look inherited and archive it. Bun-only (`bun:sqlite`, `node:fs`): under
|
|
12
12
|
* Node the export map routes this subpath to `_bunOnly.js`, the way `./engagement` does; it is NOT
|
|
@@ -85,7 +85,7 @@ export interface RequestMetricsOptions {
|
|
|
85
85
|
/**
|
|
86
86
|
* Place each request (`{ country, region?, city? }` or `null`) — never an address; the raw IP
|
|
87
87
|
* is not stored. Default: the edge's own answer, `locateFromCloudflare` (the `cf-ipcountry`
|
|
88
|
-
* header every
|
|
88
|
+
* header every tunneled request carries). station passes its DB-IP reader here.
|
|
89
89
|
*/
|
|
90
90
|
locate?: RequestLocator;
|
|
91
91
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ── Why it is here (4.21.0) ─────────────────────────────────────────────────
|
|
7
7
|
* `apps/family` and `apps/roms` held this module byte-identically (task 265's rollout), and
|
|
8
8
|
* `check-copies` counted it as five copy groups. The API, the header marker and the migration name
|
|
9
|
-
* are exactly the apps' — a live corpus is
|
|
9
|
+
* are exactly the apps' — a live corpus is recognized by `METRICS_APPLICATION_ID` and by the
|
|
10
10
|
* `0001_request_metrics` row in its migrations table, so changing either would make every
|
|
11
11
|
* existing `metrics.sqlite` look inherited and archive it. Bun-only (`bun:sqlite`, `node:fs`): under
|
|
12
12
|
* Node the export map routes this subpath to `_bunOnly.js`, the way `./engagement` does; it is NOT
|
|
@@ -129,7 +129,7 @@ export function retireInheritedCorpus(dir) {
|
|
|
129
129
|
const live = join(dir, METRICS_DB);
|
|
130
130
|
if (!existsSync(live))
|
|
131
131
|
return null;
|
|
132
|
-
// An empty file with no journal holds nothing — SQLite simply
|
|
132
|
+
// An empty file with no journal holds nothing — SQLite simply initializes it.
|
|
133
133
|
if (sizeOf(live) === 0 && SIDECARS.every((s) => sizeOf(live + s) === 0))
|
|
134
134
|
return null;
|
|
135
135
|
if (headerApplicationId(live) === METRICS_APPLICATION_ID)
|