werkmeister-core 0.90.3 → 0.90.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # sandbox-core
2
2
 
3
+ ## 0.90.4
4
+
3
5
  ## 0.90.3
4
6
 
5
7
  ### Patch Changes
@@ -262,6 +262,8 @@ function testCommandLine(feature, svc, servicesConfig, archetypes, lint) {
262
262
  ? `- \`${svc}\`: \`${containerTestCommand(feature, svc, lint ? `${cmd} && ${lint}` : cmd)}\``
263
263
  : `- \`${svc}\`: no test command registered (add \`test:\` to its registry entry)`;
264
264
  }
265
+ /** SW-720: in sw-700 host `node`, a compound line and `docker exec … node <script>` were each denied before this form ran. */
266
+ const PROBE_FORM = (tempHome) => `A one-off probe is a \`node --test\` file, run as \`${tempHome} --no-wait node --test <file>\` (in the service's container, after its \`docker exec -w <dir> <container>\`, when the host has no node_modules); never host \`node <script>\`, a compound shell line or \`docker exec … node <script>\`. That form asks each time and is never pre-approved, since it runs any file (SW-510).`;
265
267
  /**
266
268
  * Render .werkmeister/werkmeister-context.md — how to validate, then (when they apply)
267
269
  * ports, service topology, lifecycle commands, health checks.
@@ -325,7 +327,13 @@ export function buildSandboxContextMd(feature, slot, portStart, portEnd, localSe
325
327
  return "—";
326
328
  return `\`${wrappedTestCommand(tempHome, r.test, lintOf(r.repo))}\``;
327
329
  };
328
- const rows = validationRows(candidates, servicesConfig, archetypes, urlServices);
330
+ // SW-705: the gate tests every service a change reaches, so the table lists the candidates' whole repos.
331
+ // Each service's own `repo:`, not repos.<repo>.services: only registry sync fills that list.
332
+ const repoOf = (s) => (isDict(servicesConfig[s]) ? servicesConfig[s]["repo"] : undefined);
333
+ const repos = new Set(candidates.map(repoOf).filter(Boolean));
334
+ const repoServices = Object.keys(servicesConfig).filter((s) => repos.has(repoOf(s)));
335
+ const rows = validationRows([...candidates, ...repoServices], servicesConfig, archetypes, urlServices);
336
+ const extraRows = rows.some((r) => !candidates.includes(r.service));
329
337
  // SW-646: contracts name no repo's toolchain; they send the agent here for the repo's own commands.
330
338
  const repoCommands = [...new Set(rows.map((r) => r.repo))]
331
339
  .map((repo) => {
@@ -502,10 +510,12 @@ or visit https://${proxy.host}/__werkmeister and select \`${feature}\` — the s
502
510
  const onDemand = candidates.filter((s) => !localServices.includes(s)).sort();
503
511
  const validateBlock = `## How to validate
504
512
 
505
- How to exercise a change to each service in this workspace.${onDemand.length
513
+ How to exercise a change to each service in this workspace.${extraRows
514
+ ? " The table also lists the other services in this workspace's repos: the PR gate tests each service a change reaches, the workspace's own or not."
515
+ : ""}${onDemand.length
506
516
  ? ` A plain \`werkmeister feature up\` skips the on-demand ones, ${onDemand.map((s) => `\`${s}\``).join(", ")}: start one with \`werkmeister feature up --service <name>\`.`
507
517
  : ""}${tempHome
508
- ? ` Each test command runs through \`.werkmeister/bin/with-temp-home\`, which gives it a fresh temporary HOME and deletes it on exit: never hand-roll \`HOME=…\`. Start every exercise command with the script itself, never with env assignments or a \`cd\`, so one permission rule matches it: \`${tempHome} <test command>\`. A command that needs an env var takes it after the script (\`${tempHome} env WERKMEISTER_ROOT=… <cmd>\`); no rule pre-approves that form, so it asks. Put \`--no-wait\` first (\`${tempHome} --no-wait <cmd>\`) to skip its host-load and free-memory wait; the allow rules below cover that form too. That wait lasts up to 90 s; if load or memory is still over its limit then, the script exits 75 without running the command (retry later). It prints only on stderr, so a foreground call shows nothing until it ends and its only child is \`werkmeister internal wait-load\`: that is the wait, not a hang. The allow rule that covers them is \`Bash(${tempHome} <test command>:*)\` for each test command below: run those for a test without a prompt. A test command of more than one command (an \`&&\` chain, a \`{ …; }\` group, \`||\`, \`;\` or a pipe) is shown as \`${tempHome} sh -c '…'\`, so every part runs under the temp HOME, and its rule allows that exact line: run it as shown, with no extra arguments. Neither \`node --test\` through the script nor the script alone is allowed, since both run any file (SW-510). The temp HOME only keeps a run from writing to the real one by accident; it is not an isolation boundary. A pre-approved test command or built CLI still runs whatever the worktree holds, a test written in this run included, and that code can reach absolute paths, the caller's env, the network, docker and gh (SW-522).`
518
+ ? ` Each test command runs through \`.werkmeister/bin/with-temp-home\`, which gives it a fresh temporary HOME and deletes it on exit: never hand-roll \`HOME=…\`. Start every exercise command with the script itself, never with env assignments or a \`cd\`, so one permission rule matches it: \`${tempHome} <test command>\`. A command that needs an env var takes it after the script (\`${tempHome} env WERKMEISTER_ROOT=… <cmd>\`); no rule pre-approves that form, so it asks. Put \`--no-wait\` first (\`${tempHome} --no-wait <cmd>\`) to skip its host-load and free-memory wait; the allow rules below cover that form too. That wait lasts up to 90 s; if load or memory is still over its limit then, the script exits 75 without running the command (retry later). It prints only on stderr, so a foreground call shows nothing until it ends and its only child is \`werkmeister internal wait-load\`: that is the wait, not a hang. The allow rule that covers them is \`Bash(${tempHome} <test command>:*)\` for each test command below: run those for a test without a prompt. A test command of more than one command (an \`&&\` chain, a \`{ …; }\` group, \`||\`, \`;\` or a pipe) is shown as \`${tempHome} sh -c '…'\`, so every part runs under the temp HOME, and its rule allows that exact line: run it as shown, with no extra arguments. ${PROBE_FORM(tempHome)} The script alone is never allowed either, since it runs any command. The temp HOME only keeps a run from writing to the real one by accident; it is not an isolation boundary. A pre-approved test command or built CLI still runs whatever the worktree holds, a test written in this run included, and that code can reach absolute paths, the caller's env, the network, docker and gh (SW-522).`
509
519
  : ""}${linted
510
520
  ? " A test command ending in `&& <lint>` also runs the repo's lint, the same command the PR gate's lint row runs, so a format error fails here and not first at `werkmeister pr open`."
511
521
  : ""}
@@ -529,6 +529,12 @@ export function workspaceAskRules(workspaceRoot) {
529
529
  const nodeTest = [
530
530
  `Bash(${tempHome} env WERKMEISTER_ROOT=* node --test:*)`,
531
531
  `Bash(${tempHome} --no-wait env WERKMEISTER_ROOT=* node --test:*)`,
532
+ // SW-720: the probe form werkmeister-context.md names; an ask, so auto mode prompts instead of denying it.
533
+ `Bash(${tempHome} node --test*)`,
534
+ `Bash(${tempHome} --no-wait node --test*)`,
535
+ // The same form in the service's container, where a host without node_modules runs it.
536
+ `Bash(docker exec * ${tempHome} node --test*)`,
537
+ `Bash(docker exec * ${tempHome} --no-wait node --test*)`,
532
538
  ];
533
539
  const builtClis = builtCliWrappers(workspaceRoot);
534
540
  if (!builtClis.length)
@@ -18,6 +18,8 @@ const HOSTNAME_RULE = "If `werkmeister feature up` warns that a routed hostname
18
18
  // SW-143: a library or CLI has nothing to restart. How to exercise one is the service's (or its archetype's)
19
19
  // `validate:` text, so app-specific steps stay out of the generic templates.
20
20
  const NO_SERVICE_RULE = "A library or CLI has no service to restart: build it, then exercise the built artifact exactly as its Validation text in `werkmeister-context.md` § How to validate says.";
21
+ // SW-720: sw-700 had host `node`, a compound line and `docker exec … node <script>` each denied before a probe ran.
22
+ const PROBE_RULE = "A one-off probe is a `node --test` file run through `.werkmeister/bin/with-temp-home --no-wait node --test <file>`, in the service's container when the host has no node_modules, as `werkmeister-context.md` § How to validate says; never host `node <script>`, a compound shell line or `docker exec … node <script>`.";
21
23
  // SW-691: sw-681's replay filtered out the very lines that showed its bug, and recorded nothing.
22
24
  const EXERCISE_WORKAROUND = "A filter, workaround or special case the exercise needs before the change passes is a finding: write it into `exercise.md` as a `FAIL` row until the code is fixed, or until the row says why it reflects real use rather than a defect.";
23
25
  const IMPLEMENT_STEPS = [
@@ -255,7 +257,7 @@ const feature = [
255
257
  implementReview(v),
256
258
  GATE_STEP,
257
259
  REVIEW_DELTA,
258
- `Reload the running code: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} Then exercise the change as the How-to-validate section of \`werkmeister-context.md\` describes for each service touched, and capture the output. ${NO_SERVICE_RULE} ${EXERCISE_WORKAROUND}`,
260
+ `Reload the running code: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} Then exercise the change as the How-to-validate section of \`werkmeister-context.md\` describes for each service touched, and capture the output. ${NO_SERVICE_RULE} ${PROBE_RULE} ${EXERCISE_WORKAROUND}`,
259
261
  `Write \`output/exercise.md\`: \`git diff --stat\` for each repo you touched, the host and \`pr gate --tests\` exit codes and summary lines, ${SKIPPED}, any deviation from \`spec.md\` with its reason, and the exercise checks as ${exerciseFormat("evidence")}.`,
260
262
  MANUAL_STEP,
261
263
  ],
@@ -290,7 +292,7 @@ const bugfix = [
290
292
  doNotLoad: "`_shared/standards.md` (nothing is written here), other stages' contracts, `.werkmeister/*.yml`.",
291
293
  process: [
292
294
  // SW-392: a grep for a line the reporter never prints read "0/25 failures" for a flake nobody reproduced.
293
- "Reproduce the failure against the running service or with a test. Record the exact command and its output. Judge each run by its exit code, or by a check you have shown fails on a known-bad run — never by grepping the output for a line that may not be printed.",
295
+ `Reproduce the failure against the running service or with a test. Record the exact command and its output. Judge each run by its exit code, or by a check you have shown fails on a known-bad run — never by grepping the output for a line that may not be printed. ${PROBE_RULE}`,
294
296
  "Write the smallest failing test that captures it, in the style of the nearest existing test. Do not commit it yet.",
295
297
  "Trace to the root cause: the first place the code does something other than intended. A symptom site is not a root cause.",
296
298
  // SW-543: sw-520 grepped one call shape and missed the calls through other helpers; review caught them a round later.
@@ -357,7 +359,7 @@ const bugfix = [
357
359
  ],
358
360
  doNotLoad: "`BRIEF.md` (`repro.md` carries the settled scope), `.werkmeister/*.yml`.",
359
361
  process: [
360
- `Reload the running code: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} ${NO_SERVICE_RULE}`,
362
+ `Reload the running code: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} ${NO_SERVICE_RULE} ${PROBE_RULE}`,
361
363
  "Rerun the reproduction steps from `repro.md` exactly. Capture the output.",
362
364
  `Exercise one neighbouring path through each caller \`repro.md\` listed. Capture the output. ${EXERCISE_WORKAROUND}`,
363
365
  `Write \`output/exercise.md\`: steps 2–3 as ${exerciseFormat("detail")}.`,
@@ -429,7 +431,7 @@ const refactor = [
429
431
  implementReview(v),
430
432
  GATE_STEP,
431
433
  REVIEW_DELTA,
432
- `After the last step, reload and exercise the service: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} ${NO_SERVICE_RULE} ${EXERCISE_WORKAROUND}`,
434
+ `After the last step, reload and exercise the service: ${v.restart}. ${RELOAD_RULE} ${HOSTNAME_RULE} ${NO_SERVICE_RULE} ${PROBE_RULE} ${EXERCISE_WORKAROUND}`,
433
435
  `Write \`output/exercise.md\`: \`git diff --stat\` per repo, the test result after each step, the \`pr gate --tests\` exit code, ${SKIPPED}, and the final exercise checks as ${exerciseFormat("evidence")}.`,
434
436
  MANUAL_STEP,
435
437
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "werkmeister-core",
3
- "version": "0.90.3",
3
+ "version": "0.90.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "werkmeister's shared library. Its public API is werkmeister-core/sdk; every other entry point is internal.",