@ai-ecoverse/slicc-shared-web 1.17.0 → 1.18.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/README.md +40 -4
- package/bin/slicc-lint-comments.sh +3 -2
- package/default.json +20 -3
- package/harness/page.mjs +11 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@ 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 and `github.com/ai-ecoverse/*` Go modules, which also jump the PR queue), `<upstream
|
|
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), `<upstream>-<build>` versions of our own `@ai-ecoverse` packages, such as `9.12.0-6`, which Renovate would otherwise skip as prereleases, never past the npm `latest` dist-tag (only `<upstream>-slicc.<n>` ones for `@ai-ecoverse/fnox` and its `@ai-ecoverse/fnox-*` platform packages), one PR each, majors included, for the certified pairs `@ai-ecoverse/slicc-kernel` + `@ai-ecoverse/wasi-pnpm` ("kernel and pnpm") and `@ai-ecoverse/wasm-coreutils` + `@ai-ecoverse/wasm-procps` ("coreutils and procps"), `go mod tidy` after every Go module update (plus import-path rewrites on majors), a manager for jsDelivr pins inside `src/`, and one for [`# renovate:` annotated pins in workflow files](#versions-pinned-in-workflow-files) | `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"] }` |
|
|
11
11
|
| `lefthook.yml` | Pre-commit hooks: Biome, typecheck, no comments, no unit tests in git, AGENTS.md, and diff coverage over [only the unit tests the change reaches](#which-unit-tests-a-commit-runs) | `lefthook.yml`: `extends: [node_modules/@ai-ecoverse/slicc-shared-web/lefthook.yml]` |
|
|
12
12
|
| `mcr.config.mjs` | Unit-test coverage for JS and TS sources in `src/` (TS types are stripped first), written to `coverage/unit/lcov.info`. With `SLICC_UNIT_TESTS` set, `node --test` runs only those files ([below](#which-unit-tests-a-commit-runs)) | `test:unit`: `mcr -c node_modules/@ai-ecoverse/slicc-shared-web/mcr.config.mjs node --test 'test/unit/**/*.test.mjs'` |
|
|
13
|
-
| `bin/` | `slicc-lint` runs every check below plus Biome and, if the repo has one, `typecheck`. `slicc-lint-comments` runs the [slicc no-comment checker](https://github.com/ai-ecoverse/slicc/tree/main/packages/dev-tools/no-comment) at a pinned commit, allowing AGENTS.md. `slicc-agents-md`, `slicc-no-unit-tests` and `slicc-diff-cover` complete the set, and `slicc-unit-cover` is the diff-coverage hook. `slicc-minidump <file.dmp>...` prints a crash dump's stack, described [below](#crash-dumps) | `lint`: `slicc-lint`, and the hooks above |
|
|
13
|
+
| `bin/` | `slicc-lint` runs every check below plus Biome and, if the repo has one, `typecheck`. `slicc-lint-comments` runs the [slicc no-comment checker](https://github.com/ai-ecoverse/slicc/tree/main/packages/dev-tools/no-comment) at a pinned commit, allowing AGENTS.md and [`# renovate:` annotations](#versions-pinned-in-workflow-files) in workflow and action files. `slicc-agents-md`, `slicc-no-unit-tests` and `slicc-diff-cover` complete the set, and `slicc-unit-cover` is the diff-coverage hook. `slicc-minidump <file.dmp>...` prints a crash dump's stack, described [below](#crash-dumps) | `lint`: `slicc-lint`, and the hooks above |
|
|
14
14
|
| `pnpmfile.mjs` | pnpm's counterpart to the Renovate preset: an `updateConfig` hook that adds `@ai-ecoverse/*` to `minimumReleaseAgeExclude`, so pnpm 12 doesn't hold back our own fresh releases (`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`) while third-party packages keep its age check | in a repo with a pnpm lockfile, as a [config dependency](https://pnpm.io/config-dependencies) in `pnpm-workspace.yaml`: `configDependencies: { '@ai-ecoverse/slicc-shared-web': X.Y.Z }` plus `pnpmfile: node_modules/.pnpm-config/@ai-ecoverse/slicc-shared-web/pnpmfile.mjs` |
|
|
15
15
|
| `harness/` | The CDP integration-test harness, described [below](#integration-test-harness) | `import { launch } from '@ai-ecoverse/slicc-shared-web/harness'`, and `--test-global-setup=node_modules/@ai-ecoverse/slicc-shared-web/harness/global.mjs` |
|
|
16
16
|
|
|
@@ -24,10 +24,46 @@ The hooks expect two scripts in each repo: `test:unit`, which writes `coverage/u
|
|
|
24
24
|
|
|
25
25
|
## Rules every repo follows
|
|
26
26
|
|
|
27
|
-
- No comments anywhere, and no `.md` files except README.md and AGENTS.md.
|
|
27
|
+
- No comments anywhere, and no `.md` files except README.md and AGENTS.md. The one exception is the `# renovate:` line [above a pinned version in a workflow](#versions-pinned-in-workflow-files).
|
|
28
28
|
- Agent guidance committed to a repo lives in AGENTS.md only, at most 1,000 characters per file. The repo has no CLAUDE.md, not even as a symlink, since Claude reads AGENTS.md. The check covers tracked and untracked files; gitignored local files are personal and stay out of it.
|
|
29
29
|
- Unit tests stay out of git, in a gitignored `test/unit/`. The pre-commit hook requires them to execute every staged line in `src/`.
|
|
30
30
|
|
|
31
|
+
## Versions pinned in workflow files
|
|
32
|
+
|
|
33
|
+
Renovate updates `uses:` actions and `package.json` on its own, but not a version written into a workflow's `env:`, a `with:` input or a `run:` line. The preset reads [Renovate's documented annotation](https://docs.renovatebot.com/modules/manager/regex/#advanced-capture) on the line above such a pin, in `.github/workflows/*.yml` and any `action.yml`:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
# renovate: datasource=<npm|github-releases|github-tags|go|docker|…> depName=<name> [packageName=…] [versioning=…] [extractVersion=…] [registryUrl=…]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The optional fields go in that order. The version is the first one on the next line after a `:`, an `=` or an `@`, starting with a digit or `v` and a digit. Without `versioning=` it is compared as `semver-coerced`, so `24` and `v2.12.2` work too. One example per shape:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
env:
|
|
43
|
+
# renovate: datasource=github-releases depName=rhysd/actionlint extractVersion=^v(?<version>.+)$
|
|
44
|
+
ACTIONLINT: 1.7.7
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
with:
|
|
49
|
+
# renovate: datasource=github-tags depName=nodejs/node versioning=node
|
|
50
|
+
node-version: 22.11.0
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
# renovate: datasource=github-tags depName=owner/action
|
|
55
|
+
- uses: owner/action@v4.1.0
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
# renovate: datasource=npm depName=playwright-core
|
|
60
|
+
- run: npm i -g playwright-core@1.63.0
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
When a command needs the version more than once, as actionlint's download does, put it in `env:` once and use the variable, so a single annotated value moves. Renovate's `github-actions` manager already updates ordinary `uses:` refs, by tag or commit SHA, so annotate a `uses:` only when its ref should follow some other datasource.
|
|
64
|
+
|
|
65
|
+
Pin only where a fixed version is genuinely needed. When a workflow rolls forward to whatever is certified, as with `@ai-ecoverse/slicc-kernel` and its certified siblings, resolve "the newest certified" at run time instead (from the npm `latest` dist-tag, say) rather than pinning and annotating it.
|
|
66
|
+
|
|
31
67
|
## Which unit tests a commit runs
|
|
32
68
|
|
|
33
69
|
The diff-coverage hook, `slicc-unit-cover`, runs only the unit tests that cover the staged change, then `slicc-diff-cover` on their `coverage/unit/lcov.info`, so every staged line in `src/` still has to run:
|
|
@@ -114,7 +150,7 @@ A pause in one target blocks every page in the same renderer process, so those p
|
|
|
114
150
|
Why it works the way it does:
|
|
115
151
|
|
|
116
152
|
- Playwright detaches from shared workers, which resumes them early, so their coverage started late about half the time. Raw CDP keeps every worker paused until the profiler runs.
|
|
117
|
-
- `debugger;` pauses in `beforeunload` but not in `pagehide` or `pageswap`, so a `beforeunload` hook, installed after `Page.enable`, takes the coverage of a page before it navigates. The pause only answers CDP when the page itself starts the navigation, so `goto` and `reload` go through `location`, never `Page.navigate` or `Page.reload
|
|
153
|
+
- `debugger;` pauses in `beforeunload` but not in `pagehide` or `pageswap`, so a `beforeunload` hook, installed after `Page.enable`, takes the coverage of a page before it navigates. The pause only answers CDP when the page itself starts the navigation, so `goto` and `reload` go through `location`, never `Page.navigate` or `Page.reload`; they schedule it with `setTimeout` in an isolated world of the page (so page code that replaces its timers can't stop it), so the `Runtime.evaluate` that starts it answers before the old document goes, which otherwise loses the race on a slow runner ("Inspected target navigated or closed"). Navigating away from `about:blank` skips the coverage dump so the first real load is not held in `beforeunload` for a useless snapshot.
|
|
118
154
|
- `goto` used to return as soon as the document swapped (`window.stale` cleared), which is before `readyState` is `complete` and before module scripts run. About 1 load in 20 then looked blank to the next assertion. It now waits for a complete, non-blank document.
|
|
119
155
|
- `takePreciseCoverage` resets the counters, so every snapshot is a delta, and all of them are kept and summed.
|
|
120
156
|
- monocart's `add()` from parallel test processes loses data, so each test writes raw JSON and the teardown merges it once.
|
|
@@ -13,9 +13,10 @@ if [ -z "$report" ]; then
|
|
|
13
13
|
printf 'slicc-lint-comments: the no-comment checker produced no report\n' >&2
|
|
14
14
|
exit 1
|
|
15
15
|
fi
|
|
16
|
-
|
|
16
|
+
renovate='^(\.github/workflows/[^/:]+|(.+/)?action)\.ya?ml:[0-9]+: comment not allowed: # renovate: datasource=[a-z.-]+ depName=[^ ]+( packageName=[^ ]+)?( versioning=[^ ]+)?( extractVersion=[^ ]+)?( registryUrl=[^ ]+)?$'
|
|
17
|
+
rest=$(printf '%s\n' "$report" | grep -vE '^ok: |^(.+/)?AGENTS\.md: documentation file is not allowed' | grep -vE "$renovate" || true)
|
|
17
18
|
if [ -n "$rest" ]; then
|
|
18
19
|
printf '%s\n' "$rest" >&2
|
|
19
20
|
exit 1
|
|
20
21
|
fi
|
|
21
|
-
printf 'ok: no comments, and no documentation besides README.md and AGENTS.md\n'
|
|
22
|
+
printf 'ok: no comments besides # renovate: annotations, and no documentation besides README.md and AGENTS.md\n'
|
package/default.json
CHANGED
|
@@ -27,6 +27,19 @@
|
|
|
27
27
|
"https://cdn\\.jsdelivr\\.net/npm/(?<depName>(?:@[^/@\\s'\"`]+/)?[^/@\\s'\"`]+)@(?<currentValue>\\d[^/\\s'\"`]*)"
|
|
28
28
|
],
|
|
29
29
|
"datasourceTemplate": "npm"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"customType": "regex",
|
|
33
|
+
"description": "Versions pinned in workflow and action files, each annotated on the line above with # renovate: datasource=<datasource> depName=<name>, optionally followed by packageName=, versioning=, extractVersion= and registryUrl=. The version is the first one on the next line that follows a colon, an equals sign or an @, so it covers env: values, with: inputs, uses: refs and inline pkg@version installs.",
|
|
34
|
+
"managerFilePatterns": [
|
|
35
|
+
"/(^|/)\\.github/workflows/[^/]+\\.ya?ml$/",
|
|
36
|
+
"/(^|/)action\\.ya?ml$/"
|
|
37
|
+
],
|
|
38
|
+
"matchStrings": [
|
|
39
|
+
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: packageName=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?[ \\t]*\\r?\\n[^\\n]*?(?:[:=][ \\t]*[\"']?|@)(?<currentValue>v?\\d[^\\s\"'@,]*)"
|
|
40
|
+
],
|
|
41
|
+
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver-coerced{{/if}}",
|
|
42
|
+
"extractVersionTemplate": "{{#if extractVersion}}{{{extractVersion}}}{{/if}}"
|
|
30
43
|
}
|
|
31
44
|
],
|
|
32
45
|
"packageRules": [
|
|
@@ -58,10 +71,14 @@
|
|
|
58
71
|
"prPriority": 10
|
|
59
72
|
},
|
|
60
73
|
{
|
|
61
|
-
"description": "
|
|
62
|
-
"matchPackageNames": ["@ai-ecoverse/
|
|
74
|
+
"description": "Our own packages version their builds as <upstream version>-<build>, such as wasm-coreutils 9.12.0-6 or wasm-tls-engine 3.6.7-1, which Renovate reads as prereleases and by default never offers, so a pin like 3.6.5-1 never moves. Allow unstable versions, but never past the npm latest dist-tag, which homescoop moves only to certified builds, so a build that is only on stage or next is not offered.",
|
|
75
|
+
"matchPackageNames": ["@ai-ecoverse/{/,}**"],
|
|
63
76
|
"ignoreUnstable": false,
|
|
64
|
-
"respectLatest": true
|
|
77
|
+
"respectLatest": true
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"description": "fnox-build publishes @ai-ecoverse/fnox and its platform packages only as <upstream fnox version>-slicc.<build> prereleases, with latest pointing at the newest; take only the -slicc.N ones.",
|
|
81
|
+
"matchPackageNames": ["@ai-ecoverse/fnox", "@ai-ecoverse/fnox-*"],
|
|
65
82
|
"allowedVersions": "/-slicc\\.\\d+$/"
|
|
66
83
|
},
|
|
67
84
|
{
|
package/harness/page.mjs
CHANGED
|
@@ -187,7 +187,12 @@ export function page(
|
|
|
187
187
|
async function navigate(expression) {
|
|
188
188
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
189
189
|
await evaluate(mark);
|
|
190
|
-
await send('
|
|
190
|
+
const { frameTree } = await send('Page.getFrameTree');
|
|
191
|
+
const { executionContextId: contextId } = await send('Page.createIsolatedWorld', {
|
|
192
|
+
frameId: frameTree.frame.id,
|
|
193
|
+
worldName: 'slicc-harness-navigate',
|
|
194
|
+
});
|
|
195
|
+
await send('Runtime.evaluate', { expression, contextId });
|
|
191
196
|
try {
|
|
192
197
|
await until(fresh);
|
|
193
198
|
return;
|
|
@@ -207,8 +212,11 @@ export function page(
|
|
|
207
212
|
within,
|
|
208
213
|
probed: () => Promise.all(probes),
|
|
209
214
|
press,
|
|
210
|
-
goto: (path) =>
|
|
211
|
-
|
|
215
|
+
goto: (path) =>
|
|
216
|
+
navigate(
|
|
217
|
+
`setTimeout(() => location.assign(${JSON.stringify(new URL(path, server.url).href)}))`
|
|
218
|
+
),
|
|
219
|
+
reload: () => navigate('setTimeout(() => location.reload())'),
|
|
212
220
|
insert: (text) => send('Input.insertText', { text }),
|
|
213
221
|
close: () => cdp.send('Target.closeTarget', { targetId }),
|
|
214
222
|
enter: () => press('Enter'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-shared-web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
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",
|