@ai-ecoverse/slicc-shared-web 1.12.1 → 1.12.3

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 CHANGED
@@ -4,7 +4,7 @@ Configuration shared by SLICC's web repos ([slicc-bios](https://github.com/ai-ec
4
4
 
5
5
  | File | What it is | How a repo uses it |
6
6
  |---|---|---|
7
- | `default.json` | Root Renovate preset: automerge on, one dependency per PR, exact pins, 7-day release age (14 for majors, 0 for vulnerability fixes and for our own `@ai-ecoverse` packages, which also jump the PR queue), and a manager for jsDelivr pins inside `src/` | `renovate.json`: `{ "extends": ["github>ai-ecoverse/slicc-shared-web"] }` |
7
+ | `default.json` | Root Renovate preset: automerge on, one dependency per PR, exact pins, 7-day release age (14 for majors, 0 for vulnerability fixes and for our own `@ai-ecoverse` packages and `github.com/ai-ecoverse/*` Go modules, which also jump the PR queue), `go mod tidy` after every Go module update (plus import-path rewrites on majors), and a manager for jsDelivr pins inside `src/` | `renovate.json`: `{ "extends": ["github>ai-ecoverse/slicc-shared-web"] }` |
8
8
  | `.github/workflows/node-ci.yml` | Reusable CI: `npm ci`, lint, Chromium's system libraries, integration tests, hotspots and the stack of every crash dump in the job summary, coverage/profiles/screenshots/crash dumps as artifacts. The browser itself comes from each repo's `pretest` | `jobs: { ci: { uses: ai-ecoverse/slicc-shared-web/.github/workflows/node-ci.yml@vX.Y.Z } }` |
9
9
  | `biome.json` | Formatter settings and slicc's strict linter: cognitive complexity ≤ 25, functions ≤ 150 lines, no unused variables or imports, no floating or misused promises, naming conventions, `import type`/`export type`. Test files under `test/` get slicc's test exemptions | `biome.json`: `{ "extends": ["@ai-ecoverse/slicc-shared-web/biome"] }` |
10
10
  | `tsconfig.json` | TypeScript base for Node's type stripping | `tsconfig.json`: `{ "extends": "@ai-ecoverse/slicc-shared-web/tsconfig.json", "include": ["src/**/*.ts"] }` |
package/default.json CHANGED
@@ -42,11 +42,12 @@
42
42
  "minimumReleaseAge": "14 days"
43
43
  },
44
44
  {
45
- "description": "Our own packages and shared config ship together: take them as soon as they are released, ahead of the hourly PR limit, whether Renovate sees them by package name (npm, reusable workflows, git URLs) or by dependency name.",
45
+ "description": "Our own packages and shared config ship together: take them as soon as they are released, ahead of the hourly PR limit, whether Renovate sees them by package name (npm, reusable workflows, git URLs, Go modules) or by dependency name.",
46
46
  "matchPackageNames": [
47
47
  "@ai-ecoverse/{/,}**",
48
48
  "ai-ecoverse/**",
49
- "https://github.com/ai-ecoverse/**"
49
+ "https://github.com/ai-ecoverse/**",
50
+ "github.com/ai-ecoverse/**"
50
51
  ],
51
52
  "minimumReleaseAge": "0 days",
52
53
  "prPriority": 10
@@ -56,6 +57,11 @@
56
57
  "minimumReleaseAge": "0 days",
57
58
  "prPriority": 10
58
59
  },
