@ai-ecoverse/slicc-shared-web 2.13.0 → 2.13.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 CHANGED
@@ -82,7 +82,7 @@ The caller cancels superseded runs on pull requests only, so a push to `main` ne
82
82
  windows-test: npm run test:windows
83
83
  ```
84
84
 
85
- **Flaky tests.** With `flaky-retry` above 0 (this repo's own CI sets 3; the default, 0, runs the tests once, as before), a shard whose tests failed reruns its failing files once, right away, on the same runner and commit, through `slicc-flaky retry`, which the test, `integration` and `flaky` jobs take from the pipeline's own commit. A test that fails, then passes is a flip; one that fails twice is a failure. A test is its file and its top-level name, and its key is the first 16 hex digits of `sha256(file \0 name)`. There is no rerun, and the shard fails as before, without a JUnit report or a failing test in it, with more than `flaky-retry` failing files, or when less than the rerun's limit, min(15 min, a quarter of `timeout-minutes`), is left of `timeout-minutes`. The rerun gets `SLICC_TEST_RETRY=1` and only those files, writes `junit/<shard>.retry.xml` (and no second `.files` list), keeps the first run's `artifacts/` and `coverage/` (its own artifacts go to `artifacts/retry/`), and is killed at the limit. `junit/<shard>.flaky.json` records each retried test's first and retry outcome, its first error and the runner. A flip passes the shard only if an open `flaky-test` issue has its key and has seen it on another commit (it has no `new` label, or its commit isn't this one), the test file doesn't match `strict-tests` and the pull request doesn't change it; every other flip stays red, and so does a test that is skipped, cancelled or missing on the rerun, a rerun that ran no test, wrote no JUnit report or timed out, and a test that passed first and failed on the rerun. Only the rerun's results count for those tests; its exit status doesn't, so a check after `node --test` in `test` (such as this repo's `verify.mjs`) doesn't fail a rerun of one file. `lint` reads the open `flaky-test` issues once (with `issues: read`) and the pull request's changed files, and hands them to the shards and `integration`; when it can't, no flake is known and every flip stays red. `integration` judges each shard's flips again from its JUnit reports and that list, counts only the failures it doesn't excuse, keeps every other check on the first run, and names the flakes: `integration: PASS … , 2 known flakes passed on retry (#916, #844)`. Each shard also uploads the tests that finally failed as `failed-<shard>-<attempt>`, and a test that failed on an earlier attempt of the run and passes now counts as a flip in the report, though not for the gate. The `flaky` job (`issues: write`, `actions: read`, `continue-on-error`) writes a table of the run's flips and failures to its step summary and files one issue per test: title `flaky: <file name> › <test name>`, label `flaky-test`, `new` until a second commit, `guard` for a strict row, whose issue and comments name only the test, the run and the commit, and ``Key: `<key>` `` in the body. It finds the issue among the open ones, then among those closed in the last 30 days, which it reopens, and otherwise opens one; it comments at most once per issue per run with the run and attempt, the event, the pull request, the shard, the runner, the commit and the first error (at most 3,000 characters). It posts nothing that holds the job token or a token-shaped string (the same scan the cert review's `post` had), nothing on a branch matching `flaky-quiet-branches`, nothing on a pull request whose run also has a failure or a shard that wasn't rerun, nothing for a test the pull request changes, and nothing at all when a run would open more than 5 issues (`flaky: <n> flips in one run, not filing (infrastructure?)`). In the merge queue, each open issue whose test passed first time gets `<!-- clean: <n> since <date> -->` in its body, which a flip clears; at `flaky-close-after` it is closed with `no flip in <n> clean merge-group runs since <date>; a new flip reopens it`. It needs `node --test` through the shared harness: `$TEST` must honour `SLICC_TEST_FILES` and write node's JUnit report with `file=`.
85
+ **Flaky tests.** With `flaky-retry` above 0 (this repo's own CI sets 3; the default, 0, runs the tests once, as before), a shard whose tests failed reruns its failing files once, right away, on the same runner and commit, through `slicc-flaky retry`, which the test, `integration` and `flaky` jobs take from the pipeline's own commit. A test that fails, then passes is a flip; one that fails twice is a failure. A test is its file and its top-level name, and its key is the first 16 hex digits of `sha256(file \0 name)`. There is no rerun, and the shard fails as before, without a JUnit report or a failing test in it, with more than `flaky-retry` failing files, or when less than the rerun's limit, min(15 min, a quarter of `timeout-minutes`), is left of `timeout-minutes`. A failing test whose JUnit `file=` isn't one of the run's `test-glob` files, such as Go's package directory, is never rerun (`not rerun: a failing test names no test file: <file>`), `integration` never excuses such a flip, whatever a shard's `flaky.json` says, and `flaky` logs it and files nothing. The rerun gets `SLICC_TEST_RETRY=1` and only those files, writes `junit/<shard>.retry.xml` (and no second `.files` list), keeps the first run's `artifacts/` and `coverage/` (its own artifacts go to `artifacts/retry/`), and is killed at the limit. `junit/<shard>.flaky.json` records each retried test's first and retry outcome, its first error and the runner. A flip passes the shard only if an open `flaky-test` issue has its key and has seen it on another commit (it has no `new` label, or its commit isn't this one), the test file doesn't match `strict-tests` and the pull request doesn't change it; every other flip stays red, and so does a test that is skipped, cancelled or missing on the rerun, a rerun that ran no test, wrote no JUnit report or timed out, and a test that passed first and failed on the rerun. Only the rerun's results count for those tests; its exit status doesn't, so a check after `node --test` in `test` (such as this repo's `verify.mjs`) doesn't fail a rerun of one file. `lint` reads the open `flaky-test` issues once (with `issues: read`) and the pull request's changed files, and hands them to the shards and `integration`; when it can't, no flake is known and every flip stays red. `integration` judges each shard's flips again from its JUnit reports and that list, counts only the failures it doesn't excuse, keeps every other check on the first run, and names the flakes: `integration: PASS … , 2 known flakes passed on retry (#916, #844)`. Each shard also uploads the tests that finally failed as `failed-<shard>-<attempt>`, and a test that failed on an earlier attempt of the run and passes now counts as a flip in the report, though not for the gate. The `flaky` job (`issues: write`, `actions: read`, `continue-on-error`) writes a table of the run's flips and failures to its step summary and files one issue per test: title `flaky: <file name> › <test name>`, label `flaky-test`, `new` until a second commit, `guard` for a strict row, whose issue and comments name only the test, the run and the commit, and ``Key: `<key>` `` in the body. It finds the issue among the open ones, then among those closed in the last 30 days, which it reopens, and otherwise opens one; it comments at most once per issue per run with the run and attempt, the event, the pull request, the shard, the runner, the commit and the first error (at most 3,000 characters). It posts nothing that holds the job token or a token-shaped string (the same scan the cert review's `post` had), nothing on a branch matching `flaky-quiet-branches`, nothing on a pull request whose run also has a failure or a shard that wasn't rerun, nothing for a test the pull request changes, and nothing at all when a run would open more than 5 issues (`flaky: <n> flips in one run, not filing (infrastructure?)`). In the merge queue, each open issue whose test passed first time gets `<!-- clean: <n> since <date> -->` in its body, which a flip clears; at `flaky-close-after` it is closed with `no flip in <n> clean merge-group runs since <date>; a new flip reopens it`. It needs `node --test` through the shared harness: `$TEST` must honour `SLICC_TEST_FILES` and write node's JUnit report with `file=`.
86
86
 
87
87
  **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:
88
88
 
@@ -11,6 +11,7 @@ import {
11
11
  readFileSync,
12
12
  realpathSync,
13
13
  rmSync,
14
+ statSync,
14
15
  writeFileSync,
15
16
  } from 'node:fs';
16
17
  import { basename, dirname, isAbsolute, join, matchesGlob, relative, sep } from 'node:path';
@@ -216,7 +217,17 @@ export function isKnown(entry, sha) {
216
217
  );
217
218
  }
