werkmeister-core 0.91.3 → 0.91.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,11 @@
1
1
  # sandbox-core
2
2
 
3
+ ## 0.91.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 2a3fff3: SW-636: the test commands `werkmeister-context.md` prints, and the allow rules that match them, now run the repo's `lint:` before the test command (`<lint> && <test>`), not after it. A format error now fails within seconds instead of after the full test run: in the werkmeister repo, about 7 s rather than turbo's ~6 minutes. A repo with no `lint:` gets the same lines as before.
8
+
3
9
  ## 0.91.3
4
10
 
5
11
  ### Patch Changes
@@ -47,8 +47,8 @@ export declare function containerTestCommand(feature: string, svc: string, cmd:
47
47
  /** True when *cmd* is simple commands joined only by `&&`: no group, pipe, `||`, `;`, `&`, newline or substitution. */
48
48
  export declare function isPlainChain(cmd: string): boolean;
49
49
  /**
50
- * The test command (plus the repo's lint) as werkmeister-context.md prints it and its allow rule
51
- * matches it. One simple command is prefixed with *tempHome*; anything more goes through `sh -c`,
50
+ * The test command (after the repo's lint) as werkmeister-context.md prints it and its allow rule
51
+ * matches it. Lint goes first so a format error fails in seconds, not after turbo's minutes (SW-636). One simple command is prefixed with *tempHome*; anything more goes through `sh -c`,
52
52
  * so every part runs under the temp HOME (`with-temp-home a && b` wraps only `a`) and a `{ …; }`
53
53
  * group is not a syntax error (SW-660).
54
54
  */
@@ -88,13 +88,13 @@ export function isPlainChain(cmd) {
88
88
  return !/[|;&{}()`\n]|\$\(/.test(cmd.split("&&").join(""));
89
89
  }
90
90
  /**
91
- * The test command (plus the repo's lint) as werkmeister-context.md prints it and its allow rule
92
- * matches it. One simple command is prefixed with *tempHome*; anything more goes through `sh -c`,
91
+ * The test command (after the repo's lint) as werkmeister-context.md prints it and its allow rule
92
+ * matches it. Lint goes first so a format error fails in seconds, not after turbo's minutes (SW-636). One simple command is prefixed with *tempHome*; anything more goes through `sh -c`,
93
93
  * so every part runs under the temp HOME (`with-temp-home a && b` wraps only `a`) and a `{ …; }`
94
94
  * group is not a syntax error (SW-660).
95
95
  */
96
96
  export function wrappedTestCommand(tempHome, test, lint) {
97
- const full = lint ? `${test} && ${lint}` : test;
97
+ const full = lint ? `${lint} && ${test}` : test;
98
98
  if (!tempHome)
99
99
  return full;
100
100
  if (isPlainChain(full) && !full.includes("&&"))
@@ -259,7 +259,7 @@ function testCommandLine(feature, svc, servicesConfig, archetypes, lint) {
259
259
  if (noTests)
260
260
  return `- \`${svc}\`: no tests (registry: ${noTests})`;
261
261
  return cmd
262
- ? `- \`${svc}\`: \`${containerTestCommand(feature, svc, lint ? `${cmd} && ${lint}` : cmd)}\``
262
+ ? `- \`${svc}\`: \`${containerTestCommand(feature, svc, lint ? `${lint} && ${cmd}` : cmd)}\``
263
263
  : `- \`${svc}\`: no test command registered (add \`test:\` to its registry entry)`;
264
264
  }
265
265
  /** SW-720: in sw-700 host `node`, a compound line and `docker exec … node <script>` were each denied before this form ran. */
@@ -445,7 +445,7 @@ docker compose restart ${sampleSvc}
445
445
  ### Test commands
446
446
 
447
447
  The registry's \`test:\` for each service (or its archetype's), run in its container — the worktree is mounted at \`/app\` with its \`node_modules\`; the host checkout has none. The pre-PR gate runs these (\`werkmeister pr gate\`).${svcLint.some(Boolean)
448
- ? " A line ending in `&& <lint>` also runs the repo's lint, the PR gate's lint row, so a `docs:check` or format failure shows here and not first at the gate."
448
+ ? " A line starting with `<lint> &&` first runs the repo's lint, the PR gate's lint row, so a `docs:check` or format failure shows here, before the tests, and not first at the gate."
449
449
  : ""}
450
450
 
451
451
  ${svcs.map((s, i) => testCommandLine(feature, s, servicesConfig, archetypes ?? loadArchetypes(), svcLint[i])).join("\n")}
@@ -517,7 +517,7 @@ How to exercise a change to each service in this workspace.${extraRows
517
517
  : ""}${tempHome
518
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).`
519
519
  : ""}${linted
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`."
520
+ ? " A test command starting with `<lint> &&` first runs the repo's lint, the same command the PR gate's lint row runs, so a format error fails here, before the tests, and not first at `werkmeister pr open`."
521
521
  : ""}
522
522
 
523
523
  ${validationTable}${repoCommands}
@@ -117,7 +117,7 @@ export const SELF_CHECK = "Review `output/` once against `../../BRIEF.md` and th
117
117
  // ends at an approved PR file is "propose".
118
118
  // The gate reads every `result` column and rejects any other cell text (SW-247, SW-286).
119
119
  const exerciseFormat = (col) => `a \`| check | result | ${col} |\` table whose result cell is exactly \`PASS\` or \`FAIL\` — nothing else in the cell — with the captured output in the ${col} column. The rule holds for every table in \`exercise.md\`; describe a superseded run in prose, not as a \`FAIL\` row`;
120
- const LINT = "the repo's lint command (the `&& <lint>` tail of the test command in `werkmeister-context.md`, when it has one, which the PR gate's lint row runs) and fix what it fails, release entry included.";
120
+ const LINT = "the repo's lint command (the `<lint> &&` head of the test command in `werkmeister-context.md`, when it has one, which the PR gate's lint row runs) and fix what it fails, release entry included.";
121
121
  const propose = {
122
122
  name: "propose",
123
123
  job: "acceptance walk and PR files",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "werkmeister-core",
3
- "version": "0.91.3",
3
+ "version": "0.91.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.",