@coffre/conformance 0.1.3 → 0.1.4

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/main.js CHANGED
@@ -1219,6 +1219,27 @@ async function deviceLogin(deployment, browser) {
1219
1219
  expect(polled.ok && session.access_token, `the approved device login gave no token: ${polled.status}`, session);
1220
1220
  return session.access_token;
1221
1221
  }
1222
+ /**
1223
+ * A page's worth of API calls at once, as the pages fire them on a load,
1224
+ * right after sign-in, while the vault is fresh: every one answers. A call
1225
+ * that waited on another's work in the vault would be cancelled on
1226
+ * Cloudflare as hung, and the page would read the 503 or 401 as signed out.
1227
+ */
1228
+ async function pageLoad(person) {
1229
+ const paths = [
1230
+ "/api/me",
1231
+ "/api/sessions",
1232
+ "/api/projects",
1233
+ "/api/members",
1234
+ "/api/audit",
1235
+ "/api/identities",
1236
+ "/api/me",
1237
+ "/api/projects"
1238
+ ];
1239
+ const failed = (await Promise.all(paths.map(async (path) => [path, (await person.browser.fetch(path)).status]))).filter(([, status]) => status !== 200);
1240
+ expect(failed.length === 0, "a call of the page load did not answer 200", failed.map(([path, status]) => `${path}: ${status}`).join(", "));
1241
+ return `${paths.length} calls at once, each answered`;
1242
+ }
1222
1243
  //#endregion
1223
1244
  //#region src/checks/storage.ts
1224
1245
  const TABLES = [
@@ -2467,6 +2488,7 @@ async function conform(deployment, options) {
2467
2488
  await report.check("health", {}, () => health(deployment));
2468
2489
  await anonymousChecks(report, deployment.origin, { health: false });
2469
2490
  const admin = await report.check("sign-in", {}, () => signInAdmin(deployment));
2491
+ await report.check("page load", { admin }, ({ admin }) => pageLoad(admin));
2470
2492
  const canaries = await report.check("setup", { admin }, ({ admin }) => setUp(admin));
2471
2493
  const people = await report.check("personas", {
2472
2494
  admin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffre/conformance",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Checks a coffre deployment from outside: what it must never do, whatever code it runs.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "jose": "6.2.3",
33
33
  "pg": "8.16.3",
34
- "@coffre/db": "0.1.3"
34
+ "@coffre/db": "0.1.4"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "26.1.1",
@@ -39,7 +39,7 @@
39
39
  "oauth4webapi": "3.8.8",
40
40
  "tsdown": "0.23.0",
41
41
  "typescript": "5.9.3",
42
- "@coffre/client": "0.1.3"
42
+ "@coffre/client": "0.1.4"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsdown",
@@ -184,3 +184,17 @@ async function deviceLogin(deployment: Deployment, browser: Browser): Promise<st
184
184
  expect(polled.ok && session.access_token, `the approved device login gave no token: ${polled.status}`, session);
185
185
  return session.access_token;
186
186
  }
187
+
188
+ /**
189
+ * A page's worth of API calls at once, as the pages fire them on a load,
190
+ * right after sign-in, while the vault is fresh: every one answers. A call
191
+ * that waited on another's work in the vault would be cancelled on
192
+ * Cloudflare as hung, and the page would read the 503 or 401 as signed out.
193
+ */
194
+ export async function pageLoad(person: Person): Promise<string> {
195
+ const paths = ['/api/me', '/api/sessions', '/api/projects', '/api/members', '/api/audit', '/api/identities', '/api/me', '/api/projects'];
196
+ const statuses = await Promise.all(paths.map(async (path) => [path, (await person.browser.fetch(path)).status] as const));
197
+ const failed = statuses.filter(([, status]) => status !== 200);
198
+ expect(failed.length === 0, 'a call of the page load did not answer 200', failed.map(([path, status]) => `${path}: ${status}`).join(', '));
199
+ return `${paths.length} calls at once, each answered`;
200
+ }
package/src/suite.ts CHANGED
@@ -12,7 +12,7 @@ import { refusedCheckpoint, missingCheckpoint, middleCut } from './checks/readin
12
12
  import { editedGeneration, forgedCredential, forgedIdentity, forgedApproval } from './checks/signin.ts';
13
13
  import { canaryScan } from './checks/canaries.ts';
14
14
  import { anonymousChecks, tokenChecks, type Canary } from './checks/live.ts';
15
- import { personas, setUp, setUpLive, signInAdmin } from './checks/people.ts';
15
+ import { pageLoad, personas, setUp, setUpLive, signInAdmin } from './checks/people.ts';
16
16
  import { health } from './checks/surface.ts';
17
17
 
18
18
  /** The names of the checks that failed. */
@@ -24,6 +24,7 @@ export async function conform(deployment: Deployment, options: { bulkLimit: numb
24
24
  // database and processes.
25
25
  await anonymousChecks(report, deployment.origin, { health: false });
26
26
  const admin = await report.check('sign-in', {}, () => signInAdmin(deployment));
27
+ await report.check('page load', { admin }, ({ admin }) => pageLoad(admin));
27
28
  const canaries = await report.check('setup', { admin }, ({ admin }) => setUp(admin));
28
29
  const people = await report.check('personas', { admin, canaries }, ({ admin }) => personas(deployment, admin));
29
30
  const all = { people, canaries };