218
219
 
219
- function category(test, { known, strict, changed, sha }) {
220
+ export function listed(text) {
221
+ try {
222
+ const parsed = JSON.parse(text || '[]');
223
+ return Array.isArray(parsed) ? parsed : [];
224
+ } catch {
225
+ return [];
226
+ }
227
+ }
228
+
229
+ function category(test, { known, strict, changed, sha, tests }) {
230
+ if (!tests.includes(test.file)) return 'unattributed';
220
231
  if (strict.some((glob) => matchesGlob(test.file, glob))) return 'strict';
221
232
  if (changed.includes(test.file)) return 'changed';
222
233
  return isKnown(known[key(test)], sha) ? 'known' : 'new';
@@ -384,14 +395,41 @@ function context(env) {
384
395
  };
385
396
  }
386
397
 
387
- function rules(env) {
398
+ function rules(env, tests) {
388
399
  const { known, changed } = lint(env.FLAKY);
389
- return { known, changed, strict: globs(env.STRICT), sha: env.SHA || env.GITHUB_SHA || '' };
400
+ return {
401
+ known,
402
+ changed,
403
+ strict: globs(env.STRICT),
404
+ sha: env.SHA || env.GITHUB_SHA || '',
405
+ tests,
406
+ };
390
407
  }
391
408
 
392
- function skipReason({ reports, failing, files, most, elapsed, limit, budget, options }) {
409
+ function regular(file, root) {
410
+ try {
411
+ return statSync(join(root, file)).isFile();
412
+ } catch {
413
+ return false;
414
+ }
415
+ }
416
+
417
+ function skipReason({
418
+ reports,
419
+ failing,
420
+ files,
421
+ tests,
422
+ root,
423
+ most,
424
+ elapsed,
425
+ limit,
426
+ budget,
427
+ options,
428
+ }) {
393
429
  if (reports.length === 0) return 'no JUnit report';
394
430
  if (failing.length === 0) return 'no failing test in the JUnit report';
431
+ const nameless = files.find((file) => !tests.includes(file) || !regular(file, root));
432
+ if (nameless !== undefined) return `a failing test names no test file: ${nameless}`;
395
433
  if (files.length > most) return `${files.length} files failed, more than flaky-retry (${most})`;
396
434
  if (elapsed + limit > budget) return 'past the time budget';
397
435
  if (!options) return 'NODE_OPTIONS names no JUnit destination';
@@ -430,17 +468,19 @@ export async function retry(env = process.env) {
430
468
  Boolean(env.SLICC_TEST_JUNIT) &&
431
469
  (env.NODE_OPTIONS ?? '').includes(`--test-reporter-destination=${env.SLICC_TEST_JUNIT}`);
432
470
  const most = Number(env.FLAKY_RETRY);
471
+ const given = rules(env, globs(env.SLICC_TEST_ALL));
433
472
  const skipped = skipReason({
434
473
  reports,
435
474
  failing,
436
475
  files,
476
+ tests: given.tests,
477
+ root: record.root,
437
478
  most,
438
479
  elapsed: Date.now() - started,
439
480
  limit,
440
481
  budget,
441
482
  options,
442
483
  });
443
- const given = rules(env);
444
484
  if (skipped) {
445
485
  record.skipped = skipped;
446
486
  record.rows = judge({ first: tests, retry: undefined, rerun: null, ...given }).rows;
@@ -488,7 +528,7 @@ export async function retry(env = process.env) {
488
528
  }
489
529
 
490
530
  export function verdict(env = process.env, dir = 'junit') {
491
- const given = rules(env);
531
+ const given = rules(env, listed(env.FILES));
492
532
  const covered = new Set();
493
533
  const passed = [];
494
534
  let failed = 0;
@@ -847,7 +887,13 @@ function reportContext(env) {
847
887
  };
848
888
  }
849
889
 
850
- function collect(found, ctx) {
890
+ function named(entry, tests) {
891
+ if (entry.kind === 'failure' || tests.includes(entry.file)) return true;
892
+ console.log(`flaky: ${entry.file} › ${entry.name}: not filed: it names no test file`);
893
+ return false;
894
+ }
895
+
896
+ function collect(found, ctx, tests) {
851
897
  const entries = [];
852
898
  const passing = new Set();
853
899
  for (const { record, first } of found) {
@@ -867,21 +913,21 @@ function collect(found, ctx) {
867
913
  }
868
914
  }
869
915
  for (const entry of entries) if (entry.kind !== 'failure') passing.delete(entry.key);
870
- return { entries, passing };
916
+ return { entries: entries.filter((entry) => named(entry, tests)), passing };
871
917
  }
872
918
 
873
919
  export async function report(env = process.env, dir = 'junit') {
874
920
  const ctx = reportContext(env);
875
- const given = rules(env);
921
+ const given = rules(env, listed(env.FILES));
876
922
  const found = shards(dir);
877
- const { entries, passing } = collect(found, ctx);
923
+ const { entries, passing } = collect(found, ctx, given.tests);
878
924
  const call = client(ctx);
879
925
  const lines = [];
880
926
  let notes = new Map();
881
927
  try {
882
928
  const seen = new Set(entries.map((entry) => entry.key));
883
929
  for (const flip of ctx.token ? await earlier(call, ctx, found, given) : []) {
884
- if (seen.has(flip.key)) continue;
930
+ if (seen.has(flip.key) || !named(flip, given.tests)) continue;
885
931
  seen.add(flip.key);
886
932
  entries.push({ ...flip, strict: flip.kind === 'strict' });
887
933
  passing.delete(flip.key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-shared-web",
3
- "version": "2.13.0",
3
+ "version": "2.13.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",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@ai-ecoverse/slicc-browsers": "1.18.15",
71
- "@ai-ecoverse/slicc-cdp": "1.41.21",
71
+ "@ai-ecoverse/slicc-cdp": "1.41.22",
72
72
  "@biomejs/biome": "2.5.15",
73
73
  "lefthook": "2.2.2",
74
74
  "monocart-coverage-reports": "2.13.2",