@ultimat3/cli 31.27.0 → 31.29.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/CLAUDE.md +4 -1
- package/README.md +14 -4
- package/package.json +29 -29
- package/src/app-manifest.ts +6 -1
- package/src/app-migrations-verdict.ts +84 -0
- package/src/cmd-doctor.ts +11 -3
- package/src/cmd-drill.ts +23 -9
- package/src/cmd-repro-spec.ts +13 -1
- package/src/cmd-repro.ts +37 -5
- package/src/cmd-upgrade-codemods.ts +71 -0
- package/src/cmd-upgrade-spec.ts +19 -5
- package/src/cmd-upgrade.ts +91 -34
- package/src/codemods/agents-dev-mcp.ts +50 -0
- package/src/codemods/authenticator-session-refusal.ts +214 -0
- package/src/codemods/biome-no-default-export.ts +58 -0
- package/src/codemods/bunfig-island-coverage.ts +33 -0
- package/src/codemods/chart-dashboard.ts +73 -0
- package/src/codemods/ci-e2e-browser-stock.ts +75 -0
- package/src/codemods/ci-e2e-browser.ts +63 -0
- package/src/codemods/codemod.ts +58 -0
- package/src/codemods/define-error-leaf.ts +73 -0
- package/src/codemods/docs-ci-parts.ts +65 -0
- package/src/codemods/docs-gate-prose.ts +53 -0
- package/src/codemods/docs-island-rows.ts +31 -0
- package/src/codemods/docs-shipped-guards.ts +100 -0
- package/src/codemods/docs-test-services.ts +62 -0
- package/src/codemods/engine-diff.ts +104 -0
- package/src/codemods/engine-edits.ts +111 -0
- package/src/codemods/engine-fs.ts +95 -0
- package/src/codemods/engine.ts +191 -0
- package/src/codemods/format-edited-hook-3122.ts +28 -0
- package/src/codemods/format-edited-hook.ts +152 -0
- package/src/codemods/helm-alerts-deploy.ts +85 -0
- package/src/codemods/helm-alerts-objective.ts +105 -0
- package/src/codemods/helm-alerts-stock.ts +108 -0
- package/src/codemods/index.ts +60 -0
- package/src/codemods/metrics-probe-healthz.ts +47 -0
- package/src/codemods/migrate-job-ordered.ts +81 -0
- package/src/codemods/migrate-job-stock.ts +41 -0
- package/src/codemods/pending.ts +36 -0
- package/src/codemods/repro-gitignore.ts +40 -0
- package/src/codemods/runtime-pin-lines.ts +109 -0
- package/src/codemods/runtime-pin.ts +116 -0
- package/src/codemods/solid-floor.ts +63 -0
- package/src/codemods/test-ports.ts +86 -0
- package/src/codemods/test-suites.ts +37 -0
- package/src/codemods/theme-toggle-mount-over.ts +70 -0
- package/src/codemods/vendored-guards.ts +186 -0
- package/src/codemods/verify-floor-skips.ts +88 -0
- package/src/codemods/verify-floor-steps.ts +90 -0
- package/src/doctor-advisory-floors.ts +113 -0
- package/src/doctor-guards.ts +39 -86
- package/src/doctor-superseded.ts +67 -0
- package/src/drill-schema-behind.ts +26 -0
- package/src/error-codes-doctor.ts +12 -4
- package/src/error-codes.ts +9 -0
- package/src/exercise-database.ts +7 -2
- package/src/framework-schema-apply.ts +7 -19
- package/src/framework-schema-stamp.ts +38 -3
- package/src/framework-schema-verify.ts +120 -0
- package/src/framework-schema-wait.ts +125 -0
- package/src/generate-files.ts +6 -5
- package/src/guards-built-in-codes.ts +36 -0
- package/src/guards-built-in-refusal.ts +25 -0
- package/src/guards-built-in.ts +134 -0
- package/src/guards-materialize.ts +42 -0
- package/src/guards-paths.ts +37 -0
- package/src/guards-shipped-names.ts +38 -0
- package/src/guards-vendored.ts +73 -0
- package/src/guards.ts +90 -34
- package/src/index.ts +10 -0
- package/src/lint-findings.ts +3 -3
- package/src/mcp-errors.ts +12 -1
- package/src/measure-scope.ts +23 -3
- package/src/messages-repro.ts +16 -2
- package/src/messages-upgrade.ts +15 -0
- package/src/messages.ts +1 -1
- package/src/repro-archive-collect.ts +161 -0
- package/src/repro-archive-write.ts +96 -0
- package/src/repro-archive.ts +161 -0
- package/src/repro-bundle.ts +8 -16
- package/src/repro-errors.ts +14 -2
- package/src/repro-framework.ts +53 -0
- package/src/repro-parse.ts +87 -0
- package/src/repro-redact.ts +218 -0
- package/src/repro-scrub.ts +257 -0
- package/src/role-pg-stats.ts +21 -0
- package/src/role-start.ts +4 -0
- package/src/runtime-queue.ts +27 -6
- package/src/serve-boot-probe.ts +97 -0
- package/src/serve-boot.ts +26 -1
- package/src/serve-retire.ts +16 -3
- package/src/superseded-match.ts +87 -0
- package/src/superseded.ts +84 -0
- package/src/templates/bun-image.ts +48 -0
- package/src/templates/chart-dashboard-panels.ts +178 -0
- package/src/templates/chart-dashboard.ts +9 -135
- package/src/templates/github/ci.yml.ts +1 -1
- package/src/templates/guard-released-forms.ts +112 -0
- package/src/templates/guard-runtime-pin-test.ts +54 -0
- package/src/templates/guard-runtime-pin.ts +189 -0
- package/src/templates/scaffold-claude-agents.ts +6 -6
- package/src/templates/scaffold-claude-commands.ts +1 -1
- package/src/templates/scaffold-claude-hook.ts +18 -8
- package/src/templates/scaffold-claude.ts +2 -2
- package/src/templates/scaffold-container.ts +2 -2
- package/src/templates/scaffold-docs.ts +26 -24
- package/src/templates/scaffold-guards.ts +73 -39
- package/src/templates/scaffold-helm-alert-deploy.ts +105 -0
- package/src/templates/scaffold-helm-alert-rules.ts +7 -1
- package/src/templates/scaffold-helm-alerts.ts +3 -0
- package/src/templates/scaffold-helm-migrate.ts +85 -0
- package/src/templates/scaffold-helm-templates.ts +2 -36
- package/src/templates/scaffold-helm.ts +1 -0
- package/src/templates/scaffold-repo.ts +2 -1
- package/src/unthrown-codes.ts +2 -0
- package/src/upgrade-bun-floor.ts +4 -0
- package/src/upgrade-clean-tree.ts +54 -0
- package/src/upgrade-gate-codemods-install.ts +40 -0
- package/src/upgrade-gate-codemods.ts +151 -0
- package/src/upgrade-gate.ts +38 -6
- package/src/upgrade-lock.ts +118 -0
- package/src/upgrade-plan.ts +2 -1
- package/src/upgrade-report-codemods.ts +54 -0
- package/src/upgrade-report.ts +52 -27
- package/src/upgrade-signals.ts +91 -0
- package/src/upgrade-unfinished.ts +61 -0
- package/wiki/CLI-Reference.md +70 -5
- package/wiki/Deployment.md +2 -1
- package/wiki/Interface-Rules.md +17 -8
- package/wiki/Known-Gaps.md +1 -1
- package/wiki/Observability.md +1 -0
- package/wiki/Project-Layout.md +4 -4
- package/wiki/Upgrading.md +6 -0
package/src/serve-boot.ts
CHANGED
|
@@ -24,6 +24,7 @@ import type { RunningServices } from './runtime-services';
|
|
|
24
24
|
import { releaseOrThrow, startServices } from './runtime-services';
|
|
25
25
|
import type { BootTimeline } from './serve-boot-phases';
|
|
26
26
|
import { bootTimeline } from './serve-boot-phases';
|
|
27
|
+
import { type BootProbe, openBootProbe } from './serve-boot-probe';
|
|
27
28
|
import { bootWarningConcerns, warnAtBoot } from './serve-boot-warnings';
|
|
28
29
|
import { loadDrainConfig, loadHealthConfig } from './serve-drain';
|
|
29
30
|
import { configureReporting, containerBinding, metricsPortFor, portFromEnv } from './serve-env';
|
|
@@ -93,6 +94,10 @@ export async function bootServing(boot: {
|
|
|
93
94
|
readonly metrics: MetricsEndpoint;
|
|
94
95
|
}): Promise<ServedApp> {
|
|
95
96
|
const { options } = boot;
|
|
97
|
+
// The role's own grace FIRST, before the services: the schema wait runs inside them, and a worker
|
|
98
|
+
// SIGTERMed mid-wait sat through web's readiness grace. `app.config.ts`'s `drain` section is
|
|
99
|
+
// applied over this once the app is loaded (`bootRoles`).
|
|
100
|
+
configureLifecycle(lifecycleForRole(boot.role, undefined));
|
|
96
101
|
// Before any service starts: a half-declared pair is refused while there is nothing to unwind.
|
|
97
102
|
const tls = boot.role === 'web' ? await tlsFromEnv(options.env) : undefined;
|
|
98
103
|
// One `boot.phase` line as each step ends, so a slow boot names its slow step (U12).
|
|
@@ -102,11 +107,27 @@ export async function bootServing(boot: {
|
|
|
102
107
|
// tables first, and this boot only verifies the stamp it left (`framework-schema-apply.ts`).
|
|
103
108
|
// The embedded database has no migrate step to have run, so it applies its own.
|
|
104
109
|
const schema = services.db.mode === 'external' ? 'verify' : 'apply';
|
|
110
|
+
// The web or sync role's own port answers its probes from here — alive, not ready — so a pod
|
|
111
|
+
// that waits on the migrate step (`verify`, inside `startServices`) is never restarted by a
|
|
112
|
+
// startup probe knocking on a closed socket. The role's listener takes the port in `bootRoles`.
|
|
113
|
+
const probe = openBootProbe({
|
|
114
|
+
role: boot.role,
|
|
115
|
+
port: options.port ?? portFromEnv(options.env),
|
|
116
|
+
hostname: containerBinding(options.env, options.hostname).hostname,
|
|
117
|
+
...(tls === undefined ? {} : { tls }),
|
|
118
|
+
});
|
|
119
|
+
if (probe !== undefined) boot.acquired.push(() => probe.stop());
|
|
105
120
|
// The role decides whether this boot waits for the bus: only `sync` and the replicator do.
|
|
106
121
|
const runtime = await startServices(services, options.env, options.runtime, schema, [boot.role]);
|
|
107
122
|
boot.acquired.push(() => runtime.stop());
|
|
108
123
|
timeline.phase('services');
|
|
109
|
-
return bootRoles({
|
|
124
|
+
return bootRoles({
|
|
125
|
+
...boot,
|
|
126
|
+
runtime,
|
|
127
|
+
timeline,
|
|
128
|
+
...(tls === undefined ? {} : { tls }),
|
|
129
|
+
...(probe === undefined ? {} : { probe }),
|
|
130
|
+
});
|
|
110
131
|
}
|
|
111
132
|
|
|
112
133
|
/**
|
|
@@ -143,6 +164,8 @@ async function bootRoles(boot: {
|
|
|
143
164
|
readonly timeline: BootTimeline;
|
|
144
165
|
/** `TLS_CERT`/`TLS_KEY`, read by `bootServing`; the web role's listener serves TLS with it. */
|
|
145
166
|
readonly tls?: ListenerTls;
|
|
167
|
+
/** The boot's holder of this role's port (`serve-boot-probe.ts`), freed just before it binds. */
|
|
168
|
+
readonly probe?: BootProbe;
|
|
146
169
|
}): Promise<ServedApp> {
|
|
147
170
|
const { options, role, runtime, acquired, metrics, timeline } = boot;
|
|
148
171
|
// Before the app's modules, because importing one may register a `close` hook, and that phase
|
|
@@ -222,6 +245,8 @@ async function bootRoles(boot: {
|
|
|
222
245
|
const health = await loadHealthConfig(options.root);
|
|
223
246
|
if (health?.readiness !== undefined) configureLifecycle({ readiness: health.readiness });
|
|
224
247
|
const replicaOverride = replicaOverrides(options.runtime, runtime.services.db, options.env);
|
|
248
|
+
// The instant before the role binds the same port: synchronous, so the port is free on return.
|
|
249
|
+
boot.probe?.stop();
|
|
225
250
|
const running = await startRoles({
|
|
226
251
|
roles: [role],
|
|
227
252
|
port,
|
package/src/serve-retire.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface WorkerRetireOptions {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export interface WorkerRetire {
|
|
30
|
-
/** The worker the boot started (`null` when it started none) — a signal before this
|
|
30
|
+
/** The worker the boot started (`null` when it started none) — a signal before this drains. */
|
|
31
31
|
adopt(worker: RetiringWorker | null): void;
|
|
32
32
|
/** Give the listener back: a boot that failed, or a hold that is over. */
|
|
33
33
|
disarm(): void;
|
|
@@ -39,7 +39,7 @@ const NOTHING: WorkerRetire = Object.freeze({ adopt: () => undefined, disarm: ()
|
|
|
39
39
|
* Listen for `RETIRE_SIGNAL` NOW, before the boot: Bun's default for an unhandled SIGUSR2 ends the
|
|
40
40
|
* process — except as PID 1 (a container's ENTRYPOINT), where the kernel DROPS a signal with no
|
|
41
41
|
* listener, so a `preStop` that lands before this line runs is lost. The chart's preStop therefore
|
|
42
|
-
* re-sends it every 5 s until PID 1 is gone;
|
|
42
|
+
* re-sends it every 5 s until PID 1 is gone; before the boot hands a worker over it drains at once.
|
|
43
43
|
* One retire per process; a second signal joins it.
|
|
44
44
|
*
|
|
45
45
|
* Exits rather than holds, decided 2026-10-07: the `preStop` has no channel back but PID 1 itself,
|
|
@@ -56,6 +56,7 @@ export function armWorkerRetire(options: WorkerRetireOptions = {}): WorkerRetire
|
|
|
56
56
|
const adopted = new Promise<RetiringWorker | null>((resolve) => {
|
|
57
57
|
adopt = resolve;
|
|
58
58
|
});
|
|
59
|
+
let handedOver = false;
|
|
59
60
|
let retiring = false;
|
|
60
61
|
|
|
61
62
|
const retire = async (): Promise<void> => {
|
|
@@ -96,12 +97,24 @@ export function armWorkerRetire(options: WorkerRetireOptions = {}): WorkerRetire
|
|
|
96
97
|
// At the signal, before the worker is awaited or stopped: the app's `isRetiring()` is how its
|
|
97
98
|
// own code (a heartbeat, a status row) sees a retire that `isDraining()` only shows at the end.
|
|
98
99
|
markRetiring();
|
|
100
|
+
// Before the boot handed a worker over, nothing here holds a job — and a boot waiting on the
|
|
101
|
+
// migrate step may not reach one for minutes. Drain NOW: its `accept` phase ends the schema
|
|
102
|
+
// wait, and `holdWhileBooting` exits `drainExitCode()`. Waiting for `adopt` sat the pod out to
|
|
103
|
+
// the wait's deadline and exited it 1, a crash, on every rollout over a failed migrate.
|
|
104
|
+
if (!handedOver) {
|
|
105
|
+
logger.info('jobs.worker.retired', { signal: RETIRE_SIGNAL, before: 'boot' });
|
|
106
|
+
void finish(RETIRE_SIGNAL);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
99
109
|
// Never rejects: `retire` catches its own failure and always reaches the drain.
|
|
100
110
|
void retire();
|
|
101
111
|
};
|
|
102
112
|
signals.on(RETIRE_SIGNAL, listener);
|
|
103
113
|
return {
|
|
104
|
-
adopt: (worker) =>
|
|
114
|
+
adopt: (worker) => {
|
|
115
|
+
handedOver = true;
|
|
116
|
+
adopt(worker);
|
|
117
|
+
},
|
|
105
118
|
disarm: () => signals.off(RETIRE_SIGNAL, listener),
|
|
106
119
|
};
|
|
107
120
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// The superseded-workaround matcher, pure over one file's text: its comment blocks, and which
|
|
2
|
+
// table rows one of them names (`superseded.ts`). No I/O — `doctor-superseded.ts` walks the app.
|
|
3
|
+
|
|
4
|
+
import type { SupersededWorkaround } from './superseded';
|
|
5
|
+
import { NEAR_LINES } from './superseded';
|
|
6
|
+
|
|
7
|
+
/** Consecutive comment lines, joined: a note wrapped over three lines is one sentence. */
|
|
8
|
+
export interface CommentBlock {
|
|
9
|
+
/** 1-based, inclusive. */
|
|
10
|
+
readonly start: number;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
readonly text: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SupersededHit {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** `path:line` of the note's first line. */
|
|
18
|
+
readonly at: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const WHOLE = /^(?:\/\/+|\/\*+|\*+\/?|\{\/\*+)\s?(.*)$/;
|
|
22
|
+
const TAIL = /\s\/\/\s(.*)$/;
|
|
23
|
+
|
|
24
|
+
/** A whole-line comment's text, or the tail after a trailing ` // `; `undefined` for code. */
|
|
25
|
+
function commentText(line: string): string | undefined {
|
|
26
|
+
const whole = WHOLE.exec(line.trim());
|
|
27
|
+
if (whole !== null) return whole[1] ?? '';
|
|
28
|
+
return TAIL.exec(line)?.[1];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The code on a line: nothing for a whole-line comment, the head before a trailing ` // `. */
|
|
32
|
+
function codePart(line: string): string {
|
|
33
|
+
if (WHOLE.test(line.trim())) return '';
|
|
34
|
+
const tail = TAIL.exec(line);
|
|
35
|
+
return tail === null ? line : line.slice(0, tail.index);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Markdown is prose throughout: each paragraph is a block. Code reads its comments only. */
|
|
39
|
+
export function commentBlocks(path: string, text: string): readonly CommentBlock[] {
|
|
40
|
+
const prose = path.endsWith('.md');
|
|
41
|
+
const lines = text.split(/\r?\n/);
|
|
42
|
+
const blocks: CommentBlock[] = [];
|
|
43
|
+
let open: { start: number; parts: string[] } | undefined;
|
|
44
|
+
const close = (end: number): void => {
|
|
45
|
+
if (open !== undefined) blocks.push({ start: open.start, end, text: open.parts.join(' ') });
|
|
46
|
+
open = undefined;
|
|
47
|
+
};
|
|
48
|
+
lines.forEach((line, index) => {
|
|
49
|
+
const part = prose ? (line.trim() === '' ? undefined : line.trim()) : commentText(line);
|
|
50
|
+
if (part === undefined) {
|
|
51
|
+
close(index);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (open === undefined) open = { start: index + 1, parts: [] };
|
|
55
|
+
open.parts.push(part);
|
|
56
|
+
});
|
|
57
|
+
close(lines.length);
|
|
58
|
+
return blocks;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Every row a block of `text` names, once per block, in file order. */
|
|
62
|
+
export function matchSuperseded(
|
|
63
|
+
path: string,
|
|
64
|
+
text: string,
|
|
65
|
+
rows: readonly SupersededWorkaround[],
|
|
66
|
+
): readonly SupersededHit[] {
|
|
67
|
+
const prose = path.endsWith('.md');
|
|
68
|
+
const blocks = commentBlocks(path, text);
|
|
69
|
+
const lines = text.split(/\r?\n/);
|
|
70
|
+
const hits: SupersededHit[] = [];
|
|
71
|
+
for (const block of blocks) {
|
|
72
|
+
for (const row of rows) {
|
|
73
|
+
if (!row.pattern.comment.every((pattern) => pattern.test(block.text))) continue;
|
|
74
|
+
const near = row.pattern.near;
|
|
75
|
+
if (near !== undefined) {
|
|
76
|
+
// Prose has no code to stand beside: a page quoting the workaround is not holding it.
|
|
77
|
+
if (prose) continue;
|
|
78
|
+
const from = Math.max(0, block.start - 1 - NEAR_LINES);
|
|
79
|
+
const window = lines.slice(from, block.end + NEAR_LINES);
|
|
80
|
+
// Code only: a note quoting `render: 'ssr'` is not the page declaring it.
|
|
81
|
+
if (!window.some((line) => near.test(codePart(line)))) continue;
|
|
82
|
+
}
|
|
83
|
+
hits.push({ id: row.id, at: `${path}:${block.start}` });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return hits;
|
|
87
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The superseded-workaround table: what an app wrote while the framework lacked something, the
|
|
2
|
+
// version that shipped the real thing, and the edit that retires the workaround. `x doctor` and
|
|
3
|
+
// `x upgrade` report each hit (`doctor-superseded.ts`); `scripts/changelog-check.ts` refuses a
|
|
4
|
+
// release note that retires a workaround this table does not hold.
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What to find. `comment` is matched on comment text only — a `//`, `/*` or `*` line of code, any
|
|
8
|
+
* line of markdown — and EVERY pattern must match one comment block: a workaround is recognised by
|
|
9
|
+
* the note that names it, never by ordinary code. `near`, when set, must also stand in the code
|
|
10
|
+
* within `NEAR_LINES` of that block: the note alone is stale prose, the note beside it is the
|
|
11
|
+
* workaround still in force.
|
|
12
|
+
*/
|
|
13
|
+
export interface WorkaroundPattern {
|
|
14
|
+
readonly comment: readonly RegExp[];
|
|
15
|
+
readonly near?: RegExp;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SupersededWorkaround {
|
|
19
|
+
/** Stable, kebab-case: a CHANGELOG line names it (`retires the workaround \`<id>\``). */
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly pattern: WorkaroundPattern;
|
|
22
|
+
/** The framework version that shipped the replacement. */
|
|
23
|
+
readonly shippedIn: string;
|
|
24
|
+
/** What replaced it, as an author would search for it. */
|
|
25
|
+
readonly replacement: string;
|
|
26
|
+
/** Opens with the code or command to paste (the fix-prose rule). */
|
|
27
|
+
readonly fix: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** How far from its note the workaround's code may stand, in lines either way. */
|
|
31
|
+
export const NEAR_LINES = 8;
|
|
32
|
+
|
|
33
|
+
export const SUPERSEDED_WORKAROUNDS: readonly SupersededWorkaround[] = [
|
|
34
|
+
{
|
|
35
|
+
// The scaffold itself wrote this until 30.0.0: "'ssr', not 'stream' … the framework has no hole
|
|
36
|
+
// marker yet". Apps kept the comment and the mode after the marker shipped.
|
|
37
|
+
id: 'ssr-until-hole',
|
|
38
|
+
pattern: { comment: [/\bhole\s+marker\b/i], near: /\brender\s*:\s*['"]ssr['"]/ },
|
|
39
|
+
shippedIn: '30.0.0',
|
|
40
|
+
replacement: "<Hole> from '@ultimat3/render' on a render: 'stream' page",
|
|
41
|
+
fix: "render: 'stream', with the slow read moved into <Hole fallback={<Skeleton />}>{() => read()}</Hole> (import { Hole } from '@ultimat3/render'); then delete the comment that waits for a hole marker",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
// `x token` exited `X_NOT_IMPLEMENTED` until 31.17.0; a key-minting script said so in its header.
|
|
45
|
+
id: 'token-unimplemented',
|
|
46
|
+
pattern: {
|
|
47
|
+
comment: [
|
|
48
|
+
// Present tense only, and never `x token grant`, which is still planned: a changelog line
|
|
49
|
+
// saying the command "exited X_NOT_IMPLEMENTED" is history, not a workaround.
|
|
50
|
+
/\bx token`?(?! grant)\s+(?:\w+\s+){0,3}?(?:is|isn't|still|remains)\s+(?:not (?:yet )?(?:implemented|shipped|available)|unimplemented|planned|a stub)\b|\bx token`?(?! grant)[^.]*\bexits\s+`?X_NOT_IMPLEMENTED/i,
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
shippedIn: '31.17.0',
|
|
54
|
+
replacement: 'x token create | list | revoke',
|
|
55
|
+
fix: 'x token create --scopes posts:read --json — mints the key with exact scopes; delete the note, and the script it stood in for',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
// A gaps note saying the gate cannot run one step: `--only` shipped with the gate in 22.0.0.
|
|
59
|
+
id: 'verify-no-only',
|
|
60
|
+
pattern: {
|
|
61
|
+
comment: [
|
|
62
|
+
// The claim about the gate, never a fixture or a step that merely runs without the flag.
|
|
63
|
+
/\b(?:verify|gate)`?\s+(?:has|have|takes|offers|supports)\s+no\s+`?--only\b|`--only`\s+(?:flag\s+)?(?:does not exist|doesn't exist|is missing|is not supported|isn't supported)/i,
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
shippedIn: '22.0.0',
|
|
67
|
+
replacement: 'x verify --only <step>',
|
|
68
|
+
fix: 'x verify --only lint --json — runs one step; delete the note that says the gate cannot',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
// A hand-written TLS terminator or relay in front of `x dev` for a LAN or a secure origin.
|
|
72
|
+
id: 'dev-no-tls',
|
|
73
|
+
pattern: {
|
|
74
|
+
comment: [
|
|
75
|
+
// One sentence, a few words apart: `x dev`, then a whole-word negation, then what it lacks.
|
|
76
|
+
// "Start it with `x dev`. In production nothing terminates TLS" is two sentences.
|
|
77
|
+
/\bx dev`?\s+(?:[^\s.]+\s+){0,3}?\b(?:no|lacks|does not|doesn't|cannot|can't|won't)\s+(?:[^\s.]+\s+){0,3}?`?(?:tls|https|--tls|--host|ipv6)\b/i,
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
shippedIn: '31.27.0',
|
|
81
|
+
replacement: 'x dev --host <address> --tls',
|
|
82
|
+
fix: 'x dev --host 0.0.0.0 --tls — serves https on the LAN with a cached local certificate; delete the terminator or relay the note describes',
|
|
83
|
+
},
|
|
84
|
+
];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The Bun image `x new` builds on, as a value: what the `runtime-pin` guard names in a fix and what
|
|
2
|
+
// the `runtime-pin` codemod moves an older app to. The Dockerfile template states the same image as
|
|
3
|
+
// literal text (scripts/bun-pin.test.ts reads that source), and bun-image.test.ts holds the two equal.
|
|
4
|
+
|
|
5
|
+
import { REQUIRED_BUN } from '../app-root';
|
|
6
|
+
|
|
7
|
+
export interface BunImage {
|
|
8
|
+
/** The exact Bun the digest was read from — `engines.bun`'s floor, the patch CI runs. */
|
|
9
|
+
readonly patch: string;
|
|
10
|
+
/** What the `FROM` tag names: the series, so the reader sees which line it follows. */
|
|
11
|
+
readonly series: string;
|
|
12
|
+
readonly variant: string;
|
|
13
|
+
readonly digest: string;
|
|
14
|
+
/** `oven/bun:<series>-<variant>@<digest>`, the text after `FROM`. */
|
|
15
|
+
readonly ref: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const series = REQUIRED_BUN.split('.').slice(0, 2).join('.');
|
|
19
|
+
const variant = 'alpine';
|
|
20
|
+
// `docker buildx imagetools inspect oven/bun:1.4.4-alpine` — moved together with REQUIRED_BUN.
|
|
21
|
+
const digest = 'sha256:4cf82f5686b196504fe119db3fcd9185b191f82ece82c40680e597228ec6070a';
|
|
22
|
+
|
|
23
|
+
export const SCAFFOLD_BUN_IMAGE: BunImage = {
|
|
24
|
+
patch: REQUIRED_BUN,
|
|
25
|
+
series,
|
|
26
|
+
variant,
|
|
27
|
+
digest,
|
|
28
|
+
ref: `oven/bun:${series}-${variant}@${digest}`,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Every digest a released scaffold's Dockerfile built on, by the exact Bun it was read from. The
|
|
33
|
+
* `FROM` tag names only the series, so this is how the framework reads back the patch of an image
|
|
34
|
+
* it wrote itself; any other digest was chosen or moved by the app. A bump moves the current row
|
|
35
|
+
* here as an earlier one.
|
|
36
|
+
*/
|
|
37
|
+
const DIGEST_PATCHES: Readonly<Record<string, string>> = {
|
|
38
|
+
// 27.10.3
|
|
39
|
+
'sha256:d888c0ae6c86d7866ff10c5aafdd9077b36aee6455b33dd270fb93c0dd5cef6f': '1.4.2',
|
|
40
|
+
// 28.0.0
|
|
41
|
+
'sha256:629e17411f1f129dbec3af78d5af9c9f2a937435c80349437206c6b0b7422373': '1.4.3',
|
|
42
|
+
// 29.0.0 onward
|
|
43
|
+
[digest]: REQUIRED_BUN,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** The Bun patch a scaffold-written digest holds, or undefined for one no scaffold wrote. */
|
|
47
|
+
export const scaffoldDigestPatch = (sha: string): string | undefined =>
|
|
48
|
+
Object.hasOwn(DIGEST_PATCHES, sha) ? DIGEST_PATCHES[sha] : undefined;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// The panel table of the Grafana dashboard every Ultimate chart ships: requests, latency, statements,
|
|
2
|
+
// pool, jobs, realtime, the process, the Postgres server and the framework schema, over the series
|
|
3
|
+
// the framework declares. `chart-dashboard.ts` renders it as Grafana's JSON model.
|
|
4
|
+
|
|
5
|
+
export interface DashboardTarget {
|
|
6
|
+
readonly expr: string;
|
|
7
|
+
/** Grafana's legend template, `{{label}}` interpolated per series. */
|
|
8
|
+
readonly legend: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DashboardPanel {
|
|
12
|
+
readonly title: string;
|
|
13
|
+
/** Grafana's unit id: `reqps`, `s`, `bytes`, `percentunit`, `short`. */
|
|
14
|
+
readonly unit: string;
|
|
15
|
+
readonly targets: readonly DashboardTarget[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** One release in one namespace — the two labels the ServiceMonitor puts on every series. */
|
|
19
|
+
const SCOPE = 'namespace="$namespace",app_kubernetes_io_instance="$release"';
|
|
20
|
+
const RATE = '[$__rate_interval]';
|
|
21
|
+
|
|
22
|
+
const s = (name: string, extra?: string): string =>
|
|
23
|
+
`${name}{${extra === undefined ? SCOPE : `${SCOPE},${extra}`}}`;
|
|
24
|
+
|
|
25
|
+
const p = (q: number, name: string, by: string): string =>
|
|
26
|
+
`histogram_quantile(${String(q)}, sum by (${by}, le) (rate(${s(`${name}_bucket`)}${RATE})))`;
|
|
27
|
+
|
|
28
|
+
export const DASHBOARD_PANELS: readonly DashboardPanel[] = [
|
|
29
|
+
{
|
|
30
|
+
title: 'Requests per second, by status class',
|
|
31
|
+
unit: 'reqps',
|
|
32
|
+
targets: [
|
|
33
|
+
{ expr: `sum by (status) (rate(${s('http_requests_total')}${RATE}))`, legend: '{{status}}' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: 'Latency p95, by route',
|
|
38
|
+
unit: 's',
|
|
39
|
+
targets: [{ expr: p(0.95, 'http_request_duration_seconds', 'route'), legend: '{{route}}' }],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: '5xx share of requests',
|
|
43
|
+
unit: 'percentunit',
|
|
44
|
+
targets: [
|
|
45
|
+
{
|
|
46
|
+
expr: `sum(rate(${s('http_requests_total', 'status="5xx"')}${RATE})) / sum(rate(${s('http_requests_total')}${RATE}))`,
|
|
47
|
+
legend: '5xx',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: 'Statement p95, by operation',
|
|
53
|
+
unit: 's',
|
|
54
|
+
targets: [
|
|
55
|
+
{
|
|
56
|
+
expr: p(0.95, 'db_client_operation_duration_seconds', 'db_operation_name'),
|
|
57
|
+
legend: 'p95 {{db_operation_name}}',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: 'Database pool, by pod',
|
|
63
|
+
unit: 'short',
|
|
64
|
+
targets: [
|
|
65
|
+
{ expr: `sum by (pod) (${s('db_pool_in_use')})`, legend: 'in use {{pod}}' },
|
|
66
|
+
{ expr: `sum by (pod) (${s('db_pool_waiting')})`, legend: 'waiting {{pod}}' },
|
|
67
|
+
{ expr: `sum by (pod) (${s('db_pool_max')})`, legend: 'max {{pod}}' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
title: 'Jobs per second, by queue and outcome',
|
|
72
|
+
unit: 'short',
|
|
73
|
+
targets: [
|
|
74
|
+
{
|
|
75
|
+
expr: `sum by (queue, outcome) (rate(${s('jobs_total')}${RATE}))`,
|
|
76
|
+
legend: '{{queue}} {{outcome}}',
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: 'Queue: oldest ready job and dead letters',
|
|
82
|
+
unit: 's',
|
|
83
|
+
targets: [
|
|
84
|
+
{ expr: `max by (queue) (${s('queue_oldest_ready_seconds')})`, legend: 'oldest {{queue}}' },
|
|
85
|
+
{ expr: `max by (queue) (${s('queue_dead_jobs')})`, legend: 'dead {{queue}}' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: 'Job duration p95, by queue',
|
|
90
|
+
unit: 's',
|
|
91
|
+
targets: [{ expr: p(0.95, 'job_duration_seconds', 'queue'), legend: '{{queue}}' }],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
title: 'Realtime: connections and dropped frames',
|
|
95
|
+
unit: 'short',
|
|
96
|
+
targets: [
|
|
97
|
+
{ expr: `sum by (pod) (${s('connections')})`, legend: 'connections {{pod}}' },
|
|
98
|
+
{
|
|
99
|
+
expr: `sum(rate(${s('channel_frames_dropped_total')}${RATE}))`,
|
|
100
|
+
legend: 'frames dropped/s',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: 'Memory: RSS over the container limit, by pod',
|
|
106
|
+
unit: 'percentunit',
|
|
107
|
+
targets: [
|
|
108
|
+
{
|
|
109
|
+
expr: `max by (pod) (${s('process_resident_memory_bytes')} / ${s('process_memory_limit_bytes')})`,
|
|
110
|
+
legend: '{{pod}}',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: 'CPU seconds per second, by pod',
|
|
116
|
+
unit: 'short',
|
|
117
|
+
targets: [
|
|
118
|
+
{ expr: `sum by (pod) (rate(${s('process_cpu_seconds_total')}${RATE}))`, legend: '{{pod}}' },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: 'Event-loop lag p99, by pod',
|
|
123
|
+
unit: 's',
|
|
124
|
+
targets: [{ expr: p(0.99, 'process_event_loop_lag_seconds', 'pod'), legend: '{{pod}}' }],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
title: 'Restarts in the last hour, by role',
|
|
128
|
+
unit: 'short',
|
|
129
|
+
targets: [
|
|
130
|
+
{
|
|
131
|
+
expr: `sum by (app_kubernetes_io_component) (changes(${s('process_start_time_seconds')}[1h]))`,
|
|
132
|
+
legend: '{{app_kubernetes_io_component}}',
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: 'Postgres: client connections against max_connections',
|
|
138
|
+
unit: 'short',
|
|
139
|
+
targets: [
|
|
140
|
+
{ expr: `max(${s('db_server_connections')})`, legend: 'connections' },
|
|
141
|
+
{ expr: `max(${s('db_server_max_connections')})`, legend: 'max_connections' },
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
title: 'Postgres: longest open transaction',
|
|
146
|
+
unit: 's',
|
|
147
|
+
targets: [{ expr: `max(${s('db_longest_transaction_seconds')})`, legend: 'longest' }],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: 'Postgres: autovacuum backlog, the worst table (1 = due)',
|
|
151
|
+
unit: 'short',
|
|
152
|
+
targets: [{ expr: `max(${s('db_autovacuum_backlog_ratio')})`, legend: 'dead / trigger' }],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: 'Postgres: WAL retained, by replication slot',
|
|
156
|
+
unit: 'bytes',
|
|
157
|
+
targets: [
|
|
158
|
+
{
|
|
159
|
+
expr: `max by (slot) (${s('db_replication_slot_retained_bytes')})`,
|
|
160
|
+
legend: '{{slot}}',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
title: 'Framework schema: unapplied and major skew, by role',
|
|
166
|
+
unit: 'short',
|
|
167
|
+
targets: [
|
|
168
|
+
{
|
|
169
|
+
expr: `count by (app_kubernetes_io_component) (${s('framework_schema_applied')} == 0)`,
|
|
170
|
+
legend: 'unapplied {{app_kubernetes_io_component}}',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
expr: `max by (app_kubernetes_io_component) (${s('framework_schema_major_skew')})`,
|
|
174
|
+
legend: 'skew {{app_kubernetes_io_component}}',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
];
|
|
@@ -2,140 +2,11 @@
|
|
|
2
2
|
// pool, jobs, realtime and the process, over the series the framework declares. One column of
|
|
3
3
|
// full-width panels, so a phone reads it as it is. The JSON and its ConfigMap are generated here;
|
|
4
4
|
// `docker/helm/` holds these bytes for the chart named `ultimate`.
|
|
5
|
+
import { DASHBOARD_PANELS, type DashboardPanel } from './chart-dashboard-panels';
|
|
5
6
|
import type { GeneratedFile, NameSet } from './naming';
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
/** Grafana's legend template, `{{label}}` interpolated per series. */
|
|
10
|
-
readonly legend: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface DashboardPanel {
|
|
14
|
-
readonly title: string;
|
|
15
|
-
/** Grafana's unit id: `reqps`, `s`, `bytes`, `percentunit`, `short`. */
|
|
16
|
-
readonly unit: string;
|
|
17
|
-
readonly targets: readonly DashboardTarget[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** One release in one namespace — the two labels the ServiceMonitor puts on every series. */
|
|
21
|
-
const SCOPE = 'namespace="$namespace",app_kubernetes_io_instance="$release"';
|
|
22
|
-
const RATE = '[$__rate_interval]';
|
|
23
|
-
|
|
24
|
-
const s = (name: string, extra?: string): string =>
|
|
25
|
-
`${name}{${extra === undefined ? SCOPE : `${SCOPE},${extra}`}}`;
|
|
26
|
-
|
|
27
|
-
const p = (q: number, name: string, by: string): string =>
|
|
28
|
-
`histogram_quantile(${String(q)}, sum by (${by}, le) (rate(${s(`${name}_bucket`)}${RATE})))`;
|
|
29
|
-
|
|
30
|
-
export const DASHBOARD_PANELS: readonly DashboardPanel[] = [
|
|
31
|
-
{
|
|
32
|
-
title: 'Requests per second, by status class',
|
|
33
|
-
unit: 'reqps',
|
|
34
|
-
targets: [
|
|
35
|
-
{ expr: `sum by (status) (rate(${s('http_requests_total')}${RATE}))`, legend: '{{status}}' },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
title: 'Latency p95, by route',
|
|
40
|
-
unit: 's',
|
|
41
|
-
targets: [{ expr: p(0.95, 'http_request_duration_seconds', 'route'), legend: '{{route}}' }],
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
title: '5xx share of requests',
|
|
45
|
-
unit: 'percentunit',
|
|
46
|
-
targets: [
|
|
47
|
-
{
|
|
48
|
-
expr: `sum(rate(${s('http_requests_total', 'status="5xx"')}${RATE})) / sum(rate(${s('http_requests_total')}${RATE}))`,
|
|
49
|
-
legend: '5xx',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
title: 'Statement p95, by operation',
|
|
55
|
-
unit: 's',
|
|
56
|
-
targets: [
|
|
57
|
-
{
|
|
58
|
-
expr: p(0.95, 'db_client_operation_duration_seconds', 'db_operation_name'),
|
|
59
|
-
legend: 'p95 {{db_operation_name}}',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
title: 'Database pool, by pod',
|
|
65
|
-
unit: 'short',
|
|
66
|
-
targets: [
|
|
67
|
-
{ expr: `sum by (pod) (${s('db_pool_in_use')})`, legend: 'in use {{pod}}' },
|
|
68
|
-
{ expr: `sum by (pod) (${s('db_pool_waiting')})`, legend: 'waiting {{pod}}' },
|
|
69
|
-
{ expr: `sum by (pod) (${s('db_pool_max')})`, legend: 'max {{pod}}' },
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
title: 'Jobs per second, by queue and outcome',
|
|
74
|
-
unit: 'short',
|
|
75
|
-
targets: [
|
|
76
|
-
{
|
|
77
|
-
expr: `sum by (queue, outcome) (rate(${s('jobs_total')}${RATE}))`,
|
|
78
|
-
legend: '{{queue}} {{outcome}}',
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
title: 'Queue: oldest ready job and dead letters',
|
|
84
|
-
unit: 's',
|
|
85
|
-
targets: [
|
|
86
|
-
{ expr: `max by (queue) (${s('queue_oldest_ready_seconds')})`, legend: 'oldest {{queue}}' },
|
|
87
|
-
{ expr: `max by (queue) (${s('queue_dead_jobs')})`, legend: 'dead {{queue}}' },
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
title: 'Job duration p95, by queue',
|
|
92
|
-
unit: 's',
|
|
93
|
-
targets: [{ expr: p(0.95, 'job_duration_seconds', 'queue'), legend: '{{queue}}' }],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
title: 'Realtime: connections and dropped frames',
|
|
97
|
-
unit: 'short',
|
|
98
|
-
targets: [
|
|
99
|
-
{ expr: `sum by (pod) (${s('connections')})`, legend: 'connections {{pod}}' },
|
|
100
|
-
{
|
|
101
|
-
expr: `sum(rate(${s('channel_frames_dropped_total')}${RATE}))`,
|
|
102
|
-
legend: 'frames dropped/s',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
title: 'Memory: RSS over the container limit, by pod',
|
|
108
|
-
unit: 'percentunit',
|
|
109
|
-
targets: [
|
|
110
|
-
{
|
|
111
|
-
expr: `max by (pod) (${s('process_resident_memory_bytes')} / ${s('process_memory_limit_bytes')})`,
|
|
112
|
-
legend: '{{pod}}',
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
title: 'CPU seconds per second, by pod',
|
|
118
|
-
unit: 'short',
|
|
119
|
-
targets: [
|
|
120
|
-
{ expr: `sum by (pod) (rate(${s('process_cpu_seconds_total')}${RATE}))`, legend: '{{pod}}' },
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
title: 'Event-loop lag p99, by pod',
|
|
125
|
-
unit: 's',
|
|
126
|
-
targets: [{ expr: p(0.99, 'process_event_loop_lag_seconds', 'pod'), legend: '{{pod}}' }],
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
title: 'Restarts in the last hour, by role',
|
|
130
|
-
unit: 'short',
|
|
131
|
-
targets: [
|
|
132
|
-
{
|
|
133
|
-
expr: `sum by (app_kubernetes_io_component) (changes(${s('process_start_time_seconds')}[1h]))`,
|
|
134
|
-
legend: '{{app_kubernetes_io_component}}',
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
];
|
|
8
|
+
export type { DashboardPanel, DashboardTarget } from './chart-dashboard-panels';
|
|
9
|
+
export { DASHBOARD_PANELS } from './chart-dashboard-panels';
|
|
139
10
|
|
|
140
11
|
/** The stable uid a provisioned dashboard keeps across upgrades, so a bookmark survives. */
|
|
141
12
|
export const DASHBOARD_UID = 'ultimate-app';
|
|
@@ -156,8 +27,11 @@ const variable = (name: string, query: string) => ({
|
|
|
156
27
|
|
|
157
28
|
const PANEL_HEIGHT = 8;
|
|
158
29
|
|
|
159
|
-
/**
|
|
160
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The dashboard as Grafana's JSON model, two-space indented, one trailing newline. `panels` is a
|
|
32
|
+
* seam for a codemod's test, which re-renders an older release's panel list.
|
|
33
|
+
*/
|
|
34
|
+
export function dashboardJson(panels: readonly DashboardPanel[] = DASHBOARD_PANELS): string {
|
|
161
35
|
const model = {
|
|
162
36
|
uid: DASHBOARD_UID,
|
|
163
37
|
title: 'Ultimate app',
|
|
@@ -176,7 +50,7 @@ export function dashboardJson(): string {
|
|
|
176
50
|
),
|
|
177
51
|
],
|
|
178
52
|
},
|
|
179
|
-
panels:
|
|
53
|
+
panels: panels.map((panel, index) => ({
|
|
180
54
|
id: index + 1,
|
|
181
55
|
type: 'timeseries',
|
|
182
56
|
title: panel.title,
|