@ai-ecoverse/slicc-shared-web 2.19.1 → 2.20.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.
Files changed (2) hide show
  1. package/README.md +16 -2
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -71,10 +71,22 @@ The caller cancels superseded runs on pull requests only, so a push to `main` ne
71
71
 
72
72
  **Lint** fails the run, and nothing after it starts.
73
73
 
74
- **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 pull request's own code, so it gets no secret unless `deploy-secrets` names it: a newline- or space-separated list of secret names, which the step exports as environment variables. The pipeline's own `AWS_BEARER_TOKEN_BEDROCK`, `SLICC_ISSUES_TOKEN`, `CLOUDFLARE_API_TOKEN` and `github_token` are never exported. The command writes `url=<staging URL>` to `$GITHUB_OUTPUT`; the tests and the reviewers get it as `STAGING_URL`. The environment url is published as scheme, host and path, without query string or fragment.
74
+ **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 pull request's own code, so it gets no secret unless `deploy-secrets` names it: a newline- or space-separated list of secret names, which the step exports as environment variables. The pipeline's own `AWS_BEARER_TOKEN_BEDROCK`, `SLICC_ISSUES_TOKEN`, `CLOUDFLARE_API_TOKEN` and `github_token` are never exported. A name starting with `PIPELINE_`, in any case, fails the step before it exports anything, with an error that gives only its position in the list, such as `entry 2 of deploy-secrets starts with a prefix the pipeline keeps for its own secrets`, so a numbered test slot never reaches the deploy. The command writes `url=<staging URL>` to `$GITHUB_OUTPUT`; the tests and the reviewers get it as `STAGING_URL`. The environment url is published as scheme, host and path, without query string or fragment. In a public repo the deploy outputs and the step summary are public, so they must carry no secret.
75
75
 
76
76
  **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 each runs its share of the files matching `test-glob`. `lint` plans the split once for all `shards`, so the shards can't disagree: it weighs each file by the most it took in the last ten completed runs of the same workflow that uploaded `timings` (merge queue runs first, then pull request runs, none from a fork), since a file that downloads a lot can take several times its median when the network is slow. Files whose most is over twice their median go first, longest first, each to the shard with the fewest of them (then the least time), so the files that are slow together in a slow run don't pile up on one shard; then every other file goes to the shard with the least time so far, longest first; a file without a timing counts as the average, and without any timings every file counts the same. `integration` uploads each run's `junit/**/*.times` and `junit/**/*.xml` as one `timings` artifact, so `lint` downloads one artifact per earlier run through the REST API with the job token (about a dozen requests a run, of the repo's 1,000 an hour); until a run has one, it reads the `junit-*` artifacts of the newest run that has them. Its log names the predicted seconds of each shard, how many files had timings, from which runs, and which files took over twice their median. A file's time is its own wall time where `shard.cjs` recorded one: it preloads `harness/file-time.cjs` into each test file's own process, which writes the file's wall time to `junit/<shard>-<pid>.times` when it exits, so tests registered through a shared helper still count for the file that ran them. Otherwise it is the sum of the JUnit times of the tests that name the file, and Node names the file that calls `test()`. 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>`. Before its tests, each shard restores the harness's download cache, `node_modules/.cache/slicc-harness/cdn` (after `npm ci`, which would remove it), from the newest cache whose key starts with `slicc-harness-cdn-<OS>-<hash of every package-lock.json and pnpm-lock.yaml>`, else `slicc-harness-cdn-<OS>-`, so a lockfile change still starts warm. The harness's `download()` lists each npm tarball and exact-version jsdelivr file it served in the file `SLICC_TEST_DOWNLOADS` names, which the shard sets to `junit/<shard>.downloads` (an older `@ai-ecoverse/slicc-shared-web` lists nothing, so its cache stays empty). Shards only restore: a cache saved on a pull request or in the merge queue would be scoped to that ref, so no later run could use it. On a push to `main`, `downloads` reads those lists from the newest successful merge queue run (else pull request run, never a fork's), restores the cache, fetches what's missing (only tarballs from `registry.npmjs.org` and exact-version files from `cdn.jsdelivr.net`), deletes what no shard listed, and saves it under the key plus a hash of the list, only when the list changed. The cache never holds packuments, attestations or other files that can change, so a restored cache can't serve stale metadata; those are fetched fresh as before. `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 every file matching `test-glob` was handed to `node --test` on exactly one shard (`shard.cjs` lists the files it hands over next to its JUnit report, as `junit/<shard>-<pid>.files`, since a test registered through a helper is attributed to the helper); a file that ran on no shard or on two is named as an error, and it prints `integration: PASS <n> tests (<k> skipped) in <m> JUnit reports, <f> of <f> test-glob files on exactly one shard` 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`.
