@ai-ecoverse/slicc-shared-web 2.4.4 → 2.5.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 CHANGED
@@ -68,16 +68,18 @@ The caller cancels superseded runs on pull requests only, so a push to `main` ne
68
68
 
69
69
  **Deploy** runs on pull requests only, never in the merge queue, with `id-token: write` for an OIDC-authenticated deploy. The merge queue's tests therefore run without `STAGING_URL`: a test that needs it skips when it's empty. It runs the `deploy` command with every secret the caller passes as an environment variable, except the pipeline's own `AWS_BEARER_TOKEN_BEDROCK`, `SLICC_ISSUES_TOKEN` and `github_token`. The command writes `url=<staging URL>` to `$GITHUB_OUTPUT`; the tests and the reviewers get it as `STAGING_URL`. With `deploy-secrets`, a newline- or space-separated list of secret names, only those of them are exported.
70
70
 
71
- **Integration tests** install Chrome for Testing with `slicc-cdp install-browser` (with `--with-deps` where the runner has root or passwordless sudo) (`--version` from the `chrome` input, stable without it), then split the files matching `test-glob` across `shards` jobs by their timings, with [split-tests-by-timings](https://github.com/marketplace/actions/split-tests-by-timings). The timings are the JUnit reports of the latest completed run of the same workflow; without one, the split is by count. Each shard runs the repo's own `test` command unchanged: `harness/shard.cjs`, preloaded through `NODE_OPTIONS`, makes the outermost `node --test` run only the shard's files that its own patterns match, writes `junit/<shard>.xml` next to the usual spec output, and then takes itself out of the environment, so a `node --test` that a test starts runs as it would without it. Files a `node --test` call would run that are not in `test-glob` (unit tests, say, whether in the same call or another) run on shard 0 only, so nothing is dropped; when `test-glob` matches nothing, shard 0 runs the command unchanged and the others run nothing. Each call keeps its own JUnit report (`junit/<shard>-<pid>.xml` for all but the last). Each shard uploads `coverage/`, `artifacts/` and `junit/` as `integration-<shard>`. `integration` passes only when every shard did, so it is the one check to require, under the caller's job name (`ci / integration`). A suite whose last step reads every test's artifacts, as this repo's `verify.mjs` does, sets `shards: 1`.
71
+ **Integration tests** install Chrome for Testing with `slicc-cdp install-browser` (with `--with-deps` where the runner has root or passwordless sudo) (`--version` from the `chrome` input, stable without it), then split the files matching `test-glob` across `shards` jobs by their timings, with [split-tests-by-timings](https://github.com/marketplace/actions/split-tests-by-timings). The timings are the JUnit reports of the latest completed run of the same workflow; without one, the split is by count. Each shard runs the repo's own `test` command unchanged: `harness/shard.cjs`, preloaded through `NODE_OPTIONS`, makes the outermost `node --test` run only the shard's files that its own patterns match, writes `junit/<shard>.xml` next to the usual spec output, and then takes itself out of the environment, so a `node --test` that a test starts runs as it would without it. Files a `node --test` call would run that are not in `test-glob` (unit tests, say, whether in the same call or another) run on shard 0 only, so nothing is dropped; when `test-glob` matches nothing, shard 0 runs the command unchanged and the others run nothing. Each call keeps its own JUnit report (`junit/<shard>-<pid>.xml` for all but the last). Each shard uploads `coverage/`, `artifacts/` and `junit/` as `integration-<shard>`. `integration` passes only when every shard did and their JUnit reports add up to at least one test that ran, not skipped, and no failure or error (the placeholder an empty shard runs doesn't count), and it prints `integration: PASS <n> tests (<k> skipped) in <m> JUnit reports` or `integration: FAIL <why>`; a repo without node tests sets `require-tests: false`. Setting `NODE_OPTIONS` in `test` would replace the pipeline's own, which carry the shard preload and the JUnit reporter, so extra node flags (a bigger heap, say) go in `node-options`. `integration` is therefore the one check to require for the tests, under the caller's job name (`ci / integration`). A suite whose last step reads every test's artifacts, as this repo's `verify.mjs` does, sets `shards: 1`.
72
72
 
73
73
  **Reviewer** runs twice, once with [claude-code-action](https://github.com/anthropics/claude-code-action) and once with [codex-action](https://github.com/openai/codex-action), on the same prompt, whether the tests passed or not. Both run on Amazon Bedrock with the org secret `AWS_BEARER_TOKEN_BEDROCK`, in the region of the org variable `CERT_AWS_REGION` (`us-west-2` without it). Claude uses the model in `CERT_BEDROCK_MODEL` (`global.anthropic.claude-opus-5-5` without it), as the cert reviews do. Codex uses its built-in `amazon-bedrock-runtime` provider (codex-action waits for its OpenAI proxy's `<run id>.json` in `codex-home` whenever it has a prompt, so the job writes a placeholder one) and the model in `CODEX_BEDROCK_MODEL` (`global.openai.gpt-6.1-sol` without it). Models that Bedrock serves only through inference profiles, as Sol 6.1 is, need the runtime provider and the profile's `global.` id; the `amazon-bedrock` provider's endpoint doesn't list them. The job token can only read. Each reviewer gets:
74
74
 
75
75
  - the pull request's head as the working directory and its base in `$RUNNER_TEMP/base`, each after `npm ci` (claude-code-action needs the working directory to be a checkout, and a base nested inside it would break the head's Biome config);
76
76
  - `review/integration/`, every shard's artifact;
77
77
  - `review/context/`, from the `context` job: the pull request with its comments, reviews and diff, the repo's issues and recent pull requests;
78
- - `review/browsers.json`: four headed Chrome instances on one machine (on Xvfb display `:99` when the runner has no `DISPLAY`, since headless Chrome behaves slightly differently), `head` and `base` each linked through the extension and through slicc-cli, on CDP ports 9301 to 9304. For each one the job runs `review-browser` (by default `npm run --if-present review:browser`) in that side's tree with `SLICC_REVIEW_SIDE` (`head` or `base`), `SLICC_REVIEW_LINK` (`extension` or `cli`) and `SLICC_REVIEW_CDP`, so the repo loads its own build into that browser;
78
+ - `review/browsers.json`: four headed Chrome instances on one machine (on Xvfb display `:99` when the runner has no `DISPLAY`, since headless Chrome behaves slightly differently), `head` and `base` each linked through the extension and through slicc-cli, on CDP ports 9301 to 9304. For each one the job runs `review-browser` (by default `npm run --if-present review:browser`) in that side's tree with `SLICC_REVIEW_SIDE` (`head` or `base`), `SLICC_REVIEW_LINK` (`extension` or `cli`) and `SLICC_REVIEW_CDP`, so the repo loads its own build into that browser. Every one of them also runs the [harness extension](#harness-extension) (loaded with `--load-extension`), so the review sees pages the way a user with a content-script extension does;
79
79
  - `review-prompt`, appended to the shared prompt.
80
80
 
81
+ A reviewer can attach screenshots: it saves PNGs to `review/shots/` and references them in the summary, a comment or an issue as `![what it shows](shots/name.png)`. `post` uploads them to R2 (the bucket in `R2_BUCKET`, `slicc-pr-screenshots` by default, under `<repo>/pr-<n>/<commit>/<reviewer>/`) with `CLOUDFLARE_API_TOKEN`, which only `post` gets, and rewrites each reference to its public URL (`R2_PUBLIC_BASE_URL`); without the token, a reference becomes a link to the run, whose `findings-<reviewer>` artifact holds the files.
82
+
81
83
  Each reviewer answers with `findings.json`, held to one JSON schema:
82
84
 
83
85
  ```json
@@ -91,7 +93,7 @@ Each reviewer answers with `findings.json`, held to one JSON schema:
91
93
 
92
94
  **Post** is the only job that writes to GitHub. Per reviewer it sets the commit status `review / claude` or `review / codex` (`success` for `approved`, `failure` for `denied`, `error` without findings), keeps one comment with its latest verdict and summary on the pull request (edited on each run), posts each comment on its line (or, for a line outside the diff, as a pull request comment naming it) unless the same comment is already there, and opens each issue unless one with the same title is already open. An issue in another repo of the same org needs `SLICC_ISSUES_TOKEN`, a token that can open issues there; one outside the org is logged and skipped.
93
95
 
94
- **Release** runs `semantic-release` after lint, without any test: what reached `main` went through the merge queue. GitHub sometimes rejects a push right after the tag push with a bare `(failed)`, most often semantic-release's push of `refs/notes/semantic-release-vX.Y.Z`, so the step puts a small `git` wrapper first on `PATH`: it retries `git push` and `git fetch` up to five times, 5, 10, 15 and 20 seconds apart, and runs every other git command once, as well as semantic-release's `git fetch --unshallow`, which fails on the job's full clone by design before semantic-release falls back to a plain fetch. When the push still fails, semantic-release fails before it publishes. With `release-environment`, the job runs in that GitHub environment, and `after-release` is a command run after semantic-release when it released, that is when a new `v*` tag points at the commit, with that version as `RELEASE_VERSION` (a production deploy, say). It gets the job's OIDC token and no secrets.
96
+ **Release** runs `semantic-release` after lint, on a push to `main` only, without any test: what reached `main` went through the merge queue. GitHub sometimes rejects a push right after the tag push with a bare `(failed)`, most often semantic-release's push of `refs/notes/semantic-release-vX.Y.Z`, so the step puts a small `git` wrapper first on `PATH`: it retries `git push` and `git fetch` up to five times, 5, 10, 15 and 20 seconds apart, and runs every other git command once, as well as semantic-release's `git fetch --unshallow`, which fails on the job's full clone by design before semantic-release falls back to a plain fetch. When the push still fails, semantic-release fails before it publishes. With `release-environment`, the job runs in that GitHub environment, and `after-release` is a command run after semantic-release when it released, that is when a new `v*` tag points at the commit, with that version as `RELEASE_VERSION` (a production deploy, say). It gets the job's OIDC token and no secrets.
95
97
 
96
98
  **Review** is the check that stands for the reviews. On a pull request that gets a review it passes when both reviewers' `findings.json` say `approved`; when the repo can't read `AWS_BEARER_TOKEN_BEDROCK`, the reviewers don't start and it fails, naming the secret. On one that doesn't (a Renovate pull request outside `review-renovate`) it passes when `integration` did. In the merge queue it always passes, since the pull request was reviewed already. Require it next to `ci / integration`, as `ci / review`.
97
99
 
@@ -125,6 +127,8 @@ The commands in `lint`, `test`, `deploy`, `review-browser` and `after-release` r
125
127
  | `review-browser` | `npm run --if-present review:browser` | |
126
128
  | `review-prompt` | none | |
127
129
  | `review-renovate` | none | globs of Renovate group slugs whose pull requests get a review |
130
+ | `node-options` | none | node flags added to the test step's `NODE_OPTIONS`, such as `--max-old-space-size=8192` |
131
+ | `require-tests` | `true` | `integration` fails when no test ran |
128
132
  | `release-environment` | none | the GitHub environment the release job runs in |
129
133
  | `after-release` | none | a command run after semantic-release, with `RELEASE_VERSION` |
130
134
 
@@ -132,6 +136,7 @@ The commands in `lint`, `test`, `deploy`, `review-browser` and `after-release` r
132
136
  |---|---|
133
137
  | `AWS_BEARER_TOKEN_BEDROCK` (org secret) | both reviewers |
134
138
  | `SLICC_ISSUES_TOKEN` | issues in other repos |
139
+ | `CLOUDFLARE_API_TOKEN` | `post`, for reviewers' screenshots in R2 |
135
140
  | anything else | `deploy`, as environment variables |
136
141
 
137
142
  Pull requests from forks are not supported: GitHub gives them no secrets, so the reviewers can't run and `ci / review` stays red. A maintainer opens the change again from a branch in the repo.
@@ -248,7 +253,7 @@ The diff-coverage hook, `slicc-unit-cover`, runs only the unit tests that cover
248
253
  - **A staged source file missing from the lcov:** the hook fails and names it, so no file passes diff coverage just because nothing measured it. `.jsx` and `.tsx` files are not transformed for coverage, so staging one under the sources fails the hook too.
249
254
  - **A file that won't parse:** one warning line, then every unit test.
250
255
 
251
- The hook passes the list to the repo's own `test:unit` in `SLICC_UNIT_TESTS` (one path per line). A selection of more than `SLICC_UNIT_BATCH` files (60 by default) runs in batches of that size, one `test:unit` run each with its own coverage in `coverage/unit/batch-N/` (the shared `mcr.config.mjs` writes to `SLICC_UNIT_COVERAGE_DIR` when it's set), and `slicc-diff-cover` gets every batch's `lcov.info`; diff-cover counts a line covered when any batch covered it. The hook ends with one verdict line over all batches, `slicc-unit-cover: PASS …` or `slicc-unit-cover: FAIL …` (the first failing batch stops the run and fails it; diff coverage then doesn't run). That keeps the coverage merge, which grows with the number of test files, small enough for a memory-capped hook on a widely imported file. A `--require` preload, which `slicc-unit-cover` and the shared `mcr.config.mjs` add to `NODE_OPTIONS`, makes the `node --test` process run the files on that list that its own patterns match, and none when the list is empty. Without the variable, `npm run test:unit` runs everything as before. In the hook the same preload bounds each test file's process (with the default `--test-isolation=process`; `none` runs no such processes, so nothing is bounded): every test gets `--test-timeout` (`SLICC_UNIT_TIMEOUT` ms, 60000 by default, `0` turns all of these bounds off), a file still running `SLICC_UNIT_TIMEOUT` ms after its tests ended (its top-level `after()` hooks get that long too) is ended, and a file whose event loop is blocked, or that has no test running and nothing finishing, for `SLICC_UNIT_TIMEOUT` + 5 s (one that hangs at top level, or a `before()` hook running that long) is killed; a test's own longer `timeout` is honoured. The FAIL verdict names each test that timed out and each file that was ended (`… was still running 60000ms after its tests ended, open handles kept it alive (TCPServerWrap)`) or killed, and such a file fails even when its tests passed. A value of either variable that isn't a whole number of milliseconds fails the hook before any test runs, rather than silently turning its bound off. Each `test:unit` run also has a wall-clock limit, `SLICC_UNIT_BATCH_TIMEOUT` ms (600000 by default, `0` for none): past it the run's whole process group is killed and the FAIL verdict names the batch and its files, which catches anything the per-file bounds miss, such as a test with an unlimited `timeout` of its own. To force a full run in the hook:
256
+ The hook passes the list to the repo's own `test:unit` in `SLICC_UNIT_TESTS` (one path per line). A selection of more than `SLICC_UNIT_BATCH` files (60 by default) runs in batches of that size, one `test:unit` run each with its own coverage in `coverage/unit/batch-N/` (the shared `mcr.config.mjs` writes to `SLICC_UNIT_COVERAGE_DIR` when it's set), and `slicc-diff-cover` gets every batch's `lcov.info`; diff-cover counts a line covered when any batch covered it. The hook ends with one verdict line over all batches, `slicc-unit-cover: PASS …` or `slicc-unit-cover: FAIL …` (the first failing batch stops the run and fails it; diff coverage then doesn't run). That keeps the coverage merge, which grows with the number of test files, small enough for a memory-capped hook on a widely imported file. A `--require` preload, which `slicc-unit-cover` and the shared `mcr.config.mjs` add to `NODE_OPTIONS`, makes the `node --test` process run the files on that list that its own patterns match, and none when the list is empty. Without the variable, `npm run test:unit` runs everything as before. In the hook the same preload bounds each test file's process (with the default `--test-isolation=process`; `none` runs no such processes, so nothing is bounded): every test gets `--test-timeout` (`SLICC_UNIT_TIMEOUT` ms, 60000 by default, `0` turns all of these bounds off), a file still running `SLICC_UNIT_TIMEOUT` ms after its tests ended (its top-level `after()` hooks get that long too) is ended, and a file whose event loop is blocked, or that has no test running and nothing finishing, for `SLICC_UNIT_TIMEOUT` + 5 s (one that hangs at top level, or a `before()` hook running that long) is killed; a test's own longer `timeout` is honoured. The FAIL verdict names each test that timed out and each file that was ended (`… was still running 60000ms after its tests ended, open handles kept it alive (TCPServerWrap)`) or killed, and such a file fails even when its tests passed. A value of either variable that isn't a whole number of milliseconds up to 2147483647 (the longest `setTimeout` delay) fails the hook before any test runs, rather than silently turning its bound off. Each `test:unit` run also has a wall-clock limit, `SLICC_UNIT_BATCH_TIMEOUT` ms (600000 by default, `0` for none): past it the run's whole process group is killed and the FAIL verdict names the batch and its files, which catches anything the per-file bounds miss, such as a test with an unlimited `timeout` of its own. To force a full run in the hook:
252
257
 
253
258
  ```sh
254
259
  SLICC_UNIT_ALL=1 git commit
@@ -95,10 +95,10 @@ if (jsx.length > 0) {
95
95
 
96
96
  const ms = (name, fallback) => {
97
97
  const value = process.env[name] ?? fallback;
98
- if (/^\d+$/.test(value)) return Number(value);
98
+ if (/^\d+$/.test(value) && Number(value) <= 2147483647) return Number(value);
99
99
  verdict(
100
100
  false,
101
- `${name} must be a whole number of milliseconds, 0 for none, not ${JSON.stringify(value)}`
101
+ `${name} must be a whole number of milliseconds up to 2147483647, 0 for none, not ${JSON.stringify(value)}`
102
102
  );
103
103
  };
104
104
  const timeout = ms('SLICC_UNIT_TIMEOUT', '60000');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-shared-web",
3
- "version": "2.4.4",
3
+ "version": "2.5.0",
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",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@ai-ecoverse/slicc-browsers": "1.15.0",
68
- "@ai-ecoverse/slicc-cdp": "1.30.22",
68
+ "@ai-ecoverse/slicc-cdp": "1.30.23",
69
69
  "@biomejs/biome": "2.5.15",
70
70
  "lefthook": "2.2.2",
71
71
  "monocart-coverage-reports": "2.13.2",