@parity/product-lab 0.1.2 → 0.3.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 (37) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/adapters/environment/engine/README.md +22 -3
  3. package/adapters/environment/engine/src/engine/engine-config.d.ts +1 -0
  4. package/adapters/environment/engine/src/engine/fork-bundle.d.ts +1 -1
  5. package/adapters/environment/engine/src/engine/fork-bundle.js +2 -2
  6. package/adapters/environment/engine/src/engine/fork-refresh.d.ts +4 -7
  7. package/adapters/environment/engine/src/engine/fork-refresh.js +52 -23
  8. package/adapters/environment/engine/src/engine/published-bundle.d.ts +19 -15
  9. package/adapters/environment/engine/src/engine/published-bundle.js +44 -51
  10. package/adapters/environment/engine/src/index.d.ts +3 -2
  11. package/adapters/environment/engine/src/index.js +3 -2
  12. package/adapters/environment/engine/src/saved-fork/saved-fork-tooling.d.ts +1 -1
  13. package/adapters/environment/engine/src/saved-fork/saved-fork-tooling.js +5 -2
  14. package/adapters/environment/engine/src/saved-fork/saved-fork.js +1 -1
  15. package/adapters/environment/engine/src/setup/engine-build.d.ts +4 -4
  16. package/adapters/environment/engine/src/setup/engine-build.js +14 -4
  17. package/adapters/environment/engine/src/setup/engine-tooling.d.ts +33 -0
  18. package/adapters/environment/engine/src/setup/engine-tooling.js +59 -0
  19. package/adapters/environment/engine/src/setup/node-workspace.patch +403 -0
  20. package/adapters/environment/engine/src/setup/patch-catalogue.d.ts +23 -0
  21. package/adapters/environment/engine/src/setup/patch-catalogue.js +8 -0
  22. package/adapters/environment/engine/src/setup/patches.d.ts +15 -1
  23. package/adapters/environment/engine/src/setup/patches.js +17 -2
  24. package/adapters/environment/engine/src/setup/prepare-engine.d.ts +6 -5
  25. package/adapters/environment/engine/src/setup/prepare-engine.js +27 -10
  26. package/composition/README.md +6 -4
  27. package/composition/src/engine-setup.js +9 -3
  28. package/composition/src/index.d.ts +2 -1
  29. package/composition/src/index.js +2 -1
  30. package/composition/src/people-dev/onboarding.d.ts +17 -3
  31. package/composition/src/people-dev/onboarding.js +25 -9
  32. package/composition/src/previewnet-genesis.d.ts +62 -0
  33. package/composition/src/previewnet-genesis.js +127 -0
  34. package/core/application/src/runs/failure-rules.js +5 -2
  35. package/entrypoints/cli/src/setup-commands.d.ts +1 -1
  36. package/entrypoints/cli/src/setup-commands.js +3 -1
  37. package/package.json +1 -1
@@ -104,7 +104,7 @@ const RULES = [
104
104
  id: "environment-unreachable",
105
105
  layer: "environment",
106
106
  confidence: "medium",
107
- test: /(ECONNREFUSED|ECONNRESET|WebSocket|socket hang up|endpoint|not running|cannot start|failed to start|spawn|EADDRINUSE|address already in use|Environment \S+ reports no|No \S+ lab was started for|genesis|baseline)/i,
107
+ test: /(ECONNREFUSED|ECONNRESET|WebSocket|socket hang up|endpoint|not running|cannot start|failed to start|spawn|EADDRINUSE|address already in use|Environment \S+ reports no|No \S+ lab was started for|share a genesis|duplicate genesis|baseline requires|baseline integrity mismatch|fast[- ]baseline|is another chain|genesis \S+ is not)/i,
108
108
  expected: () => "the environment is running and reachable",
109
109
  actual: (m) => `it is not (${m[1]})`,
110
110
  hint: "Infrastructure, not the product: a chain, service or process is down or misconfigured. env_status and tail_logs show which; a negative control failing this way is not a valid result.",
@@ -168,10 +168,11 @@ export function classifyFailure(error, title, hook = false, control = false) {
168
168
  actual: firstLine(error),
169
169
  hint: "A Before/After hook failed: the environment or the scenario context, not a scenario step. tail_logs on the run.",
170
170
  };
171
+ const message = messageLines(error);
171
172
  for (const rule of RULES) {
172
173
  if (control && rule.layer === "environment")
173
174
  continue;
174
- const match = rule.test.exec(error);
175
+ const match = rule.test.exec(message);
175
176
  if (!match)
176
177
  continue;
177
178
  const generic = genericValues(error);
@@ -194,4 +195,6 @@ export function classifyFailure(error, title, hook = false, control = false) {
194
195
  hint: "No rule matched this error. Read the full error, step_evidence for the step and tail_logs for the run.",
195
196
  };
196
197
  }
198
+ const STACK_FRAME = /^\s+at\s.*(?::\d+:\d+\)?|\((?:<anonymous>|native)\)|<anonymous>)\s*$/;
199
+ const messageLines = (error) => error.split("\n").filter((line) => !STACK_FRAME.test(line)).join("\n");
197
200
  export const firstLine = (text) => text.split("\n").find((line) => line.trim())?.trim().slice(0, 500) ?? "";
@@ -1,7 +1,7 @@
1
1
  import type { LabRuntime } from "@parity/product-lab/ports/driving";
2
2
  import type { SyncCommandRunner } from "@parity/product-lab/ports/system";
3
3
  import type { VariableReader } from "./environment.js";