77
77
 
78
+ **Test secrets.** With `test-secrets`, a space- or newline-separated list of up to 8 names (any case), each shard's Integration tests step gets the values of the numbered secrets `PIPELINE_TEST_SECRET_1` to `PIPELINE_TEST_SECRET_8`, which the pipeline declares (all optional), as environment variables under those names in upper case: the first name gets slot 1, the second slot 2, and so on. It does so on a pull request from a branch of the repo only, never in the merge queue, on `main` or on a fork's pull request, and no other step or job reads a slot. The caller maps its secrets to the slots:
79
+
80
+ ```yaml
81
+ secrets:
82
+ PIPELINE_TEST_SECRET_1: ${{ secrets.SLICC_KERNEL_STAGING_KEY_SECRET }}
83
+ AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }}
84
+ with:
85
+ test-secrets: SLICC_KERNEL_STAGING_KEY_SECRET
86
+ ```
87
+
88
+ An explicit `secrets:` map replaces `secrets: inherit`, so the caller passes every secret the pipeline should get, the reviewers' `AWS_BEARER_TOKEN_BEDROCK` included, and `deploy-secrets` and `release-secrets` then see only those; a caller that keeps `secrets: inherit` fills the slots with repo or org secrets named `PIPELINE_TEST_SECRET_<n>`. The names come from the caller workflow on the pull request's own branch, the same trust as `deploy-secrets`. Each name must match `^[A-Za-z_][A-Za-z0-9_]{0,99}$`, appear once, and not be one of the pipeline's own `github_token`, `AWS_BEARER_TOKEN_BEDROCK`, `SLICC_ISSUES_TOKEN` and `CLOUDFLARE_API_TOKEN`, which `deploy-secrets` never exports either, or a name the step, the shell, the C library or the runner uses: one starting with `GITHUB_`, `RUNNER_`, `ACTIONS_`, `SLICC_TEST_`, `SLICC_PIPELINE_`, `PIPELINE_TEST_SECRET_`, `BASH`, `LD_`, `DYLD_`, `LC_`, `MALLOC_`, `COMP_`, `READLINE_`, `GLIBC_`, `NIS_`, `RESOLV_`, `SEGFAULT_` or `MEMUSAGE_`, or one of a fixed list that holds `SLICC_ARTIFACTS`, the three `SLICC_REVIEW_` names, `PATH`, `HOME`, `SHELL`, `USER`, `LOGNAME`, `ENV`, `IFS`, `TMPDIR`, `TMP`, `TEMP`, `TZ`, `LANG`, `LANGUAGE`, `TERM`, `TERMINFO`, `EDITOR`, `VISUAL`, `PAGER`, `DISPLAY`, every variable Node 24 and the current Node release document in their CLI "Environment variables" section (`NODE_OPTIONS`, `NODE_PATH`, `NODE_DEBUG`, `NODE_EXTRA_CA_CERTS`, `NODE_TLS_REJECT_UNAUTHORIZED`, `NODE_V8_COVERAGE`, `NODE_COMPILE_CACHE`, `UV_THREADPOOL_SIZE`, `FORCE_COLOR`, `NO_COLOR`, `OPENSSL_CONF`, `SSL_CERT_FILE` and the rest) plus the ones it reads without documenting them there, such as `NODE_CHANNEL_FD`, `NODE_REPL_MODE`, `NODE_UNIQUE_ID` and `NODE_NO_READLINE`, the C library's `GCONV_PATH`, `LOCPATH`, `NLSPATH`, `RES_OPTIONS`, `HOSTALIASES` and the other variables it reads, the step's own variables, and bash's read-only and special variables such as `PS0` to `PS4`, `MAIL`, `MAILCHECK`, `MAILPATH`, the six `HIST` settings (`HISTFILE`, `HISTFILESIZE`, `HISTSIZE`, `HISTCONTROL`, `HISTIGNORE`, `HISTTIMEFORMAT`), `PROMPT_COMMAND`, `CDPATH`, `GLOBIGNORE`, `INPUTRC`, `TIMEFORMAT`, `POSIXLY_CORRECT`, `POSIX_PEDANTIC`, `TEXTDOMAIN`, `TEXTDOMAINDIR`, `UID`, `EUID`, `PPID`, `SHELLOPTS`, `PWD` and `RANDOM`. Names npm reads as its configuration, any starting with `NPM_CONFIG_`, are refused too. An ordinary name that merely starts like one of these, such as `PSQL_PASSWORD`, `MAILGUN_KEY` or `HISTORY_API_KEY`, is delivered, and so are `NODE_AUTH_TOKEN` and `NODE_ENV`. The check and the fold to upper case use explicit ASCII letter lists rather than the locale, so `api_token` is `API_TOKEN` under any `LC_ALL` or `LANG`, a Turkish one included. The list is a floor, not a promise of safety: it refuses the names known to change the shell, the C library, Node or the runner when exported, it may refuse fewer names than something can misuse, and a name it misses can still change how a program in the tests behaves; the names come from the caller's own pull request branch. More than 8 names, a repeated name, a refused name, or a slot with a value but no name fails the step before any test runs. Its errors print a name only when it is one of the pipeline's own secrets or on the fixed list; any other name is reported by its position, such as `entry 2 of test-secrets is not a secret name`, never printed. A name whose slot is empty is unset for the tests, even when the workflow environment defines it (the pipeline's own `LEFTHOOK`, say), and the tests run, as with `deploy-secrets` (a pull request from a bot that gets no Actions secrets stays green), with a warning that names only its position and slot, such as `entry 2 of test-secrets has no value in PIPELINE_TEST_SECRET_2`. The step runs under `/bin/bash -p -e`, so `BASH_ENV` and exported functions from earlier steps don't run in it. It checks the names, copies the slot values into shell variables and unsets the slots with bash builtins only, before it runs any program; it exports the values right before the test command, after Xvfb has started, so no process the step starts in the background holds one, and the test command (`bash -eo pipefail -c "$TEST"`, or the flaky rerun) starts as it does without the input. It reads and writes none of `GITHUB_ENV`, `GITHUB_OUTPUT`, `GITHUB_PATH` and the step summary. The runner masks the slot values in the log, but `junit/`, `coverage/` and `artifacts/` are uploaded as they are, so a test must not write a secret there. With the input empty, the existing step runs exactly as before.
89
+
78
90
  **Windows.** With `windows-test` set, a `windows` job runs after lint on pull requests and in the merge queue, on GitHub-hosted `windows-latest`: checkout, setup-node at `node-version`, `npm ci`, then `windows-test` as a PowerShell 7 (`pwsh`) command, raw like the other commands, so a package script is `npm run test:windows`; a program that exits non-zero stops it, as `bash -e` would. Its token can only read and it gets no secrets. `integration` fails unless it passed, so `ci / integration` covers it and no other check needs requiring; without the input it is skipped, costs no Windows minutes, and `integration` doesn't wait for it. This repo's own CI runs it with `node -e "process.platform==='win32'||process.exit(1)"` only on a pull request labelled `windows` (the label counts from the next push).
79
91
 
80
92
  ```yaml
@@ -110,7 +122,7 @@ Each reviewer answers with `findings.json`, held to one JSON schema:
110
122
 
111
123
  **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; without it, or when it is refused, the issue becomes a pull request comment instead. One outside the org is logged and skipped. Security findings stay in the review: a reviewer puts one in its summary or a line comment, never in an issue, and `post` files and posts no issue whose `security` isn't `false` (`true`, missing or not a boolean), logging only one line without its title or body, such as `kept a security finding out of the issue tracker (claude)`.
112
124
 
113
- **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. An `npm` wrapper, installed on PATH and temporarily at `node_modules/.bin/npm` so semantic-release's local binary lookup reaches it, checks `npm view <name>@<version> version` after every failed real publish using the publish directory's package.json. An exact visible version counts as success, including after E403 or an already-published error. If the version is absent, only `TLOG_CREATE_ENTRY_ERROR` or a 409 mentioning a transparency log, Sigstore or Rekor is retried, up to three attempts, 5 and 10 seconds apart. Every attempt keeps the publish arguments, including provenance; dry-run failures skip the registry check, and other failures keep their exit code. 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. With `release-secrets`, a newline- or space-separated list of secret names, semantic-release and `after-release` get those secrets as environment variables (signing keys, say); without it they get none. With `attest`, a path or glob (a newline-separated list for several), the job attests the build provenance of those files after a release, through GitHub artifact attestations, even when a later semantic-release step such as the npm publish failed once the `v*` tag was pushed, so that tag's release never goes without its attestation: the certificate names `ai-ecoverse/slicc-shared-web/.github/workflows/pipeline.yml` at the pipeline's tag, and its build configuration names the caller's `.github/workflows/ci.yml`, so a verifier checks both. It then attaches the attestation's Sigstore bundle (`actions/attest-build-provenance`'s `bundle-path`) to that tag's GitHub release, as `<file>.sigstore.json` when `attest` names a single file (`SHA256SUMS.sigstore.json` for `SHA256SUMS`) and as `attestation.sigstore.json` otherwise, through `gh release upload --clobber` with the job token, three attempts 5 and 10 seconds apart, failing the job when all three fail. A tag without a GitHub release (a caller whose semantic-release doesn't run `@semantic-release/github`) gets no bundle, and the step says so and passes. A client can download it like any release file and verify it offline, without the GitHub API and its rate limit of 60 requests an hour per IP address without a token; the bundle is the one the API serves, so trust comes from verifying it, not from where it came from. The release job asks for `attestations: write` whether or not `attest` is set, so the caller grants it.
125
+ **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. An `npm` wrapper, installed on PATH and temporarily at `node_modules/.bin/npm` so semantic-release's local binary lookup reaches it, checks `npm view <name>@<version> version` after every failed real publish using the publish directory's package.json. An exact visible version counts as success, including after E403 or an already-published error. If the version is absent, only `TLOG_CREATE_ENTRY_ERROR` or a 409 mentioning a transparency log, Sigstore or Rekor is retried, up to three attempts, 5 and 10 seconds apart. Every attempt keeps the publish arguments, including provenance; dry-run failures skip the registry check, and other failures keep their exit code. 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. With `release-secrets`, a newline- or space-separated list of secret names, semantic-release and `after-release` get those secrets as environment variables (signing keys, say); without it they get none. As with `deploy-secrets`, a name starting with `PIPELINE_` fails the step before it exports anything, naming only its position. With `attest`, a path or glob (a newline-separated list for several), the job attests the build provenance of those files after a release, through GitHub artifact attestations, even when a later semantic-release step such as the npm publish failed once the `v*` tag was pushed, so that tag's release never goes without its attestation: the certificate names `ai-ecoverse/slicc-shared-web/.github/workflows/pipeline.yml` at the pipeline's tag, and its build configuration names the caller's `.github/workflows/ci.yml`, so a verifier checks both. It then attaches the attestation's Sigstore bundle (`actions/attest-build-provenance`'s `bundle-path`) to that tag's GitHub release, as `<file>.sigstore.json` when `attest` names a single file (`SHA256SUMS.sigstore.json` for `SHA256SUMS`) and as `attestation.sigstore.json` otherwise, through `gh release upload --clobber` with the job token, three attempts 5 and 10 seconds apart, failing the job when all three fail. A tag without a GitHub release (a caller whose semantic-release doesn't run `@semantic-release/github`) gets no bundle, and the step says so and passes. A client can download it like any release file and verify it offline, without the GitHub API and its rate limit of 60 requests an hour per IP address without a token; the bundle is the one the API serves, so trust comes from verifying it, not from where it came from. The release job asks for `attestations: write` whether or not `attest` is set, so the caller grants it.
114
126
 
115
127
  **Artifacts the caller built.** A caller whose own jobs build something the tests or the reviewers need (packages, say) runs them before the pipeline (`needs:` on the job that `uses:` it) and names them with `artifacts`, a [download-artifact](https://github.com/actions/download-artifact) `pattern` such as `host-*`. Every test shard gets the matching artifacts of the run in `$RUNNER_TEMP/artifacts/<artifact>/`, and each reviewer in `$RUNNER_TEMP/review/artifacts/<artifact>/`, before `review-browser` runs, so the hook can load the change's build into both sides' browsers; the test step and the hook get that directory as `SLICC_ARTIFACTS`, and the prompt names it. Without `artifacts` nothing is downloaded and `SLICC_ARTIFACTS` is empty.
116
128
 
@@ -149,6 +161,7 @@ The commands in `lint`, `test`, `deploy`, `review-browser` and `after-release` r
149
161
  | `windows-test` | none | a `pwsh` command for the `windows` job on `windows-latest`, which `integration` then requires |
150
162
  | `deploy` | none | a command that deploys to staging |
151
163
  | `deploy-secrets` | none | newline- or space-separated secret names (any case) that `deploy` gets |
164
+ | `test-secrets` | none | up to 8 newline- or space-separated names (any case) under which only the Integration tests step gets the slots `PIPELINE_TEST_SECRET_1` to `PIPELINE_TEST_SECRET_8`, on pull requests from the repo, [above](#pipeline) |
152
165
  | `review-browser` | `npm run --if-present review:browser` | |
153
166
  | `artifacts` | none | a download-artifact `pattern` of this run's artifacts that the test shards and the reviewers get, as `SLICC_ARTIFACTS` |
154
167
  | `review-prompt` | none | |
@@ -172,6 +185,7 @@ The commands in `lint`, `test`, `deploy`, `review-browser` and `after-release` r
172
185
  | `AWS_BEARER_TOKEN_BEDROCK` (org secret) | both reviewers |
173
186
  | `SLICC_ISSUES_TOKEN` | issues in other repos |
174
187
  | `CLOUDFLARE_API_TOKEN` | `post`, for reviewers' screenshots in R2 |
188
+ | `PIPELINE_TEST_SECRET_1` to `PIPELINE_TEST_SECRET_8` | with `test-secrets`, the Integration tests step, under the names it lists |
175
189
  | anything else | `deploy`, as environment variables |
176
190
 
177
191
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-shared-web",
3
- "version": "2.19.1",
3
+ "version": "2.20.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",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@ai-ecoverse/slicc-browsers": "1.43.0",
79
- "@ai-ecoverse/slicc-cdp": "2.2.7",
79
+ "@ai-ecoverse/slicc-cdp": "2.2.8",
80
80
  "@biomejs/biome": "2.6.8",
81
81
  "lefthook": "2.2.2",
82
82
  "monocart-coverage-reports": "3.2.1",