@skyphusion-labs/vivijure-core 1.3.0 → 1.4.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/README.md +1 -1
- package/dist/storage-quota.d.ts +126 -1
- package/dist/storage-quota.d.ts.map +1 -1
- package/dist/storage-quota.js +228 -5
- package/dist/storage-quota.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ Tag push triggers **Publish npm package** (`.github/workflows/publish-npm.yml`).
|
|
|
99
99
|
| `@skyphusion-labs/vivijure-core/platform` | `Platform`, `orchestratorContextFromPlatform`, R2 shim |
|
|
100
100
|
| `@skyphusion-labs/vivijure-core/film-orchestrator` | Full film state machine |
|
|
101
101
|
| `@skyphusion-labs/vivijure-core/preflight` | Storyboard pre-render checks |
|
|
102
|
-
| `@skyphusion-labs/vivijure-core/storage-quota` | Storage accounting ledger + `R2_STORAGE_QUOTA_BYTES` ([docs](docs/STORAGE-QUOTA.md)) |
|
|
102
|
+
| `@skyphusion-labs/vivijure-core/storage-quota` | Storage accounting ledger + `R2_STORAGE_QUOTA_BYTES` / `R2_STORAGE_QUOTA_MODE` ([docs](docs/STORAGE-QUOTA.md)) |
|
|
103
103
|
|
|
104
104
|
Full subpath list: `package.json` `exports` field.
|
|
105
105
|
|
package/dist/storage-quota.d.ts
CHANGED
|
@@ -9,11 +9,42 @@ export interface StorageQuotaEnv {
|
|
|
9
9
|
DB?: Database;
|
|
10
10
|
/** Positive integer BYTES as a string; unset / 0 / garbage = quota off. */
|
|
11
11
|
R2_STORAGE_QUOTA_BYTES?: unknown;
|
|
12
|
+
/** "deny" (the default) or "meter"; unset / empty / unrecognised = "deny". See storageQuotaMode. */
|
|
13
|
+
R2_STORAGE_QUOTA_MODE?: unknown;
|
|
12
14
|
}
|
|
13
15
|
/** Pure: the configured ceiling in bytes, or null when the knob is off (unset / empty / 0 / garbage).
|
|
14
16
|
* Bytes only, deliberately: no "10GB" unit parsing, because a mis-parsed unit is an order-of-magnitude
|
|
15
17
|
* error on somebody's bill. The docs carry the worked examples. */
|
|
16
18
|
export declare function storageQuotaBytes(env: StorageQuotaEnv): number | null;
|
|
19
|
+
/**
|
|
20
|
+
* What the ceiling MEANS (cp#195).
|
|
21
|
+
*
|
|
22
|
+
* - `deny` -- the number is a HARD CEILING. Submit is refused at it, with the honest 507 and the
|
|
23
|
+
* real numbers. This is what core#52 shipped and it is the DEFAULT.
|
|
24
|
+
* - `meter` -- the number is an INCLUDED QUOTA. Nothing is refused; the studio surfaces
|
|
25
|
+
* used-vs-included and whoever is billing meters the overage.
|
|
26
|
+
*
|
|
27
|
+
* Both ship to hosted and self-host in the same release, for the same reason the quota itself did:
|
|
28
|
+
* an enforcement posture that exists only for hosted is the drift tripwire this feature was built to
|
|
29
|
+
* avoid. A self-hoster who wants an included-quota display without a hard stop gets the identical
|
|
30
|
+
* behaviour the hosted tier runs on.
|
|
31
|
+
*/
|
|
32
|
+
export type StorageQuotaMode = "deny" | "meter";
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the mode. Unset, empty, or ANY unrecognised value resolves to `deny`.
|
|
35
|
+
*
|
|
36
|
+
* NOTE THE ASYMMETRY WITH THE BYTES KNOB, which is deliberate and not an inconsistency to tidy up.
|
|
37
|
+
* For `R2_STORAGE_QUOTA_BYTES`, garbage means OFF: nobody set a ceiling, so there is no ceiling, and
|
|
38
|
+
* absent knob means absent behaviour. For the MODE, garbage cannot mean "no mode" -- a studio with a
|
|
39
|
+
* ceiling set still has to pick an enforcement posture -- so it means `deny`, the conservative side.
|
|
40
|
+
* Guessing `meter` on a typo would silently turn a hard stop into unmetered spend, which is the one
|
|
41
|
+
* direction that costs somebody money they did not agree to.
|
|
42
|
+
*
|
|
43
|
+
* An unrecognised value WARNS rather than throwing. Refusing to boot over a mode string would take a
|
|
44
|
+
* studio down for a typo whose safe interpretation is obvious; going quiet would leave an operator
|
|
45
|
+
* believing they configured metering. Loud and safe beats either.
|
|
46
|
+
*/
|
|
47
|
+
export declare function storageQuotaMode(env: StorageQuotaEnv): StorageQuotaMode;
|
|
17
48
|
/** Upsert one object's accounted size. Idempotent per key: a re-put of the same key overwrites its row,
|
|
18
49
|
* so repeated writes to a job doc never inflate the total. */
|
|
19
50
|
export declare function recordObjectWrite(db: Database, key: string, bytes: number): Promise<void>;
|
|
@@ -28,19 +59,113 @@ export declare function storageUsage(db: Database): Promise<{
|
|
|
28
59
|
}>;
|
|
29
60
|
/** Total accounted bytes. */
|
|
30
61
|
export declare function storageUsedBytes(db: Database): Promise<number>;
|
|
62
|
+
/**
|
|
63
|
+
* Companion table recording WHEN this ledger started telling the truth (cp#195, found by rollins).
|
|
64
|
+
*
|
|
65
|
+
* THE PROBLEM IT SOLVES, and it is the exact failure `complete` exists to catch. `storageUsedBytes`
|
|
66
|
+
* returns a confident integer on a studio whose ledger has never been reconciled, and that integer
|
|
67
|
+
* is a FLOOR rather than a total:
|
|
68
|
+
*
|
|
69
|
+
* - accounting starts at 0 on any studio that predates the version shipping it, because artifact
|
|
70
|
+
* sizes are not derivable from the DB and there is nothing honest to backfill (see the header);
|
|
71
|
+
* - a write it could not size or account leaves the counter reading LOW, with a warn;
|
|
72
|
+
* - a delete it could not account leaves it reading HIGH, with a warn.
|
|
73
|
+
*
|
|
74
|
+
* In `deny` mode a low counter merely denies later than it should. In `meter` mode it is a BILLING
|
|
75
|
+
* DEFECT, and in the direction that flatters us: we under-count, so we under-bill, and the
|
|
76
|
+
* cost-recovery ratio reports health. Nothing downstream can catch it, because a low number and a
|
|
77
|
+
* correct number are the same shape. That is a guard that looks exactly like success.
|
|
78
|
+
*
|
|
79
|
+
* WHY "true since" AND NOT "last reconciled". A reconcile is one way a ledger becomes true; being
|
|
80
|
+
* born with accounting already on is the other, and it is the case that covers every studio
|
|
81
|
+
* provisioned from here. A host that creates a studio at or after this version can stamp it at
|
|
82
|
+
* creation and the ledger is honest from birth with no reconcile ever run. Naming the fact rather
|
|
83
|
+
* than the procedure keeps both in one field.
|
|
84
|
+
*
|
|
85
|
+
* WHY THE TABLE IS CREATED LAZILY rather than added to the panel migrations. The panels carry
|
|
86
|
+
* STORAGE_USAGE_DDL verbatim with tests asserting their migration still matches it, so a second DDL
|
|
87
|
+
* constant would put a migration in front of this train in two more repos. Creating it where it is
|
|
88
|
+
* WRITTEN, and treating its absence as "not established" on read, needs no migration and fails in
|
|
89
|
+
* the safe direction: a studio that has never stamped anything reads as unbillable rather than as
|
|
90
|
+
* billable-at-a-floor. The constant is exported anyway, so a host that prefers a real migration can
|
|
91
|
+
* carry it.
|
|
92
|
+
*/
|
|
93
|
+
export declare const STORAGE_LEDGER_META_DDL = "CREATE TABLE IF NOT EXISTS storage_usage_meta (\n key TEXT PRIMARY KEY,\n value TEXT NOT NULL\n)";
|
|
94
|
+
/**
|
|
95
|
+
* Record that the ledger is true as of `atSeconds` (default now).
|
|
96
|
+
*
|
|
97
|
+
* Called by `reconcileStorageUsage` on every successful rebuild, and callable by a HOST at studio
|
|
98
|
+
* creation to assert "this ledger has been accurate since the studio existed". The second caller is
|
|
99
|
+
* the one that matters for new tenants: without it every fresh studio would read as unbillable
|
|
100
|
+
* despite having a perfectly honest ledger.
|
|
101
|
+
*/
|
|
102
|
+
export declare function markStorageLedgerTrue(db: Database, atSeconds?: number): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Unix seconds since when this ledger is known true, or null when that has never been established.
|
|
105
|
+
*
|
|
106
|
+
* ANY failure reads as null, including the table simply not existing yet, and that is deliberate
|
|
107
|
+
* rather than sloppy: every failure mode here means the same thing operationally, which is that we
|
|
108
|
+
* cannot establish the ledger is complete. Guessing "true" on a read error would be the one
|
|
109
|
+
* direction that bills a customer off a number we could not stand behind.
|
|
110
|
+
*/
|
|
111
|
+
export declare function storageLedgerTrueSince(db: Database): Promise<number | null>;
|
|
31
112
|
export type StorageQuotaVerdict = {
|
|
32
113
|
ok: true;
|
|
114
|
+
mode: StorageQuotaMode;
|
|
33
115
|
usedBytes: number | null;
|
|
34
116
|
quotaBytes: number | null;
|
|
117
|
+
/** See the COMPLETENESS CONTRACT below. */
|
|
118
|
+
complete: boolean;
|
|
119
|
+
reason: string | null;
|
|
35
120
|
} | {
|
|
36
121
|
ok: false;
|
|
37
122
|
status: 507 | 503;
|
|
123
|
+
mode: StorageQuotaMode;
|
|
38
124
|
usedBytes: number | null;
|
|
39
125
|
quotaBytes: number;
|
|
40
126
|
message: string;
|
|
127
|
+
complete: boolean;
|
|
128
|
+
reason: string | null;
|
|
41
129
|
};
|
|
42
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Enforce (or merely observe) the storage ceiling for one submission.
|
|
132
|
+
*
|
|
133
|
+
* Knob off = a pure no-op that never touches the DB, in BOTH modes. That is not an optimisation to
|
|
134
|
+
* be tidied away: submit is a hot-ish path and a studio with no quota configured has nothing to read.
|
|
135
|
+
*
|
|
136
|
+
* `deny` mode is byte-identical to core#52: same decisions, same statuses, same message text. The
|
|
137
|
+
* added fields are additive and no consumer serialises this verdict; the panel reads `.ok`,
|
|
138
|
+
* `.status` and `.message`. tests/storage-quota.test.ts pins all three across the whole matrix, so a
|
|
139
|
+
* drift in the default is a test failure rather than a reading exercise.
|
|
140
|
+
*/
|
|
43
141
|
export declare function checkStorageQuota(env: StorageQuotaEnv): Promise<StorageQuotaVerdict>;
|
|
142
|
+
/**
|
|
143
|
+
* The OBSERVER surface: what the operator (and, for a hosted tenant, the biller) needs to see, with
|
|
144
|
+
* no submit semantics attached. `checkStorageQuota` is the submit-time gate and runs on the render
|
|
145
|
+
* path; this is the read behind the usage route and the used-vs-included display.
|
|
146
|
+
*
|
|
147
|
+
* ONE computation, deliberately. The alternative was for the hosted plane to compute the billable
|
|
148
|
+
* number its own way from its own R2 read, which means two numbers can disagree about the same
|
|
149
|
+
* tenant and the one that bills is the one nobody can see. A self-hoster reads the identical fact
|
|
150
|
+
* off the identical surface.
|
|
151
|
+
*/
|
|
152
|
+
export interface StorageQuotaState {
|
|
153
|
+
mode: StorageQuotaMode;
|
|
154
|
+
/** In `deny` this is the CEILING; in `meter` it is the INCLUDED quota. null = not configured. */
|
|
155
|
+
quotaBytes: number | null;
|
|
156
|
+
usedBytes: number | null;
|
|
157
|
+
objects: number | null;
|
|
158
|
+
/**
|
|
159
|
+
* Bytes beyond `quotaBytes`, floored at 0. null when it cannot be computed (no reading, or no
|
|
160
|
+
* quota configured). A real reading at or under the quota is 0, never null: "nothing over" and
|
|
161
|
+
* "we do not know" are different answers and this field keeps them different.
|
|
162
|
+
*/
|
|
163
|
+
overageBytes: number | null;
|
|
164
|
+
/** Same contract as the verdict: false = METERING GAP, unbillable, never zero overage. */
|
|
165
|
+
complete: boolean;
|
|
166
|
+
reason: string | null;
|
|
167
|
+
}
|
|
168
|
+
export declare function storageQuotaState(env: StorageQuotaEnv): Promise<StorageQuotaState>;
|
|
44
169
|
/** True for a request whose product is stored bytes, and so must pass the storage ceiling. */
|
|
45
170
|
export declare function isStorageSubmitRoute(method: string, pathname: string): boolean;
|
|
46
171
|
/** The pattern list, for the panel route-drift tests. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-quota.d.ts","sourceRoot":"","sources":["../src/storage-quota.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD;2FAC2F;AAC3F,eAAO,MAAM,iBAAiB,4IAI5B,CAAC;AAIH;6BAC6B;AAC7B,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,2EAA2E;IAC3E,sBAAsB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"storage-quota.d.ts","sourceRoot":"","sources":["../src/storage-quota.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,C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isInteger(n) && n > 0 ? n : null;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the mode. Unset, empty, or ANY unrecognised value resolves to `deny`.
|
|
56
|
+
*
|
|
57
|
+
* NOTE THE ASYMMETRY WITH THE BYTES KNOB, which is deliberate and not an inconsistency to tidy up.
|
|
58
|
+
* For `R2_STORAGE_QUOTA_BYTES`, garbage means OFF: nobody set a ceiling, so there is no ceiling, and
|
|
59
|
+
* absent knob means absent behaviour. For the MODE, garbage cannot mean "no mode" -- a studio with a
|
|
60
|
+
* ceiling set still has to pick an enforcement posture -- so it means `deny`, the conservative side.
|
|
61
|
+
* Guessing `meter` on a typo would silently turn a hard stop into unmetered spend, which is the one
|
|
62
|
+
* direction that costs somebody money they did not agree to.
|
|
63
|
+
*
|
|
64
|
+
* An unrecognised value WARNS rather than throwing. Refusing to boot over a mode string would take a
|
|
65
|
+
* studio down for a typo whose safe interpretation is obvious; going quiet would leave an operator
|
|
66
|
+
* believing they configured metering. Loud and safe beats either.
|
|
67
|
+
*/
|
|
68
|
+
export function storageQuotaMode(env) {
|
|
69
|
+
const raw = env.R2_STORAGE_QUOTA_MODE;
|
|
70
|
+
if (typeof raw !== "string" || raw.trim() === "")
|
|
71
|
+
return "deny";
|
|
72
|
+
const cleaned = raw.trim().toLowerCase();
|
|
73
|
+
if (cleaned === "meter")
|
|
74
|
+
return "meter";
|
|
75
|
+
if (cleaned !== "deny") {
|
|
76
|
+
console.warn(`storage-quota: R2_STORAGE_QUOTA_MODE is set to an unrecognised value; falling back to "deny" (the safe side). Valid values are "deny" and "meter".`);
|
|
77
|
+
}
|
|
78
|
+
return "deny";
|
|
79
|
+
}
|
|
54
80
|
// --------------------------------------------------------------------------- the ledger
|
|
55
81
|
function nowSeconds() {
|
|
56
82
|
return Math.floor(Date.now() / 1000);
|
|
@@ -88,18 +114,128 @@ export async function storageUsage(db) {
|
|
|
88
114
|
export async function storageUsedBytes(db) {
|
|
89
115
|
return (await storageUsage(db)).usedBytes;
|
|
90
116
|
}
|
|
91
|
-
|
|
117
|
+
// --------------------------------------------------------------------------- is the ledger TRUE?
|
|
118
|
+
/**
|
|
119
|
+
* Companion table recording WHEN this ledger started telling the truth (cp#195, found by rollins).
|
|
120
|
+
*
|
|
121
|
+
* THE PROBLEM IT SOLVES, and it is the exact failure `complete` exists to catch. `storageUsedBytes`
|
|
122
|
+
* returns a confident integer on a studio whose ledger has never been reconciled, and that integer
|
|
123
|
+
* is a FLOOR rather than a total:
|
|
124
|
+
*
|
|
125
|
+
* - accounting starts at 0 on any studio that predates the version shipping it, because artifact
|
|
126
|
+
* sizes are not derivable from the DB and there is nothing honest to backfill (see the header);
|
|
127
|
+
* - a write it could not size or account leaves the counter reading LOW, with a warn;
|
|
128
|
+
* - a delete it could not account leaves it reading HIGH, with a warn.
|
|
129
|
+
*
|
|
130
|
+
* In `deny` mode a low counter merely denies later than it should. In `meter` mode it is a BILLING
|
|
131
|
+
* DEFECT, and in the direction that flatters us: we under-count, so we under-bill, and the
|
|
132
|
+
* cost-recovery ratio reports health. Nothing downstream can catch it, because a low number and a
|
|
133
|
+
* correct number are the same shape. That is a guard that looks exactly like success.
|
|
134
|
+
*
|
|
135
|
+
* WHY "true since" AND NOT "last reconciled". A reconcile is one way a ledger becomes true; being
|
|
136
|
+
* born with accounting already on is the other, and it is the case that covers every studio
|
|
137
|
+
* provisioned from here. A host that creates a studio at or after this version can stamp it at
|
|
138
|
+
* creation and the ledger is honest from birth with no reconcile ever run. Naming the fact rather
|
|
139
|
+
* than the procedure keeps both in one field.
|
|
140
|
+
*
|
|
141
|
+
* WHY THE TABLE IS CREATED LAZILY rather than added to the panel migrations. The panels carry
|
|
142
|
+
* STORAGE_USAGE_DDL verbatim with tests asserting their migration still matches it, so a second DDL
|
|
143
|
+
* constant would put a migration in front of this train in two more repos. Creating it where it is
|
|
144
|
+
* WRITTEN, and treating its absence as "not established" on read, needs no migration and fails in
|
|
145
|
+
* the safe direction: a studio that has never stamped anything reads as unbillable rather than as
|
|
146
|
+
* billable-at-a-floor. The constant is exported anyway, so a host that prefers a real migration can
|
|
147
|
+
* carry it.
|
|
148
|
+
*/
|
|
149
|
+
export const STORAGE_LEDGER_META_DDL = `CREATE TABLE IF NOT EXISTS storage_usage_meta (
|
|
150
|
+
key TEXT PRIMARY KEY,
|
|
151
|
+
value TEXT NOT NULL
|
|
152
|
+
)`;
|
|
153
|
+
const LEDGER_TRUE_SINCE_KEY = "ledger_true_since";
|
|
154
|
+
/**
|
|
155
|
+
* Record that the ledger is true as of `atSeconds` (default now).
|
|
156
|
+
*
|
|
157
|
+
* Called by `reconcileStorageUsage` on every successful rebuild, and callable by a HOST at studio
|
|
158
|
+
* creation to assert "this ledger has been accurate since the studio existed". The second caller is
|
|
159
|
+
* the one that matters for new tenants: without it every fresh studio would read as unbillable
|
|
160
|
+
* despite having a perfectly honest ledger.
|
|
161
|
+
*/
|
|
162
|
+
export async function markStorageLedgerTrue(db, atSeconds) {
|
|
163
|
+
await db.prepare(STORAGE_LEDGER_META_DDL).bind().run();
|
|
164
|
+
await db
|
|
165
|
+
.prepare(`INSERT INTO storage_usage_meta (key, value) VALUES (?, ?)
|
|
166
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value`)
|
|
167
|
+
.bind(LEDGER_TRUE_SINCE_KEY, String(atSeconds ?? nowSeconds()))
|
|
168
|
+
.run();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Unix seconds since when this ledger is known true, or null when that has never been established.
|
|
172
|
+
*
|
|
173
|
+
* ANY failure reads as null, including the table simply not existing yet, and that is deliberate
|
|
174
|
+
* rather than sloppy: every failure mode here means the same thing operationally, which is that we
|
|
175
|
+
* cannot establish the ledger is complete. Guessing "true" on a read error would be the one
|
|
176
|
+
* direction that bills a customer off a number we could not stand behind.
|
|
177
|
+
*/
|
|
178
|
+
export async function storageLedgerTrueSince(db) {
|
|
179
|
+
try {
|
|
180
|
+
const row = await db
|
|
181
|
+
.prepare("SELECT value FROM storage_usage_meta WHERE key = ?")
|
|
182
|
+
.bind(LEDGER_TRUE_SINCE_KEY)
|
|
183
|
+
.first();
|
|
184
|
+
const n = Number(row?.value);
|
|
185
|
+
return Number.isInteger(n) && n > 0 ? n : null;
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// COMPLETENESS CONTRACT (cp#195), the same vocabulary the LLM meter uses, deliberately:
|
|
192
|
+
//
|
|
193
|
+
// complete: true this answer is a usable basis for billing. usedBytes is a real reading.
|
|
194
|
+
// complete: false a METERING GAP. usedBytes is null and `reason` says why in words a human can
|
|
195
|
+
// act on. The period is UNBILLABLE. It is NEVER zero overage.
|
|
196
|
+
//
|
|
197
|
+
// The distinction is load-bearing in `meter` mode and it is why the flag exists at all. `meter` has
|
|
198
|
+
// no hard cap, so a silently broken storage read plus no cap is unbounded spend carried by whoever
|
|
199
|
+
// is billing. "We read zero" and "we could not read" must not arrive as the same value, and before
|
|
200
|
+
// this flag they did: `{ ok: true, usedBytes: null }` was ALREADY the return for a quota that is
|
|
201
|
+
// simply not configured (the pure no-op below), so a failed read would have been indistinguishable
|
|
202
|
+
// from an unconfigured studio, not merely from a real zero.
|
|
203
|
+
//
|
|
204
|
+
// Read the pair, never one field: `quotaBytes === null` means no quota is configured at all, which
|
|
205
|
+
// is a third state and not an incomplete one.
|
|
206
|
+
/**
|
|
207
|
+
* Enforce (or merely observe) the storage ceiling for one submission.
|
|
208
|
+
*
|
|
209
|
+
* Knob off = a pure no-op that never touches the DB, in BOTH modes. That is not an optimisation to
|
|
210
|
+
* be tidied away: submit is a hot-ish path and a studio with no quota configured has nothing to read.
|
|
211
|
+
*
|
|
212
|
+
* `deny` mode is byte-identical to core#52: same decisions, same statuses, same message text. The
|
|
213
|
+
* added fields are additive and no consumer serialises this verdict; the panel reads `.ok`,
|
|
214
|
+
* `.status` and `.message`. tests/storage-quota.test.ts pins all three across the whole matrix, so a
|
|
215
|
+
* drift in the default is a test failure rather than a reading exercise.
|
|
216
|
+
*/
|
|
92
217
|
export async function checkStorageQuota(env) {
|
|
218
|
+
const mode = storageQuotaMode(env);
|
|
93
219
|
const quotaBytes = storageQuotaBytes(env);
|
|
94
|
-
if (quotaBytes === null)
|
|
95
|
-
return { ok: true, usedBytes: null, quotaBytes: null };
|
|
220
|
+
if (quotaBytes === null) {
|
|
221
|
+
return { ok: true, mode, usedBytes: null, quotaBytes: null, complete: true, reason: null };
|
|
222
|
+
}
|
|
96
223
|
if (!env.DB) {
|
|
224
|
+
const reason = "the studio database is unavailable, so storage usage cannot be read";
|
|
225
|
+
if (mode === "meter") {
|
|
226
|
+
// No deny to make, so nothing to fail closed to. This is a metering gap and it is reported as
|
|
227
|
+
// one: the submit proceeds and the period is unbillable.
|
|
228
|
+
return { ok: true, mode, usedBytes: null, quotaBytes, complete: false, reason };
|
|
229
|
+
}
|
|
97
230
|
return {
|
|
98
231
|
ok: false,
|
|
99
232
|
status: 503,
|
|
233
|
+
mode,
|
|
100
234
|
usedBytes: null,
|
|
101
235
|
quotaBytes,
|
|
102
236
|
message: `storage quota is set (${quotaBytes} bytes) but the studio database is unavailable, so storage usage cannot be checked; submissions are blocked (fail-closed posture)`,
|
|
237
|
+
complete: false,
|
|
238
|
+
reason,
|
|
103
239
|
};
|
|
104
240
|
}
|
|
105
241
|
let usedBytes;
|
|
@@ -107,26 +243,110 @@ export async function checkStorageQuota(env) {
|
|
|
107
243
|
usedBytes = await storageUsedBytes(env.DB);
|
|
108
244
|
}
|
|
109
245
|
catch (e) {
|
|
246
|
+
const reason = `the storage usage read failed (${e.message})`;
|
|
247
|
+
if (mode === "meter") {
|
|
248
|
+
return { ok: true, mode, usedBytes: null, quotaBytes, complete: false, reason };
|
|
249
|
+
}
|
|
110
250
|
return {
|
|
111
251
|
ok: false,
|
|
112
252
|
status: 503,
|
|
253
|
+
mode,
|
|
113
254
|
usedBytes: null,
|
|
114
255
|
quotaBytes,
|
|
115
256
|
message: `storage quota check failed (${e.message}); submissions are blocked until the database recovers (fail-closed posture)`,
|
|
257
|
+
complete: false,
|
|
258
|
+
reason,
|
|
116
259
|
};
|
|
117
260
|
}
|
|
118
261
|
// >= denies AT the ceiling: a studio exactly at its limit is full, and the next render only ever adds
|
|
119
262
|
// bytes. Denying one submission early is honest; letting one through is not.
|
|
120
|
-
|
|
263
|
+
//
|
|
264
|
+
// In `meter` mode this is not a ceiling at all, so there is no deny: the reading is complete, the
|
|
265
|
+
// overage is real, and the submit proceeds.
|
|
266
|
+
// A readable number is not the same as a trustworthy one. An unreconciled ledger returns a
|
|
267
|
+
// confident integer that is a FLOOR, so in `meter` mode it would bill an overage computed from a
|
|
268
|
+
// total we cannot stand behind, in the direction that flatters us. Establishing this costs one
|
|
269
|
+
// extra read on a path that runs at submit, which is rare.
|
|
270
|
+
const trueSince = await storageLedgerTrueSince(env.DB);
|
|
271
|
+
if (trueSince === null) {
|
|
272
|
+
const reason = "this studio storage ledger has never been established as true (no reconcile has run and no " +
|
|
273
|
+
"host has stamped it), so the accounted total is a FLOOR rather than a total";
|
|
274
|
+
if (mode === "meter") {
|
|
275
|
+
return { ok: true, mode, usedBytes, quotaBytes, complete: false, reason };
|
|
276
|
+
}
|
|
277
|
+
// `deny` decisions are untouched: a floor still denies, just later than a true total would.
|
|
278
|
+
// Only the advisory completeness pair reports the weaker basis.
|
|
279
|
+
if (usedBytes >= quotaBytes) {
|
|
280
|
+
return {
|
|
281
|
+
ok: false,
|
|
282
|
+
status: 507,
|
|
283
|
+
mode,
|
|
284
|
+
usedBytes,
|
|
285
|
+
quotaBytes,
|
|
286
|
+
message: `storage quota reached: ${usedBytes} bytes stored of the ${quotaBytes}-byte R2_STORAGE_QUOTA_BYTES ceiling; delete renders or raise the knob`,
|
|
287
|
+
complete: false,
|
|
288
|
+
reason,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
return { ok: true, mode, usedBytes, quotaBytes, complete: false, reason };
|
|
292
|
+
}
|
|
293
|
+
if (usedBytes >= quotaBytes && mode === "deny") {
|
|
121
294
|
return {
|
|
122
295
|
ok: false,
|
|
123
296
|
status: 507,
|
|
297
|
+
mode,
|
|
124
298
|
usedBytes,
|
|
125
299
|
quotaBytes,
|
|
126
300
|
message: `storage quota reached: ${usedBytes} bytes stored of the ${quotaBytes}-byte R2_STORAGE_QUOTA_BYTES ceiling; delete renders or raise the knob`,
|
|
301
|
+
complete: true,
|
|
302
|
+
reason: null,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
return { ok: true, mode, usedBytes, quotaBytes, complete: true, reason: null };
|
|
306
|
+
}
|
|
307
|
+
export async function storageQuotaState(env) {
|
|
308
|
+
const mode = storageQuotaMode(env);
|
|
309
|
+
const quotaBytes = storageQuotaBytes(env);
|
|
310
|
+
if (!env.DB) {
|
|
311
|
+
return {
|
|
312
|
+
mode,
|
|
313
|
+
quotaBytes,
|
|
314
|
+
usedBytes: null,
|
|
315
|
+
objects: null,
|
|
316
|
+
overageBytes: null,
|
|
317
|
+
complete: false,
|
|
318
|
+
reason: "the studio database is unavailable, so storage usage cannot be read",
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
try {
|
|
322
|
+
const { usedBytes, objects } = await storageUsage(env.DB);
|
|
323
|
+
const trueSince = await storageLedgerTrueSince(env.DB);
|
|
324
|
+
return {
|
|
325
|
+
mode,
|
|
326
|
+
quotaBytes,
|
|
327
|
+
usedBytes,
|
|
328
|
+
objects,
|
|
329
|
+
// The numbers are reported either way -- an operator staring at a usage page wants to see the
|
|
330
|
+
// floor rather than a blank -- but the completeness pair says what they rest on.
|
|
331
|
+
overageBytes: quotaBytes === null ? null : Math.max(0, usedBytes - quotaBytes),
|
|
332
|
+
complete: trueSince !== null,
|
|
333
|
+
reason: trueSince !== null
|
|
334
|
+
? null
|
|
335
|
+
: "this studio storage ledger has never been established as true (no reconcile has run " +
|
|
336
|
+
"and no host has stamped it), so the accounted total is a FLOOR rather than a total",
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
catch (e) {
|
|
340
|
+
return {
|
|
341
|
+
mode,
|
|
342
|
+
quotaBytes,
|
|
343
|
+
usedBytes: null,
|
|
344
|
+
objects: null,
|
|
345
|
+
overageBytes: null,
|
|
346
|
+
complete: false,
|
|
347
|
+
reason: `the storage usage read failed (${e.message})`,
|
|
127
348
|
};
|
|
128
349
|
}
|
|
129
|
-
return { ok: true, usedBytes, quotaBytes };
|
|
130
350
|
}
|
|
131
351
|
// --------------------------------------------------------------------------- the submit surface
|
|
132
352
|
// The POST routes that WRITE ARTIFACT BYTES: uploads, GPU submits, and the paid-generation routes whose
|
|
@@ -331,6 +551,9 @@ export async function reconcileStorageUsage(bucket, db, opts) {
|
|
|
331
551
|
for (const stmt of chunk)
|
|
332
552
|
await stmt.run();
|
|
333
553
|
}
|
|
554
|
+
// The rebuild just made this ledger true; record that, because nothing else can observe it after
|
|
555
|
+
// the fact. A total and a floor are the same shape (cp#195).
|
|
556
|
+
await markStorageLedgerTrue(db, now);
|
|
334
557
|
return {
|
|
335
558
|
objects: sized.length,
|
|
336
559
|
bytes: sized.reduce((sum, row) => sum + row.bytes, 0),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-quota.js","sourceRoot":"","sources":["../src/storage-quota.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,EAAE;AACF,sGAAsG;AACtG,uGAAuG;AACvG,sGAAsG;AACtG,wGAAwG;AACxG,4FAA4F;AAC5F,EAAE;AACF,sEAAsE;AACtE,+FAA+F;AAC/F,oGAAoG;AACpG,qGAAqG;AACrG,6CAA6C;AAC7C,EAAE;AACF,uGAAuG;AACvG,wGAAwG;AACxG,oGAAoG;AACpG,sGAAsG;AACtG,kGAAkG;AAClG,EAAE;AACF,qGAAqG;AACrG,uGAAuG;AACvG,4FAA4F;AAC5F,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,qGAAqG;AACrG,oGAAoG;AACpG,uBAAuB;AACvB,E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unifying vivijure-cf and vivijure-local: module registry, film pipeline, Platform ICD.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsc -p tsconfig.build.json",
|
|
53
53
|
"prepare": "npm run build",
|
|
54
|
-
"typecheck": "tsc --noEmit",
|
|
54
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.tests.json",
|
|
55
55
|
"test": "vitest run",
|
|
56
56
|
"test:coverage": "vitest run --coverage.enabled=true --coverage.provider=v8 --coverage.reporter=cobertura --coverage.reporter=text",
|
|
57
57
|
"sync:module-types": "cp ../vivijure/src/modules/types.ts src/modules/types.ts",
|