@ultimat3/cli 31.46.0 → 31.47.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/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/package.json +29 -29
- package/src/affected.ts +3 -2
- package/src/app-config-load.ts +8 -5
- package/src/app-mcp.ts +2 -5
- package/src/app-runtime.ts +4 -4
- package/src/cmd-cache.ts +8 -4
- package/src/cmd-deploy-compose.ts +11 -12
- package/src/cmd-deploy-helm.ts +5 -8
- package/src/cmd-exercise-spec.ts +2 -2
- package/src/cmd-exercise.ts +7 -19
- package/src/cmd-new.ts +4 -3
- package/src/cmd-planned.ts +11 -76
- package/src/cmd-shot-matrix.ts +3 -2
- package/src/cmd-token.ts +11 -3
- package/src/cmd-upgrade.ts +5 -7
- package/src/codemods/ci-weekly-schedule.ts +61 -0
- package/src/codemods/e2e-suite-floor.ts +42 -0
- package/src/codemods/e2e-suite.ts +71 -0
- package/src/codemods/index.ts +4 -0
- package/src/codemods/pending.ts +2 -2
- package/src/codemods/test-ports.ts +40 -33
- package/src/codemods/test-suites.ts +11 -22
- package/src/codemods/vendored-guards.ts +3 -5
- package/src/codemods/verify-floor-skips.ts +22 -12
- package/src/codemods/verify-floor-steps.ts +4 -3
- package/src/db-seed.ts +3 -2
- package/src/dispatch.ts +2 -11
- package/src/duplicate-packages.ts +4 -4
- package/src/exercise-findings.ts +4 -3
- package/src/exercise-floor.ts +1 -1
- package/src/exercise-seed.ts +34 -0
- package/src/fix-command.ts +2 -3
- package/src/flag-reads.ts +6 -3
- package/src/generate-files.ts +10 -6
- package/src/gitignore.ts +4 -3
- package/src/guards-built-in.ts +3 -6
- package/src/guards.ts +5 -8
- package/src/island-bundle.ts +3 -2
- package/src/island-sources.ts +4 -3
- package/src/island-states-load.ts +4 -3
- package/src/island-store.ts +3 -2
- package/src/json-merge.ts +8 -6
- package/src/lint-findings.ts +4 -7
- package/src/mcp-errors.ts +2 -2
- package/src/messages.ts +1 -0
- package/src/prerender-out.ts +4 -3
- package/src/publish-closure.ts +4 -6
- package/src/pwa-manifest-locales.ts +5 -8
- package/src/registry.ts +0 -7
- package/src/root-env.ts +3 -2
- package/src/runtime-admin.ts +2 -4
- package/src/runtime-keys.ts +5 -2
- package/src/static-report.ts +5 -8
- package/src/templates/github/ci-schedule.ts +86 -0
- package/src/templates/github/ci.yml.ts +6 -8
- package/src/templates/github/dependabot.yml.ts +6 -1
- package/src/templates/guard-released-forms.ts +30 -8
- package/src/templates/scaffold-docs.ts +1 -0
- package/src/templates/scaffold-suites.ts +22 -0
- package/src/templates/shapes/overlay.ts +4 -7
- package/src/upgrade-gate-codemods.ts +1 -18
- package/src/upgrade-guards-baseline.ts +3 -5
- package/src/verify-merge-skips.ts +2 -4
- package/src/verify-merge.ts +13 -8
- package/src/verify-part-step.ts +5 -7
- package/src/worker-bundle.ts +4 -2
- package/wiki/Actions.md +69 -5
- package/wiki/Agents.md +13 -0
- package/wiki/Auth.md +4 -0
- package/wiki/Batching-And-Preloading.md +77 -3
- package/wiki/CLI-Reference.md +19 -6
- package/wiki/Caching-And-Invalidation.md +76 -23
- package/wiki/Client-Navigation.md +2 -0
- package/wiki/Compared.md +13 -11
- package/wiki/Configuration.md +17 -4
- package/wiki/Entities-And-Migrations.md +168 -6
- package/wiki/FAQ.md +1 -1
- package/wiki/Feature-Flags.md +3 -0
- package/wiki/Getting-Started.md +27 -1
- package/wiki/Jobs-And-Workflows.md +70 -13
- package/wiki/Known-Gaps.md +58 -49
- package/wiki/MCP-And-AI.md +43 -3
- package/wiki/Mail.md +6 -0
- package/wiki/Migrations-And-Backfills.md +13 -0
- package/wiki/Money.md +20 -1
- package/wiki/N-Plus-One-Detection.md +31 -1
- package/wiki/Notify.md +13 -2
- package/wiki/PWA-And-Offline.md +34 -4
- package/wiki/Policies-And-Authz.md +27 -5
- package/wiki/Queries-And-Live-Queries.md +41 -4
- package/wiki/Realtime.md +22 -0
- package/wiki/Resource-Management.md +6 -1
- package/wiki/Routes-And-Render-Modes.md +54 -6
- package/wiki/SEO.md +24 -2
- package/wiki/Scheduled-Tasks.md +29 -11
- package/wiki/Scraping.md +33 -2
- package/wiki/Stability.md +1 -1
- package/wiki/Static-Assets.md +1 -0
- package/wiki/Storage-And-Uploads.md +8 -1
- package/wiki/Testing.md +120 -13
- package/wiki/The-Eight-Primitives.md +125 -6
- package/wiki/Timezones-And-Dates.md +13 -5
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-02-First-Feature.md +6 -0
- package/wiki/Tutorial-03-Auth-And-Admin.md +8 -0
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +40 -2
- package/wiki/Tutorial-06-Growing-Up.md +1 -2
- package/wiki/UI-Components.md +14 -5
- package/wiki/Upgrading.md +43 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// `lang`, its `start_url`, its text and its shortcut URLs. `pwa-artifacts.ts` builds one manifest per
|
|
3
3
|
// routed locale from this; the `pwa` block is read structurally, for `colorsOf`'s reason there.
|
|
4
4
|
|
|
5
|
-
import { localeSegment, localizePath } from '@ultimat3/core';
|
|
5
|
+
import { isJsonObject, localeSegment, localizePath } from '@ultimat3/core';
|
|
6
6
|
import type { AppLocaleSet } from '@ultimat3/i18n/app-catalogs';
|
|
7
7
|
import type {
|
|
8
8
|
ManifestIcon,
|
|
@@ -17,9 +17,6 @@ export interface AppLocales {
|
|
|
17
17
|
readonly fallback: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
21
|
-
typeof value === 'object' && value !== null;
|
|
22
|
-
|
|
23
20
|
const strings = (value: unknown): readonly string[] =>
|
|
24
21
|
Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : [];
|
|
25
22
|
|
|
@@ -45,7 +42,7 @@ export const spellIn = (path: string, locale: string, locales: AppLocales): stri
|
|
|
45
42
|
*/
|
|
46
43
|
function textIn(value: unknown, locale: string, locales: AppLocales): string | undefined {
|
|
47
44
|
if (typeof value === 'string') return value.trim() === '' ? undefined : value;
|
|
48
|
-
if (!
|
|
45
|
+
if (!isJsonObject(value)) return undefined;
|
|
49
46
|
for (const key of [locale, locales.fallback]) {
|
|
50
47
|
const entry = value[key];
|
|
51
48
|
if (typeof entry === 'string' && entry.trim() !== '') return entry;
|
|
@@ -58,7 +55,7 @@ const PURPOSES = new Set(['any', 'maskable', 'monochrome']);
|
|
|
58
55
|
function iconsOf(value: unknown): readonly ManifestIcon[] {
|
|
59
56
|
if (!Array.isArray(value)) return [];
|
|
60
57
|
return value.flatMap((icon): readonly ManifestIcon[] => {
|
|
61
|
-
if (!
|
|
58
|
+
if (!isJsonObject(icon)) return [];
|
|
62
59
|
const { src, sizes, type, purpose } = icon;
|
|
63
60
|
if (typeof src !== 'string' || typeof sizes !== 'string' || typeof type !== 'string') return [];
|
|
64
61
|
return [
|
|
@@ -77,7 +74,7 @@ function iconsOf(value: unknown): readonly ManifestIcon[] {
|
|
|
77
74
|
function shortcutsIn(value: unknown, locale: string, locales: AppLocales): ManifestShortcut[] {
|
|
78
75
|
if (!Array.isArray(value)) return [];
|
|
79
76
|
return value.flatMap((shortcut): ManifestShortcut[] => {
|
|
80
|
-
if (!
|
|
77
|
+
if (!isJsonObject(shortcut) || typeof shortcut['url'] !== 'string') return [];
|
|
81
78
|
const name = textIn(shortcut['name'], locale, locales);
|
|
82
79
|
if (name === undefined) return [];
|
|
83
80
|
const shortName = textIn(shortcut['shortName'], locale, locales);
|
|
@@ -98,7 +95,7 @@ function shortcutsIn(value: unknown, locale: string, locales: AppLocales): Manif
|
|
|
98
95
|
function screenshotsIn(value: unknown, locale: string, locales: AppLocales): ManifestScreenshot[] {
|
|
99
96
|
if (!Array.isArray(value)) return [];
|
|
100
97
|
return value.flatMap((shot): ManifestScreenshot[] => {
|
|
101
|
-
if (!
|
|
98
|
+
if (!isJsonObject(shot)) return [];
|
|
102
99
|
const src = textIn(shot['src'], locale, locales);
|
|
103
100
|
const { sizes, type, formFactor } = shot;
|
|
104
101
|
if (src === undefined || typeof sizes !== 'string' || typeof type !== 'string') return [];
|
package/src/registry.ts
CHANGED
|
@@ -40,7 +40,6 @@ import { mailSpec } from './cmd-mail-spec';
|
|
|
40
40
|
import { manifestSpec } from './cmd-manifest-spec';
|
|
41
41
|
import { mcpSpec } from './cmd-mcp-spec';
|
|
42
42
|
import { newSpec } from './cmd-new-spec';
|
|
43
|
-
import { plannedCommands } from './cmd-planned';
|
|
44
43
|
import { policySpec } from './cmd-policy-spec';
|
|
45
44
|
import { prSpec } from './cmd-pr-spec';
|
|
46
45
|
import { actionsSpec, entitiesSpec, queriesSpec } from './cmd-registries-spec';
|
|
@@ -141,14 +140,8 @@ export const LAZY_COMMANDS: readonly LazyCommand[] = [
|
|
|
141
140
|
lazy(statusSpec, async () => (await import('./cmd-status')).statusCommand),
|
|
142
141
|
];
|
|
143
142
|
|
|
144
|
-
/**
|
|
145
|
-
* Planned last, so `x help` reads shipped-first and the tail is honestly labelled. They are in the
|
|
146
|
-
* registry rather than absent from it because "not built yet" and "not a command" are different
|
|
147
|
-
* facts, and only one of them is true — see `cmd-planned.ts`.
|
|
148
|
-
*/
|
|
149
143
|
export const COMMANDS: readonly CliCommand[] = [
|
|
150
144
|
...LAZY_COMMANDS,
|
|
151
|
-
...plannedCommands(),
|
|
152
145
|
createHelpCommand(() => SPECS),
|
|
153
146
|
createVersionCommand(cliVersion),
|
|
154
147
|
];
|
package/src/root-env.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
// run from `apps/web` found the app and none of its `.env`, and silently used the embedded
|
|
4
4
|
// database. Loaded once, after the root is known, never overriding a real environment variable.
|
|
5
5
|
|
|
6
|
-
import { isAbsolute, join,
|
|
6
|
+
import { isAbsolute, join, resolve } from 'node:path'; // why: Bun ships no path join/resolve.
|
|
7
7
|
import { findAppRoot } from './app-root';
|
|
8
|
+
import { posixRelative } from './posix-path';
|
|
8
9
|
|
|
9
10
|
type Env = Readonly<Record<string, string | undefined>>;
|
|
10
11
|
|
|
@@ -122,7 +123,7 @@ async function envFilesIn(dir: string, names: readonly string[]): Promise<Map<st
|
|
|
122
123
|
|
|
123
124
|
/** True when `dir` is `root` or below it. */
|
|
124
125
|
const isWithin = (root: string, dir: string): boolean => {
|
|
125
|
-
const rel =
|
|
126
|
+
const rel = posixRelative(resolve(root), resolve(dir));
|
|
126
127
|
return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel));
|
|
127
128
|
};
|
|
128
129
|
|
package/src/runtime-admin.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// nothing else: which screen a URL names, who may see it and what it renders are the admin's.
|
|
5
5
|
|
|
6
6
|
import type { AdminApp, AdminRouteConfig } from '@ultimat3/admin';
|
|
7
|
+
import { isJsonObject } from '@ultimat3/core';
|
|
7
8
|
import type { Route, RouteMeta } from '@ultimat3/http';
|
|
8
9
|
import { asCtx, html, redirect, routeNotFound } from '@ultimat3/http';
|
|
9
10
|
import type { RouteEntry } from '@ultimat3/render';
|
|
@@ -91,7 +92,7 @@ async function answer(
|
|
|
91
92
|
url: request.url.href,
|
|
92
93
|
method,
|
|
93
94
|
// A POST with no body is a form with no fields — a button-only form posts exactly that.
|
|
94
|
-
form: method === 'POST' ? (
|
|
95
|
+
form: method === 'POST' ? (isJsonObject(form) ? form : {}) : null,
|
|
95
96
|
});
|
|
96
97
|
if (response.kind === 'redirect') {
|
|
97
98
|
// 303, always: the browser must GET the page it lands on, not re-POST the form at it.
|
|
@@ -116,9 +117,6 @@ async function answer(
|
|
|
116
117
|
return html(document, { status: result.status, headers: result.headers });
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
const isRecord = (value: unknown): value is Readonly<Record<string, unknown>> =>
|
|
120
|
-
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
121
|
-
|
|
122
120
|
const METHODS: readonly ('GET' | 'POST')[] = ['GET', 'POST'];
|
|
123
121
|
|
|
124
122
|
/** A file route on a mounted path exists only by a claim the mount accepted (`registerRoute`). */
|
package/src/runtime-keys.ts
CHANGED
|
@@ -17,8 +17,11 @@ const REMOVED: Readonly<Record<string, string>> = Object.freeze({
|
|
|
17
17
|
const isPendingPort = (key: string): boolean =>
|
|
18
18
|
(ADAPTER_PORT_NAMES as readonly string[]).includes(key) && !isWired(key);
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Throws on the first key `RuntimeOverrides` does not declare. `file` is root-relative. `object`,
|
|
22
|
+
* not a record: only its own keys are read, so an array export is refused by its index keys too.
|
|
23
|
+
*/
|
|
24
|
+
export function assertRuntimeKeys(file: string, runtime: object): void {
|
|
22
25
|
for (const key of Object.keys(runtime)) {
|
|
23
26
|
if (isWired(key) || EXTENSIONS.has(key)) continue;
|
|
24
27
|
const named = renderCauseValue(key);
|
package/src/static-report.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { rm } from 'node:fs/promises';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
12
|
import type { RenderMode } from '@ultimat3/core';
|
|
13
|
-
import { RENDER_MODES, SURFACES } from '@ultimat3/core';
|
|
13
|
+
import { isJsonObject, RENDER_MODES, SURFACES } from '@ultimat3/core';
|
|
14
14
|
import type { Surface } from '@ultimat3/render';
|
|
15
15
|
import { SURFACE_SPECS, surfaceAllows } from '@ultimat3/render';
|
|
16
16
|
import type { JsonValue } from './output';
|
|
@@ -179,9 +179,6 @@ export function skippedRoute(
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
183
|
-
typeof value === 'object' && value !== null;
|
|
184
|
-
|
|
185
182
|
/**
|
|
186
183
|
* A closed vocabulary, checked against the vocabulary itself. `typeof value === 'string'` is what
|
|
187
184
|
* `surface` and `render` were held to, and a string is not a `Surface`: the parse then handed back
|
|
@@ -194,7 +191,7 @@ const inDomain = (domain: readonly string[], value: unknown): boolean =>
|
|
|
194
191
|
typeof value === 'string' && domain.includes(value);
|
|
195
192
|
|
|
196
193
|
const isSkipped = (value: unknown): value is SkippedRoute =>
|
|
197
|
-
|
|
194
|
+
isJsonObject(value) &&
|
|
198
195
|
typeof value['route'] === 'string' &&
|
|
199
196
|
inDomain(SURFACES, value['surface']) &&
|
|
200
197
|
inDomain(RENDER_MODES, value['render']) &&
|
|
@@ -206,7 +203,7 @@ const optionalString = (value: unknown): boolean =>
|
|
|
206
203
|
|
|
207
204
|
/** The three coded fields are optional TOGETHER on the way in; a present one must be a string. */
|
|
208
205
|
const isUnmeasured = (value: unknown): value is UnmeasuredRoute =>
|
|
209
|
-
|
|
206
|
+
isJsonObject(value) &&
|
|
210
207
|
typeof value['path'] === 'string' &&
|
|
211
208
|
typeof value['reason'] === 'string' &&
|
|
212
209
|
optionalString(value['code']) &&
|
|
@@ -215,7 +212,7 @@ const isUnmeasured = (value: unknown): value is UnmeasuredRoute =>
|
|
|
215
212
|
(value['weighable'] === undefined || value['weighable'] === false);
|
|
216
213
|
|
|
217
214
|
const isEmitted = (value: unknown): value is EmittedPage =>
|
|
218
|
-
|
|
215
|
+
isJsonObject(value) &&
|
|
219
216
|
typeof value['route'] === 'string' &&
|
|
220
217
|
typeof value['path'] === 'string' &&
|
|
221
218
|
typeof value['file'] === 'string';
|
|
@@ -226,7 +223,7 @@ const isEmitted = (value: unknown): value is EmittedPage =>
|
|
|
226
223
|
* already handles, rather than as a report with a `skipped` nobody can render.
|
|
227
224
|
*/
|
|
228
225
|
export function parseStaticReport(value: unknown): StaticReport | undefined {
|
|
229
|
-
if (!
|
|
226
|
+
if (!isJsonObject(value)) return undefined;
|
|
230
227
|
const { target, out, buildId, emitted, skipped, unmeasured, serviceWorkerWarnings } = value;
|
|
231
228
|
if (target !== 'static' || typeof out !== 'string' || typeof buildId !== 'string') {
|
|
232
229
|
return undefined;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// The weekly half of `ci.yml`: the trigger that gates a default branch nobody is pushing to, the
|
|
2
|
+
// concurrency and job condition that let it run, and the alarm that reaches a person when it goes
|
|
3
|
+
// red. Shared with the `ci-weekly-schedule` codemod, so an upgraded app gets these same bytes.
|
|
4
|
+
|
|
5
|
+
import { fnv1a } from '@ultimat3/core';
|
|
6
|
+
import { DEFAULT_RUNNER } from './runner';
|
|
7
|
+
|
|
8
|
+
/** The one issue a red scheduled run opens; the alarm finds it again by this exact title. */
|
|
9
|
+
export const ALARM_ISSUE_TITLE = 'Scheduled gate is red on the default branch';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Sunday 04:MM UTC, the minute hashed (FNV-1a) from the app's name: apps scaffolded alike do not
|
|
13
|
+
* queue at one instant, and 1–58 stays off the top of the hour, when GitHub delays schedules most.
|
|
14
|
+
*/
|
|
15
|
+
export function weeklyCron(name: string): string {
|
|
16
|
+
return `${String(1 + (fnv1a(name) % 58))} 4 * * 0`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The `schedule:` entry under `on:`, its reasoning kept beside it. */
|
|
20
|
+
export const scheduleTrigger = (name: string): string =>
|
|
21
|
+
` # Weekly, so a default branch nobody pushes to still learns that the world moved under it: a
|
|
22
|
+
# yanked dependency, a retired base image, an expired fixture. GitHub runs this on the default
|
|
23
|
+
# branch only, and turns it off in a public repository after 60 days with no activity there.
|
|
24
|
+
schedule:
|
|
25
|
+
- cron: '${weeklyCron(name)}'
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
/** `concurrency:` and its group: the schedule arm first, then the push and pull request rule. */
|
|
29
|
+
export const CONCURRENCY_GROUP = `concurrency:
|
|
30
|
+
# A scheduled run is keyed by its own id: sharing a group with nothing, it cancels no run and no
|
|
31
|
+
# push can cancel it. The arm comes first because a schedule's event carries little else.
|
|
32
|
+
group: ci-\${{ github.event_name == 'schedule' && format('schedule-{0}', github.run_id) || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || github.ref }}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
/** The plan job's condition, which every other gate job inherits through `needs`. */
|
|
36
|
+
export const PLAN_CONDITION = ` # A scheduled run has no pull request to duplicate, so only that event is ever filtered.
|
|
37
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
/** The job after the verdict, with the blank line that separates it from `verify`. */
|
|
41
|
+
export const ALARM_JOB = `
|
|
42
|
+
# A failed schedule emails only whoever last edited the cron line, which may be a bot or nobody
|
|
43
|
+
# still here. So the run keeps ONE issue: opened when it goes red, commented on while it stays
|
|
44
|
+
# red, closed by the next green run. It runs no action and checks nothing out, so the only code
|
|
45
|
+
# beside its token is \`gh\`; the \`image\` workflow publishes a push alone, so nothing ships from here.
|
|
46
|
+
alarm:
|
|
47
|
+
needs: verify
|
|
48
|
+
if: \${{ !cancelled() && github.event_name == 'schedule' }}
|
|
49
|
+
# NOT \`vars.CI_RUNNER\`: \`gh\` is on the GitHub-hosted image, and a configured label may lack it.
|
|
50
|
+
runs-on: ${DEFAULT_RUNNER}
|
|
51
|
+
timeout-minutes: 5
|
|
52
|
+
# Replaces the workflow's grant for this job alone: no other job can write an issue.
|
|
53
|
+
permissions:
|
|
54
|
+
issues: write # open, comment on and close the one alarm issue
|
|
55
|
+
steps:
|
|
56
|
+
- name: report the scheduled verdict
|
|
57
|
+
shell: bash
|
|
58
|
+
env:
|
|
59
|
+
GH_TOKEN: \${{ github.token }}
|
|
60
|
+
GH_REPO: \${{ github.repository }}
|
|
61
|
+
VERDICT: \${{ needs.verify.result }}
|
|
62
|
+
run: |
|
|
63
|
+
run_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
|
|
64
|
+
# Its own assignment, so a failed lookup stops the job instead of reading as Issues off.
|
|
65
|
+
issues_enabled="$(gh repo view --json hasIssuesEnabled --jq .hasIssuesEnabled)"
|
|
66
|
+
# With Issues off there is nowhere to write: a green week must not turn red over that.
|
|
67
|
+
if [ "$issues_enabled" != true ]; then
|
|
68
|
+
echo "::warning::Issues are off here, so this verdict ($VERDICT) reaches nobody: $run_url"
|
|
69
|
+
exit 0
|
|
70
|
+
fi
|
|
71
|
+
# Its own issue only: the author filter keeps a look-alike title from being commented on.
|
|
72
|
+
existing="$(gh issue list --state open --author 'app/github-actions' \\
|
|
73
|
+
--search 'in:title "${ALARM_ISSUE_TITLE}"' --json number,title \\
|
|
74
|
+
--jq 'map(select(.title == "${ALARM_ISSUE_TITLE}"))[0].number // empty')"
|
|
75
|
+
if [ "$VERDICT" = success ]; then
|
|
76
|
+
if [ -n "$existing" ]; then
|
|
77
|
+
gh issue close "$existing" --reason completed --comment "Green again: $run_url"
|
|
78
|
+
fi
|
|
79
|
+
elif [ -n "$existing" ]; then
|
|
80
|
+
gh issue comment "$existing" --body "Still red: $run_url"
|
|
81
|
+
else
|
|
82
|
+
gh issue create --title '${ALARM_ISSUE_TITLE}' --body "The weekly gate failed with no push to blame: $run_url
|
|
83
|
+
|
|
84
|
+
Reproduce it with bun run setup, then bun run verify. The next green scheduled run closes this issue."
|
|
85
|
+
fi
|
|
86
|
+
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The CI half of what `x new` writes: the gate workflow, cut into parallel parts by
|
|
2
2
|
// `x verify plan` and folded back by `x verify merge`, and the image workflow (`image.yml.ts`)
|
|
3
|
-
// that publishes only what that gate passed. Every command it runs is one of the app's own scripts
|
|
3
|
+
// that publishes only what that gate passed; `ci-schedule.ts` is its weekly run. Every command it runs is one of the app's own scripts
|
|
4
4
|
// — `bun run setup`, `bun run verify …` — never a restatement of the gate's steps (axiom 1).
|
|
5
5
|
|
|
6
6
|
import { REQUIRED_BUN } from '../../app-root';
|
|
@@ -8,6 +8,7 @@ import { DEFAULT_PLAN_PARTS } from '../../verify-plan';
|
|
|
8
8
|
import type { GeneratedFile, NameSet } from '../naming';
|
|
9
9
|
import { TEST_COMPOSE_PATH, TEST_ENV_PATH } from '../scaffold-test-services';
|
|
10
10
|
import { CACHE, CHECKOUT, DOWNLOAD_ARTIFACT, UPLOAD_ARTIFACT } from './actions';
|
|
11
|
+
import { ALARM_JOB, CONCURRENCY_GROUP, PLAN_CONDITION, scheduleTrigger } from './ci-schedule';
|
|
11
12
|
import { DEPENDABOT_PATH, dependabot } from './dependabot.yml';
|
|
12
13
|
import { IMAGE_WORKFLOW_PATH, imageWorkflow } from './image.yml';
|
|
13
14
|
import { RUNS_ON } from './runner';
|
|
@@ -72,13 +73,11 @@ const ci = (app: NameSet): string => `name: ${CI_WORKFLOW_NAME}
|
|
|
72
73
|
on:
|
|
73
74
|
push:
|
|
74
75
|
pull_request:
|
|
75
|
-
|
|
76
|
+
${scheduleTrigger(app.kebab)}
|
|
76
77
|
# A newer push to a branch makes the run already in flight for it worthless, so it is cancelled —
|
|
77
78
|
# except on the default branch, where every commit keeps its own verdict: that group is keyed by
|
|
78
79
|
# SHA, so nothing there can supersede anything.
|
|
79
|
-
|
|
80
|
-
group: ci-\${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || github.ref }}
|
|
81
|
-
cancel-in-progress: true
|
|
80
|
+
${CONCURRENCY_GROUP} cancel-in-progress: true
|
|
82
81
|
|
|
83
82
|
permissions:
|
|
84
83
|
contents: read
|
|
@@ -90,8 +89,7 @@ jobs:
|
|
|
90
89
|
# A branch in THIS repository with an open pull request fires both events for one commit, and
|
|
91
90
|
# the push run already gates that exact tree — so the pull_request run is skipped, not paid for
|
|
92
91
|
# twice. A pull request from a FORK fires no push here, and it still runs.
|
|
93
|
-
|
|
94
|
-
# A free GitHub-hosted runner unless the repository variable \`CI_RUNNER\` names another label.
|
|
92
|
+
${PLAN_CONDITION} # A free GitHub-hosted runner unless the repository variable \`CI_RUNNER\` names another label.
|
|
95
93
|
runs-on: ${RUNS_ON}
|
|
96
94
|
timeout-minutes: 5
|
|
97
95
|
outputs:
|
|
@@ -172,7 +170,7 @@ ${SETUP_STEPS}
|
|
|
172
170
|
path: \${{ runner.temp }}/parts
|
|
173
171
|
merge-multiple: true
|
|
174
172
|
- run: bun run verify merge "$RUNNER_TEMP"/parts/*.json
|
|
175
|
-
`;
|
|
173
|
+
${ALARM_JOB}`;
|
|
176
174
|
|
|
177
175
|
/** The CI a new app is born with, in reading order: the gate, the image, the dependency updates. */
|
|
178
176
|
export function githubFiles(app: NameSet): readonly GeneratedFile[] {
|
|
@@ -8,6 +8,11 @@ export const DEPENDABOT_PATH = '.github/dependabot.yml';
|
|
|
8
8
|
/** The directory `x new` writes its Dockerfile and compose files into. */
|
|
9
9
|
const DOCKER_DIR = '/docker';
|
|
10
10
|
|
|
11
|
+
/** The `docker` ignore entry for the image the Dockerfile builds on. */
|
|
12
|
+
export const BUN_IMAGE_IGNORE = ` # \`FROM oven/bun\` moves with \`engines.bun\` and every other Bun pin (the \`runtime-pin\` guard).
|
|
13
|
+
- dependency-name: oven/bun
|
|
14
|
+
`;
|
|
15
|
+
|
|
11
16
|
export const dependabot = (): string => `version: 2
|
|
12
17
|
|
|
13
18
|
# Weekly, grouped, and small — a dependency PR nobody can review in one sitting gets merged unread.
|
|
@@ -59,7 +64,7 @@ updates:
|
|
|
59
64
|
# A Postgres MAJOR is a planned migration (a new data directory), never a weekly bump.
|
|
60
65
|
- dependency-name: postgres
|
|
61
66
|
update-types: ['version-update:semver-major']
|
|
62
|
-
|
|
67
|
+
${BUN_IMAGE_IGNORE}
|
|
63
68
|
- package-ecosystem: docker-compose
|
|
64
69
|
directories: ['${DOCKER_DIR}']
|
|
65
70
|
schedule:
|
|
@@ -5,23 +5,36 @@
|
|
|
5
5
|
export const RELEASED_GUARD_FORMS: Readonly<
|
|
6
6
|
Record<string, readonly (readonly [string, 'error' | 'warning'])[]>
|
|
7
7
|
> = {
|
|
8
|
-
'animated-layout-property': [
|
|
8
|
+
'animated-layout-property': [
|
|
9
|
+
['2hqr04589t23q', 'error'],
|
|
10
|
+
['2z9j3sd8e7lgl', 'error'],
|
|
11
|
+
],
|
|
9
12
|
'bare-error': [
|
|
10
13
|
['1m3eimglwzrdq', 'error'],
|
|
11
14
|
['1njzso3r6drnd', 'error'],
|
|
15
|
+
['1ot9kwydyzd0j', 'error'],
|
|
16
|
+
['2aaavkemg4qee', 'error'],
|
|
17
|
+
['2s43pcjqyhmfi', 'error'],
|
|
12
18
|
],
|
|
13
19
|
'error-declared': [
|
|
14
20
|
['1rlzex7nalpiw', 'error'],
|
|
15
21
|
['2tfw2hq80msju', 'error'],
|
|
16
22
|
['3kqd7d8pzpcnn', 'error'],
|
|
17
23
|
],
|
|
18
|
-
'focus-visible': [
|
|
24
|
+
'focus-visible': [
|
|
25
|
+
['3i4t0gznxyytf', 'error'],
|
|
26
|
+
['4c2nf0mpzn0z', 'error'],
|
|
27
|
+
],
|
|
19
28
|
'image-dimensions': [
|
|
20
29
|
['1cfzth883qzt5', 'error'],
|
|
30
|
+
['1upoweaclyd8', 'error'],
|
|
21
31
|
['33uv2ua4a9zcf', 'error'],
|
|
22
32
|
],
|
|
23
33
|
'island-mount-clears': [['1v09h5ptzqvs2', 'error']],
|
|
24
|
-
'island-without-states': [
|
|
34
|
+
'island-without-states': [
|
|
35
|
+
['2os1f5fb6aass', 'error'],
|
|
36
|
+
['31gjhz3nyf0gz', 'error'],
|
|
37
|
+
],
|
|
25
38
|
'native-confirm': [
|
|
26
39
|
['1f7eh34hj085a', 'error'],
|
|
27
40
|
['2b134wpkoaqso', 'error'],
|
|
@@ -29,8 +42,10 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
29
42
|
],
|
|
30
43
|
'raw-breakpoint': [['wdo3lsqmvsya', 'error']],
|
|
31
44
|
'raw-colour': [
|
|
45
|
+
['17jw6r17ah3dq', 'error'],
|
|
32
46
|
['1e2pkqnmrjt44', 'error'],
|
|
33
47
|
['3onnbx54g9zmd', 'error'],
|
|
48
|
+
['mdo7f20dnyof', 'error'],
|
|
34
49
|
],
|
|
35
50
|
'raw-fetch': [
|
|
36
51
|
['17xdeprvzx5v2', 'error'],
|
|
@@ -54,6 +69,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
54
69
|
'repo-raw-sql': [
|
|
55
70
|
['12qj02j416sib', 'error'],
|
|
56
71
|
['2kr7gbv7j2m0v', 'error'],
|
|
72
|
+
['2m5sh5923zcdx', 'error'],
|
|
57
73
|
['3nmlelym16o78', 'error'],
|
|
58
74
|
],
|
|
59
75
|
'repo-unbounded': [
|
|
@@ -63,6 +79,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
63
79
|
'runtime-pin': [['28ffbpwy4q2ji', 'error']],
|
|
64
80
|
'semantic-interactive': [
|
|
65
81
|
['29pfa4ea628cv', 'error'],
|
|
82
|
+
['2m280ivq01zs2', 'error'],
|
|
66
83
|
['d4ncwu39wtrk', 'error'],
|
|
67
84
|
],
|
|
68
85
|
'unbounded-fanout': [['xk4dv9vsq8gg', 'error']],
|
|
@@ -82,12 +99,17 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
82
99
|
['w7as1ib1ido8', 'error'],
|
|
83
100
|
],
|
|
84
101
|
'untranslated-string': [
|
|
102
|
+
['211cleyx8cmgn', 'error'],
|
|
103
|
+
['2tmea7cmz7rvr', 'error'],
|
|
85
104
|
['2x85ib5eqdxzi', 'error'],
|
|
86
105
|
['3j5e8t1k120u3', 'error'],
|
|
87
106
|
['d6gyn0l6szj8', 'error'],
|
|
88
107
|
['h57qtdwn7inz', 'error'],
|
|
89
108
|
],
|
|
90
109
|
'unzoned-date': [
|
|
110
|
+
['14sc1shft1opi', 'error'],
|
|
111
|
+
['38jqi2md5adsi', 'error'],
|
|
112
|
+
['3caz4m0vn66dz', 'error'],
|
|
91
113
|
['8apjndc5ybvm', 'error'],
|
|
92
114
|
['haaxmgzsgjns', 'error'],
|
|
93
115
|
],
|
|
@@ -96,7 +118,7 @@ export const RELEASED_GUARD_FORMS: Readonly<
|
|
|
96
118
|
/** Every hash each shipped guard's TEST file was released as: an unedited test goes without a note. */
|
|
97
119
|
export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[]>> = {
|
|
98
120
|
'animated-layout-property': ['191zjn08f13h4'],
|
|
99
|
-
'bare-error': ['1w7vwbtypxdwe'],
|
|
121
|
+
'bare-error': ['17uv4zrzcuwbk', '1epwa72g9sk4u', '1w7vwbtypxdwe'],
|
|
100
122
|
'error-declared': ['2hj2bs2czhxnw', 'qe8afpq7pzf1'],
|
|
101
123
|
'focus-visible': ['12c0rk3ljkx6q'],
|
|
102
124
|
'image-dimensions': ['3p4hkambgpb4j'],
|
|
@@ -104,7 +126,7 @@ export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[
|
|
|
104
126
|
'island-without-states': ['vls0ujdd16gw'],
|
|
105
127
|
'native-confirm': ['1c7vps5wn37uv', 'qwyn1mzn9ace'],
|
|
106
128
|
'raw-breakpoint': ['w356i8dreh7j'],
|
|
107
|
-
'raw-colour': ['1tc7cambk8byr', '319l3wictp9lf'],
|
|
129
|
+
'raw-colour': ['1nhoblzxa9kp1', '1tc7cambk8byr', '319l3wictp9lf'],
|
|
108
130
|
'raw-fetch': ['2lips924uo00f'],
|
|
109
131
|
'raw-interval': ['1z55givy4sst0'],
|
|
110
132
|
'raw-length': ['1hpgz9jowk5qu'],
|
|
@@ -112,7 +134,7 @@ export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[
|
|
|
112
134
|
'raw-shadow': ['3kg8ft6y3ia0y'],
|
|
113
135
|
'raw-z-index': ['3fb40f6bwp8kq'],
|
|
114
136
|
'repo-await-in-loop': ['2axgbb82wldt4'],
|
|
115
|
-
'repo-raw-sql': ['c5pfl8w3qj94', 'f19j7irkta44'],
|
|
137
|
+
'repo-raw-sql': ['1wxenxatjt885', 'c5pfl8w3qj94', 'f19j7irkta44'],
|
|
116
138
|
'repo-unbounded': ['98ncw525gpmo'],
|
|
117
139
|
'runtime-pin': ['dy20fh65qziz'],
|
|
118
140
|
'semantic-interactive': ['2uh0p6xoh996t', '393msxyy1bz36'],
|
|
@@ -120,6 +142,6 @@ export const RELEASED_GUARD_TEST_FORMS: Readonly<Record<string, readonly string[
|
|
|
120
142
|
'undeclared-custom-property': ['30bi2v92swukf', 'svuf8sm14fm8'],
|
|
121
143
|
'undeclared-env': ['38run3rew6y0c', '8xdp7gp7hol7'],
|
|
122
144
|
'undefined-style-class': ['1uy88gpk5k8p8', '2sy8me3i3bmzw'],
|
|
123
|
-
'untranslated-string': ['30q3u45cey2eq', 'cgvfv231gnvg'],
|
|
124
|
-
'unzoned-date': ['1siep3fqscks4', '20x6l238r09jk'],
|
|
145
|
+
'untranslated-string': ['30q3u45cey2eq', 'cgvfv231gnvg', 'kdo3fxwgix3j'],
|
|
146
|
+
'unzoned-date': ['1m46q3h8t4v7v', '1siep3fqscks4', '20x6l238r09jk', '3jzdaqcytkgil'],
|
|
125
147
|
};
|
|
@@ -184,6 +184,7 @@ with \`X_DB_DRIFT\`, and that is the fix it names.
|
|
|
184
184
|
| \`.mcp.json\` | MCP client config: the dev tools, \`bunx @ultimat3/cli mcp serve --transport stdio\` |
|
|
185
185
|
| \`apps/web/mcp.ts\` | the app's own \`POST /mcp\`: exposed actions, behind a bearer token |
|
|
186
186
|
| \`.github/workflows/ci.yml\` | on push and pull request: \`bun run verify plan\` cuts the gate into parts, each runner runs \`bun run setup\` then its \`bun run verify --only …\`, and \`bun run verify merge\` folds them into the one verdict |
|
|
187
|
+
| \`.github/workflows/ci.yml\`, weekly | the same gate on the default branch, so a quiet repository still learns the world moved; a red run keeps one issue open until the next green one |
|
|
187
188
|
| \`.github/workflows/image.yml\` | after a green \`ci\` on the default branch: \`docker/Dockerfile\` to \`ghcr.io\`, tagged \`sha-<7>\`, always on \`ubuntu-latest\` (bash and Docker). \`ci.yml\` runs on \`vars.CI_RUNNER\`, default \`ubuntu-latest\` |
|
|
188
189
|
`;
|
|
189
190
|
|
|
@@ -61,6 +61,28 @@ e2eTest('/ loads in a browser and names itself', async ({ page }) => {
|
|
|
61
61
|
});
|
|
62
62
|
`;
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* The suite `x upgrade` gives an app with no landing page, beside the page it visits. The status and
|
|
66
|
+
* never the title: an anonymous browser may be refused a page behind sign-in, which is the page
|
|
67
|
+
* working; a 5xx, or an app that does not boot, is what no app should ship.
|
|
68
|
+
*/
|
|
69
|
+
export const pageE2eSuite = (
|
|
70
|
+
url: string,
|
|
71
|
+
): string => `// ${url} in a real browser, against the running app. A page behind sign-in may refuse this anonymous
|
|
72
|
+
// visit, and that passes: what fails is a server error, or an app that does not boot. Sign in here
|
|
73
|
+
// to assert more. Its own file because the gate types a test by its FILENAME.
|
|
74
|
+
import { e2eTest, expect } from '@ultimat3/testing';
|
|
75
|
+
|
|
76
|
+
e2eTest('${url} answers a browser without a server error', async ({ page }) => {
|
|
77
|
+
await page.goto('${url}');
|
|
78
|
+
const status = await page.evaluate(() => {
|
|
79
|
+
const [navigation] = performance.getEntriesByType('navigation');
|
|
80
|
+
return (navigation as PerformanceNavigationTiming).responseStatus;
|
|
81
|
+
});
|
|
82
|
+
expect(status).toBeLessThan(500);
|
|
83
|
+
});
|
|
84
|
+
`;
|
|
85
|
+
|
|
64
86
|
/** The live suite, in the db package every scaffold writes. */
|
|
65
87
|
export const liveSuiteFiles = (): readonly GeneratedFile[] => [
|
|
66
88
|
{ path: LIVE_SUITE_PATH, contents: liveSuite() },
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// catalog keys it drops, in-place edits, and files it adds. Never a second scaffold, so every fix to
|
|
3
3
|
// the default reaches every shape on the next release.
|
|
4
4
|
|
|
5
|
-
import { assert } from '@ultimat3/core';
|
|
5
|
+
import { assert, isJsonObject } from '@ultimat3/core';
|
|
6
6
|
import type { GeneratedFile, NameSet } from '../naming';
|
|
7
7
|
|
|
8
8
|
/** One in-place edit of a scaffold file: `find` must occur exactly once, or the overlay is stale. */
|
|
@@ -34,20 +34,17 @@ const CATALOG = 'packages/i18n/catalogs/en.json';
|
|
|
34
34
|
/** A stale overlay is the framework's bug, never the app's: the shape tests name which one. */
|
|
35
35
|
const FIX = 'bun test ./packages/cli/src/templates/shapes';
|
|
36
36
|
|
|
37
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
38
|
-
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
39
|
-
|
|
40
37
|
/** The catalog with each dotted key's subtree removed, re-serialised the way `catalogJson` does. */
|
|
41
38
|
export function dropCatalogKeys(contents: string, keys: readonly string[]): string {
|
|
42
39
|
const catalog: unknown = JSON.parse(contents);
|
|
43
|
-
assert(
|
|
40
|
+
assert(isJsonObject(catalog), `${CATALOG} is not a JSON object`, FIX);
|
|
44
41
|
for (const key of keys) {
|
|
45
42
|
const segments = key.split('.');
|
|
46
43
|
const leaf = segments.pop() ?? '';
|
|
47
44
|
let node: unknown = catalog;
|
|
48
|
-
for (const segment of segments) node =
|
|
45
|
+
for (const segment of segments) node = isJsonObject(node) ? node[segment] : undefined;
|
|
49
46
|
assert(
|
|
50
|
-
|
|
47
|
+
isJsonObject(node) && Object.hasOwn(node, leaf),
|
|
51
48
|
`a shape drops catalog key ${key}, which the base scaffold no longer writes`,
|
|
52
49
|
FIX,
|
|
53
50
|
);
|
|
@@ -130,22 +130,5 @@ export async function previewCodemods(
|
|
|
130
130
|
return { codemods: { ...own, source: 'driver' }, superseded: await supersededFindings(root) };
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
/** Below every release:
|
|
133
|
+
/** Below every release: a resumed hop reruns every codemod, which are idempotent. */
|
|
134
134
|
export const EVERY_RELEASE = '0.0.0';
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* No version moves, and still no copy of an old template stays: every codemod up to the release
|
|
138
|
-
* the app is on, through the installed CLI as a hop would (a dry run previews this CLI's list).
|
|
139
|
-
* Each is idempotent, so one already applied is a run that changes nothing.
|
|
140
|
-
*/
|
|
141
|
-
export async function atTargetCodemods(input: {
|
|
142
|
-
readonly runner: Runner;
|
|
143
|
-
readonly root: string;
|
|
144
|
-
readonly to: string;
|
|
145
|
-
readonly dryRun: boolean;
|
|
146
|
-
}): Promise<{ readonly codemods: HopCodemods; readonly superseded: readonly Finding[] }> {
|
|
147
|
-
const { runner, root, to } = input;
|
|
148
|
-
if (input.dryRun) return previewCodemods(root, EVERY_RELEASE, to);
|
|
149
|
-
const codemods = await applyHopCodemods({ runner, root, from: EVERY_RELEASE, to });
|
|
150
|
-
return { codemods, superseded: await supersededFindings(root) };
|
|
151
|
-
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
// why: Bun exposes no path-join primitive; `x.verify.json` sits at the app root.
|
|
6
6
|
import { join } from 'node:path';
|
|
7
|
+
import { isJsonObject } from '@ultimat3/core';
|
|
7
8
|
import { parseJson } from './upgrade-registry';
|
|
8
9
|
import { VERIFY_FLOOR_FILE } from './verify-floor';
|
|
9
10
|
import { GUARD_BASELINE_FIELD } from './verify-guard-baseline';
|
|
@@ -11,9 +12,6 @@ import { GUARD_BASELINE_FIELD } from './verify-guard-baseline';
|
|
|
11
12
|
/** The floor's bytes before the write, or null when there was no file: what a rollback restores. */
|
|
12
13
|
export type FloorPrior = string | null;
|
|
13
14
|
|
|
14
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
15
|
-
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* Writes `guardBaseline[name] = findings`; the prior bytes, or undefined when it refused. No file
|
|
19
17
|
* is a floor requiring no step, so the one written changes nothing but the baseline.
|
|
@@ -26,9 +24,9 @@ export async function writeGuardBaseline(
|
|
|
26
24
|
const file = Bun.file(join(root, VERIFY_FLOOR_FILE));
|
|
27
25
|
const prior = (await file.exists()) ? await file.text() : null;
|
|
28
26
|
const payload = prior === null ? { steps: [] } : parseJson(prior);
|
|
29
|
-
if (!
|
|
27
|
+
if (!isJsonObject(payload)) return undefined;
|
|
30
28
|
const current = payload[GUARD_BASELINE_FIELD];
|
|
31
|
-
if (current !== undefined && !
|
|
29
|
+
if (current !== undefined && !isJsonObject(current)) return undefined;
|
|
32
30
|
if (current !== undefined && Object.hasOwn(current, name)) return undefined;
|
|
33
31
|
const next = { ...payload, [GUARD_BASELINE_FIELD]: { ...(current ?? {}), [name]: findings } };
|
|
34
32
|
await Bun.write(file, `${JSON.stringify(next, null, 2)}\n`);
|
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
// with the reason the summed shard counts give, and the same not-strict warning a whole run
|
|
3
3
|
// prints. Split from `verify-merge.ts`, which folds the verdict; this folds the reasons.
|
|
4
4
|
|
|
5
|
+
import { isJsonObject } from '@ultimat3/core';
|
|
5
6
|
import type { StepResult } from './output';
|
|
6
7
|
import type { VerifyFloor } from './verify-floor';
|
|
7
8
|
import { ranNothingReason } from './verify-skip-reason';
|
|
8
9
|
import { skipWhy } from './verify-strict';
|
|
9
10
|
|
|
10
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
11
|
-
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
12
|
-
|
|
13
11
|
/** A part document's `data.skipReasons`, string values only; absent when it carries none. */
|
|
14
12
|
export const readPartSkipReasons = (
|
|
15
13
|
data: Record<string, unknown>,
|
|
16
14
|
): Readonly<Record<string, string>> | undefined => {
|
|
17
15
|
const raw = data['skipReasons'];
|
|
18
|
-
if (!
|
|
16
|
+
if (!isJsonObject(raw)) return undefined;
|
|
19
17
|
const reasons = Object.entries(raw).filter(
|
|
20
18
|
(entry): entry is [string, string] => typeof entry[1] === 'string',
|
|
21
19
|
);
|