@cosmicdrift/kumiko-guards 0.350.0 → 0.351.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-guards",
3
- "version": "0.350.0",
3
+ "version": "0.351.0",
4
4
  "description": "AST-based security guards for Kumiko repos: direct-fs/fetch, tenant escalation, admin-API, escape hatches and related checks, run over a shared ts-morph project.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -28,7 +28,7 @@
28
28
  "kumiko-pre-push": "./src/pre-push.sh"
29
29
  },
30
30
  "dependencies": {
31
- "@cosmicdrift/kumiko-repo-manifest": "0.350.0",
31
+ "@cosmicdrift/kumiko-repo-manifest": "0.351.0",
32
32
  "ts-morph": "^28.0.0"
33
33
  },
34
34
  "publishConfig": {
@@ -239,6 +239,8 @@ export function baselineRatchet(args: {
239
239
  }));
240
240
  }
241
241
  if (!existsSync(args.file)) {
242
+ // Nothing to freeze: a missing baseline is equivalent to an empty one.
243
+ if (Object.values(current).every((count) => count === 0)) return [];
242
244
  console.log(
243
245
  ` No baseline found (${args.file}). Freeze it first with \`--write-baseline\` — warning until then, no fail.`,
244
246
  );
package/src/changes.json CHANGED
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.351.0",
4
+ "type": "fix",
5
+ "title": "A missing guard baseline with zero findings is clean instead of warning",
6
+ "detail": "A guard without a baseline file and without findings passes quietly\nGuards with a baseline ratchet printed the \"No baseline found\" warning in every consumer, even when they found nothing. A missing baseline now counts as an empty one when the current count is zero. `raw-sql` uses the same ratchet."
7
+ },
2
8
  {
3
9
  "version": "0.347.0",
4
10
  "type": "improvement",
@@ -17,7 +17,6 @@
17
17
  * (or `kumiko-guards checks --write-baseline --guard=guard-raw-sql`)
18
18
  */
19
19
 
20
- import { existsSync } from "node:fs";
21
20
  import path from "node:path";
22
21
  import {
23
22
  baselineRatchet,
@@ -137,15 +136,11 @@ export const check: RepoCheck = {
137
136
  return { violations: [], matchedFiles: 0, notApplicable: true };
138
137
  }
139
138
  const { findings, markers, scannedFiles } = await scanAllRepos(applicableRoots);
140
- // A root without markers and without a baseline has nothing to freeze, so it
141
- // skips the ratchet's "no baseline found" warning instead of nagging every consumer.
142
- const markerViolations: GuardViolation[] = markers
143
- .filter((m) => m.linesByKey.size > 0 || existsSync(path.join(m.root.absPath, BASELINE_FILE)))
144
- .flatMap((m) =>
145
- ratchetFor(m.root).check(countsOf(m), MARKER_REMEDIATION, {
146
- resolveLine: (key) => m.linesByKey.get(key)?.[0] ?? 1,
147
- }),
148
- );
139
+ const markerViolations: GuardViolation[] = markers.flatMap((m) =>
140
+ ratchetFor(m.root).check(countsOf(m), MARKER_REMEDIATION, {
141
+ resolveLine: (key) => m.linesByKey.get(key)?.[0] ?? 1,
142
+ }),
143
+ );
149
144
  return {
150
145
  violations: [
151
146
  ...findings.map((f) => ({
@@ -4,8 +4,8 @@
4
4
  * caught up with the installed Kumiko framework version.
5
5
  *
6
6
  * The marker is written by `kumiko-upgrade --apply` (local bin from
7
- * `@cosmicdrift/kumiko-dev-server`) and records the version it was applied
8
- * at. This guard re-runs `kumiko-upgrade --from <marker version> --json` and
7
+ * `@cosmicdrift/kumiko-cli` or `@cosmicdrift/kumiko-dev-server`) and records
8
+ * the version it was applied at. This guard re-runs `kumiko-upgrade --from <marker version> --json` and
9
9
  * fails if any changelog entries are still pending — meaning the marker is
10
10
  * stale and the repo hasn't run the upgrade since.
11
11
  *
@@ -138,7 +138,7 @@ export async function runKumikoUpgrade(
138
138
  return {
139
139
  ok: false,
140
140
  error:
141
- "`kumiko-upgrade` not resolvable — add `@cosmicdrift/kumiko-dev-server` as a devDependency or repair the install",
141
+ "`kumiko-upgrade` not resolvable — add `@cosmicdrift/kumiko-cli` or `@cosmicdrift/kumiko-dev-server` as a devDependency or repair the install",
142
142
  };
143
143
  }
144
144
  const proc = Bun.spawn({