4
- export declare const FETCH_USAGE = "Usage: product-lab fetch [--config lab.config.ts] [--environment <id>]... [--json]\n [--engine-repository <url|path>] [--engine-ref <ref>] [--no-engine-patch]\n\nDownload and verify every release file the lab's lab.lock.json pins for this machine (polkadot-omni-node,\nruntime Wasm) into the shared cache (PRODUCT_LAB_CACHE_DIR, default ~/.cache/product-lab). A file already\ncached and verified is not downloaded again.\n\nThen prepare, in the same cache, what the lab's default environment needs on this machine and never makes\nitself, and what each --environment needs (repeat it, or --environment all): a local copy of a network\n(paseo-copy, previewnet-copy) starts from an Engine checkout, cloned at the tested stock Engine release (or --engine-ref), with no lab patch,\nbuilt, with its network's binaries and the pinned dot CLI (<cache>/engine; Git and network access, a few\nminutes and about 900 MB the first time). One already prepared is only checked. Another Engine:\n --engine-repository <url|path> clone it from this Git URL or local repository instead of GitHub\n --engine-ref <ref> this commit, branch or tag instead of the tested release; starts use it as\n prepared; doctor names it as not the tested release (cache:engine) and fails\n when the copy is asked for (the default environment or --environment)\n --no-engine-patch compatibility flag; stock Engine is the default and the old patch is retired\n\nExit 0 when every file is cached and everything asked for is prepared, 1 otherwise.\nIn the product-lab checkout, `bun run setup` runs this for every example.";
4
+ export declare const FETCH_USAGE = "Usage: product-lab fetch [--config lab.config.ts] [--environment <id>]... [--json]\n [--engine-repository <url|path>] [--engine-ref <ref>] [--no-engine-patch]\n\nDownload and verify every release file the lab's lab.lock.json pins for this machine (polkadot-omni-node,\nruntime Wasm) into the shared cache (PRODUCT_LAB_CACHE_DIR, default ~/.cache/product-lab). A file already\ncached and verified is not downloaded again.\n\nThen prepare, in the same cache, what the lab's default environment needs on this machine and never makes\nitself, and what each --environment needs (repeat it, or --environment all): a local copy of a network\n(paseo-copy, previewnet-copy) starts from an Engine checkout, cloned at the tested stock Engine release (or --engine-ref), with no lab patch,\nbuilt, with its network's binaries and the pinned dot CLI (<cache>/engine; Git and network access, a few\nminutes and about 900 MB the first time). Previewnet from genesis (previewnet-genesis) starts from its own\ncheckout, the same release with the node-workspace patch the package ships (<cache>/engine-node-workspace).\nOne already prepared is only checked. Another Engine:\n --engine-repository <url|path> clone it from this Git URL or local repository instead of GitHub\n --engine-ref <ref> this commit, branch or tag instead of the tested release; starts use it as\n prepared; doctor names it as not the tested release (cache:engine) and fails\n when the copy is asked for (the default environment or --environment)\n --no-engine-patch compatibility flag; stock Engine is the default and the old patch is retired\n\nExit 0 when every file is cached and everything asked for is prepared, 1 otherwise.\nIn the product-lab checkout, `bun run setup` runs this for every example.";
5
5
  export declare const DOCTOR_USAGE = "Usage: product-lab doctor [--config lab.config.ts] [--environment <id>]... [--json]\n\nWhat this machine has and lacks to run the lab: Node.js, the shared cache, the lab's locked release files,\nthe selected browser (the full Chromium executable for the default launcher), what its environments need\nprepared (the Engine checkout of a local copy of a network: required for the default environment and each\n--environment, a note for the others), the Engine build the shared cache holds checked against the pinned\nrelease whatever the lab declares (cache:engine: another build, such as the retired patched one, fails where the lab\nwould start from it, as the Engine checkout line does, else a note; a cache holding no Engine says nothing) and the hosts its people run on (in a product, the truAPI WASM test host the package installs and the truAPI CLI host's locked official release:\ncached or not, what it provides; in the product-lab checkout, also Bun and its truAPI CLI host). Then what fits\nthis machine, from its cores, memory and free disk: the lab's local copy of a network as Full or Light, how\nmany people at once on each environment, and whether the cache is set up. Starts nothing, downloads nothing. Exit 0 when everything is\npresent, 1 otherwise, with the one command that fixes it; what fits never changes the exit code.";
6
6
  /** The command that fixes a missing piece, for the product-lab checkout. */
7
7
  export declare const SETUP_FIX = "bun run setup";
@@ -20,7 +20,9 @@ Then prepare, in the same cache, what the lab's default environment needs on thi
20
20
  itself, and what each --environment needs (repeat it, or --environment all): a local copy of a network
21
21
  (paseo-copy, previewnet-copy) starts from an Engine checkout, cloned at the tested stock Engine release (or --engine-ref), with no lab patch,
22
22
  built, with its network's binaries and the pinned dot CLI (<cache>/engine; Git and network access, a few
23
- minutes and about 900 MB the first time). One already prepared is only checked. Another Engine:
23
+ minutes and about 900 MB the first time). Previewnet from genesis (previewnet-genesis) starts from its own
24
+ checkout, the same release with the node-workspace patch the package ships (<cache>/engine-node-workspace).
25
+ One already prepared is only checked. Another Engine:
24
26
  --engine-repository <url|path> clone it from this Git URL or local repository instead of GitHub
25
27
  --engine-ref <ref> this commit, branch or tag instead of the tested release; starts use it as
26
28
  prepared; doctor names it as not the tested release (cache:engine) and fails
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parity/product-lab",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Run and test Polkadot products against real local chains, hosts and browsers: the framework and the product-lab CLI.",
6
6
  "license": "Apache-2.0",