60
+ {
61
+ "description": "Go modules: run go mod tidy after every update, so a bump that changes indirect requirements passes go mod tidy -diff in CI, and rewrite import paths on major updates.",
62
+ "matchManagers": ["gomod"],
63
+ "postUpdateOptions": ["gomodTidy", "gomodUpdateImportPaths"]
64
+ },
59
65
  {
60
66
  "matchPackageNames": ["semantic-release", "@semantic-release/{/,}**"],
61
67
  "groupName": "semantic-release packages"
@@ -14,6 +14,14 @@ export function flights(now = Date.now) {
14
14
  const { request, type = 'Other', requestId } = params;
15
15
  requests.set(requestId, { what: `${request.method} ${request.url} (${type})`, since: now() });
16
16
  }
17
+ if (method === 'Network.responseReceived') {
18
+ const flight = requests.get(params.requestId);
19
+ if (flight) flight.status = params.response.status;
20
+ }
21
+ if (method === 'Network.dataReceived') {
22
+ const flight = requests.get(params.requestId);
23
+ if (flight) flight.bytes = (flight.bytes ?? 0) + params.dataLength;
24
+ }
17
25
  if (done.has(method)) requests.delete(params.requestId);
18
26
  if (method === 'Page.frameStartedNavigating') {
19
27
  const what = `navigation to ${params.url} (${params.navigationType})`;
@@ -27,7 +35,10 @@ export function flights(now = Date.now) {
27
35
  return [...navigations.values(), ...requests.values()]
28
36
  .sort((a, b) => a.since - b.since)
29
37
  .slice(0, 20)
30
- .map(({ what, since }) => `pending ${what} for ${((at - since) / 1000).toFixed(1)}s`);
38
+ .map(({ what, since, status, bytes = 0 }) => {
39
+ const answer = status ? `, answered ${status} with ${bytes} bytes of body so far` : '';
40
+ return `pending ${what} for ${((at - since) / 1000).toFixed(1)}s${answer}`;
41
+ });
31
42
  }
32
43
 
33
44
  function loaded(targetId) {
package/harness/page.mjs CHANGED
@@ -87,6 +87,10 @@ export function decoded({ value, unserializableValue }) {
87
87
 
88
88
  export const STALL_AFTER = 30000;
89
89
 
90
+ export function unanswered(error) {
91
+ return /: no answer in \d+ ms$/.test(error.message);
92
+ }
93
+
90
94
  export function page(
91
95
  cdp,
92
96
  { sessionId, targetId },
@@ -152,13 +156,16 @@ export function page(
152
156
  async function within(ms, fn, ...args) {
153
157
  const deadline = Date.now() + ms;
154
158
  let last;
159
+ let answered = false;
155
160
  for (let left = ms; left > 0; left = deadline - Date.now()) {
156
161
  try {
157
162
  last = await run(fn, args, left);
163
+ answered = true;
158
164
  if (last) return last;
159
165
  } catch (error) {
160
166
  if (error.fatal) throw error;
161
- last = error.message;
167
+ if (!answered || !unanswered(error)) last = error.message;
168
+ answered ||= !unanswered(error);
162
169
  }
163
170
  await sleep(25);
164
171
  }
@@ -54,16 +54,23 @@ export async function serve({
54
54
  requests.push(pathname);
55
55
  if (overrides.has(pathname)) {
56
56
  overridden.add(pathname);
57
+ const body = overrides.get(pathname);
57
58
  return response
58
- .writeHead(200, { ...headers, 'content-type': type(pathname), 'cache-control': 'no-cache' })
59
- .end(overrides.get(pathname));
59
+ .writeHead(200, {
60
+ ...headers,
61
+ 'content-type': type(pathname),
62
+ 'content-length': Buffer.byteLength(body),
63
+ 'cache-control': 'no-cache',
64
+ })
65
+ .end(body);
60
66
  }
61
67
  const file = locate(pathname);
62
- const found = file && (await stat(file).catch(() => null))?.isFile();
63
- if (!found) return response.writeHead(404, headers).end();
68
+ const info = file ? await stat(file).catch(() => null) : null;
69
+ if (!info?.isFile()) return response.writeHead(404, headers).end();
64
70
  response.writeHead(200, {
65
71
  ...headers,
66
72
  'content-type': type(file),
73
+ 'content-length': info.size,
67
74
  'cache-control': 'no-cache',
68
75
  });
69
76
  createReadStream(file).pipe(response);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-shared-web",
3
- "version": "1.12.1",
3
+ "version": "1.12.3",
4
4
  "description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",