@ultimat3/cli 30.9.0 → 31.1.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 +80 -64
- package/README.md +4 -1
- package/package.json +30 -29
- package/src/admin-registration.ts +1 -1
- package/src/affected-base.ts +51 -0
- package/src/affected.ts +34 -11
- package/src/app-boundaries.ts +88 -9
- package/src/app-load-async.ts +133 -0
- package/src/app-load-batch.ts +203 -0
- package/src/app-load-prebuilt.ts +147 -0
- package/src/app-load-register.ts +175 -0
- package/src/app-load.ts +143 -175
- package/src/app-loader-imports.ts +31 -0
- package/src/app-root.ts +13 -0
- package/src/app-runtime.ts +5 -1
- package/src/boundary-findings.ts +12 -0
- package/src/browser-launcher-port.ts +3 -7
- package/src/browser-launcher.ts +1 -1
- package/src/budgets-scan.ts +8 -0
- package/src/budgets.ts +10 -1
- package/src/build-registry-background.ts +59 -0
- package/src/build-registry.ts +207 -0
- package/src/cdp-shot-clock.ts +3 -11
- package/src/cdp-shot-driver.ts +3 -2
- package/src/cdp-shot-element.ts +3 -2
- package/src/cdp-shot-page.ts +2 -2
- package/src/cdp-shot-watch.ts +4 -3
- package/src/ci-log.ts +76 -13
- package/src/cmd-affected-spec.ts +7 -3
- package/src/cmd-affected.ts +91 -77
- package/src/cmd-auth.ts +3 -3
- package/src/cmd-ci.ts +6 -3
- package/src/cmd-db-recount.ts +15 -0
- package/src/cmd-drill.ts +10 -6
- package/src/cmd-exercise.ts +2 -1
- package/src/cmd-generate-spec.ts +6 -0
- package/src/cmd-generate.ts +22 -4
- package/src/cmd-mail.ts +1 -1
- package/src/cmd-pr-spec.ts +1 -1
- package/src/cmd-pr.ts +72 -1
- package/src/cmd-routes.ts +2 -2
- package/src/cmd-secrets-spec.ts +4 -1
- package/src/cmd-shot.ts +14 -262
- package/src/cmd-test-spec.ts +2 -2
- package/src/cmd-verify-spec.ts +21 -1
- package/src/cmd-verify.ts +16 -4
- package/src/coverage-source.ts +4 -1
- package/src/db-diagnostics.ts +8 -1
- package/src/dev-boot.ts +29 -15
- package/src/dev-dashboard-invalidations.ts +43 -0
- package/src/dev-dashboard.ts +13 -16
- package/src/dev-n-plus-one.ts +7 -3
- package/src/dev-rebuild.ts +2 -1
- package/src/dev-route-table.ts +1 -1
- package/src/dev-traces.ts +16 -15
- package/src/document-options.ts +12 -1
- package/src/drift-store.ts +55 -0
- package/src/error-catalog.ts +8 -3
- package/src/error-codes-boundary.ts +32 -0
- package/src/error-codes-package.ts +38 -0
- package/src/error-codes.ts +28 -40
- package/src/errors.ts +17 -7
- package/src/exercise-database.ts +13 -1
- package/src/exercise-findings.ts +36 -18
- package/src/exercise-services.ts +84 -0
- package/src/exercise-subject.ts +38 -13
- package/src/failure-capture-boot.ts +9 -5
- package/src/framework-schema.ts +5 -5
- package/src/generate-exercise.ts +1 -1
- package/src/generate-files.ts +27 -7
- package/src/generate-kinds.ts +5 -0
- package/src/generate-refresh.ts +53 -0
- package/src/generate-workspace.ts +169 -0
- package/src/generate-write.ts +8 -2
- package/src/hold.ts +19 -8
- package/src/image-prepare.ts +6 -2
- package/src/index.ts +5 -20
- package/src/island-bundle.ts +7 -3
- package/src/island-capture.ts +2 -2
- package/src/island-harness.ts +1 -1
- package/src/job-registration.ts +43 -6
- package/src/jobs-driver.ts +4 -5
- package/src/mcp-errors.ts +20 -4
- package/src/mcp-host.ts +5 -1
- package/src/mcp-ui-interact.ts +3 -0
- package/src/messages-gate.ts +10 -0
- package/src/new-shapes-generate.ts +1 -1
- package/src/otlp-export.ts +94 -29
- package/src/output.ts +24 -10
- package/src/page-sync.ts +3 -1
- package/src/pr-activity.ts +150 -0
- package/src/pr-bots.ts +109 -0
- package/src/pr-threads.ts +7 -2
- package/src/role-load.ts +17 -11
- package/src/role-start.ts +5 -4
- package/src/role-sync.ts +7 -8
- package/src/route-islands-preload.ts +46 -0
- package/src/route-islands.ts +6 -2
- package/src/runtime-admin.ts +5 -1
- package/src/runtime-bindings.ts +25 -19
- package/src/runtime-boot-ports.ts +66 -0
- package/src/runtime-bus.ts +29 -5
- package/src/runtime-cache-bus.ts +53 -0
- package/src/runtime-cache.ts +43 -13
- package/src/runtime-isr-outcome.ts +5 -4
- package/src/runtime-jobs.ts +2 -2
- package/src/runtime-keys.ts +37 -0
- package/src/runtime-overrides.ts +148 -42
- package/src/runtime-port-bindings-queue.ts +36 -0
- package/src/runtime-port-bindings.ts +117 -0
- package/src/runtime-ports.ts +164 -0
- package/src/runtime-purge.ts +41 -28
- package/src/runtime-push.ts +7 -3
- package/src/runtime-queue.ts +70 -55
- package/src/runtime-realtime.ts +5 -5
- package/src/runtime-render-document.ts +4 -1
- package/src/runtime-services.ts +110 -158
- package/src/runtime-storage-boot.ts +111 -0
- package/src/runtime-storage-upload.ts +9 -7
- package/src/runtime-storage.ts +7 -1
- package/src/serve-boot.ts +8 -4
- package/src/serve-entry.ts +3 -0
- package/src/serve-env.ts +47 -14
- package/src/serve-prebuilt-paths.ts +3 -0
- package/src/serve-prebuilt.ts +15 -4
- package/src/serve.ts +2 -2
- package/src/shot-gpu.ts +61 -0
- package/src/shot-route.ts +95 -0
- package/src/shot-run.ts +189 -0
- package/src/shot-verdict.ts +5 -0
- package/src/static-cards.ts +3 -2
- package/src/static-report.ts +2 -2
- package/src/style-bundle.ts +1 -1
- package/src/sync-authenticator.ts +17 -18
- package/src/templates/action-tests.ts +4 -4
- package/src/templates/backfill.ts +5 -8
- package/src/templates/entity.ts +3 -0
- package/src/templates/github/ci.yml.ts +3 -1
- package/src/templates/github/dependabot.yml.ts +73 -0
- package/src/templates/job.ts +13 -22
- package/src/templates/naming.ts +20 -1
- package/src/templates/pinned/docker-compose.yml +1 -1
- package/src/templates/query.ts +7 -8
- package/src/templates/route.ts +5 -3
- package/src/templates/scaffold-api.ts +1 -1
- package/src/templates/scaffold-auth.ts +5 -3
- package/src/templates/scaffold-claude-commands.ts +6 -3
- package/src/templates/scaffold-claude.ts +4 -4
- package/src/templates/scaffold-container-compose.ts +2 -4
- package/src/templates/scaffold-domain-package.ts +1 -1
- package/src/templates/scaffold-entries.ts +6 -1
- package/src/templates/scaffold-helm-fences.ts +3 -2
- package/src/templates/scaffold-helm.ts +35 -6
- package/src/templates/scaffold-repo.ts +47 -135
- package/src/templates/scaffold-runtime-ports.ts +62 -0
- package/src/templates/scaffold-verify-floor.ts +97 -0
- package/src/templates/shapes/overlay.ts +1 -1
- package/src/templates/sign-in-oidc.ts +5 -3
- package/src/templates/sign-in-shared.ts +28 -10
- package/src/templates/workspace.ts +75 -0
- package/src/test-ignores.ts +5 -2
- package/src/test-select.ts +4 -1
- package/src/tsconfig-aliases.ts +85 -0
- package/src/upgrade-gate.ts +30 -5
- package/src/upgrade-report.ts +7 -1
- package/src/verify-changed-facts.ts +53 -0
- package/src/verify-changed-scope.ts +162 -0
- package/src/verify-changed.ts +174 -0
- package/src/verify-checks.ts +33 -19
- package/src/verify-drift-owner.ts +30 -0
- package/src/verify-e2e.ts +2 -1
- package/src/verify-factories.ts +86 -0
- package/src/verify-run.ts +13 -11
- package/src/verify-step.ts +13 -0
- package/src/verify-tests.ts +58 -6
- package/src/workspace-external-deps.ts +164 -0
- package/src/write-line.ts +21 -6
- package/wiki/Actions.md +2 -2
- package/wiki/Adapters.md +400 -0
- package/wiki/Admin-Dashboard.md +1 -1
- package/wiki/Agents.md +9 -9
- package/wiki/Auth.md +78 -2
- package/wiki/Building-Your-Own-Base.md +1 -1
- package/wiki/CLI-Reference.md +45 -14
- package/wiki/Caching-And-Invalidation.md +17 -5
- package/wiki/Compared.md +8 -2
- package/wiki/Configuration.md +14 -14
- package/wiki/Deployment.md +28 -1
- package/wiki/Entities-And-Migrations.md +47 -1
- package/wiki/FAQ.md +8 -2
- package/wiki/Feature-Flags.md +1 -1
- package/wiki/Home.md +3 -2
- package/wiki/Jobs-And-Workflows.md +107 -6
- package/wiki/Known-Gaps.md +4 -3
- package/wiki/MCP-And-AI.md +18 -4
- package/wiki/Mail.md +14 -5
- package/wiki/Migrations-And-Backfills.md +29 -4
- package/wiki/Money.md +2 -0
- package/wiki/N-Plus-One-Detection.md +24 -22
- package/wiki/Notify.md +28 -4
- package/wiki/Observability.md +121 -15
- package/wiki/Queries-And-Live-Queries.md +2 -2
- package/wiki/Realtime.md +9 -4
- package/wiki/Routes-And-Render-Modes.md +5 -0
- package/wiki/Scraping.md +57 -11
- package/wiki/Shapes.md +2 -2
- package/wiki/Stability.md +7 -5
- package/wiki/Storage-And-Uploads.md +56 -4
- package/wiki/Testing.md +65 -52
- package/wiki/Troubleshooting.md +1 -1
- package/wiki/Tutorial-01-First-App.md +1 -1
- package/wiki/Tutorial-04-Jobs-And-Realtime.md +1 -1
- package/wiki/Tutorial-05-Deploy-Free.md +1 -1
- package/wiki/Tutorial-06-Growing-Up.md +8 -8
- package/wiki/Upgrading.md +136 -5
package/src/dev-dashboard.ts
CHANGED
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
devDashboard,
|
|
23
23
|
readOnlySql,
|
|
24
24
|
} from '@ultimat3/admin/dev';
|
|
25
|
-
import { recentInvalidations } from '@ultimat3/cache';
|
|
26
25
|
import type { Role } from '@ultimat3/core';
|
|
27
26
|
import type { Route, UltimateRequest } from '@ultimat3/http';
|
|
28
27
|
import { jsonResponse } from '@ultimat3/http';
|
|
@@ -33,6 +32,7 @@ import type { Manifest } from '@ultimat3/manifest';
|
|
|
33
32
|
import { appManifest, readAppManifest } from './app-manifest';
|
|
34
33
|
import { appBoundaryFindings } from './boundary-findings';
|
|
35
34
|
import { assertSameOrigin, hostRefusal, SQL_BODY, sqlOnGet } from './dev-dashboard-guard';
|
|
35
|
+
import type { InvalidationLog } from './dev-dashboard-invalidations';
|
|
36
36
|
import { mailTemplateFacts } from './dev-mail-templates';
|
|
37
37
|
import type { StatementLedger } from './dev-n-plus-one';
|
|
38
38
|
import { devPolicyMatrix } from './dev-policy';
|
|
@@ -60,8 +60,10 @@ export interface DevDashboardInput {
|
|
|
60
60
|
readonly env?: string | undefined;
|
|
61
61
|
/** The spans this process recorded. Absent when `x dev` did not install the exporter. */
|
|
62
62
|
readonly traces?: TraceRecorder | undefined;
|
|
63
|
-
/** The statement shapes this process counted. Absent when `x dev` did not
|
|
63
|
+
/** The statement shapes this process counted. Absent when `x dev` did not subscribe a ledger. */
|
|
64
64
|
readonly statements?: StatementLedger | undefined;
|
|
65
|
+
/** The busts this process emitted. Absent when `x dev` did not subscribe a log. */
|
|
66
|
+
readonly invalidations?: InvalidationLog | undefined;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
/** `MailMessage.locale` is non-optional in `@ultimat3/mail`, so the panel never has to guess. */
|
|
@@ -101,18 +103,6 @@ async function manifestFact(root: string): Promise<ManifestFact> {
|
|
|
101
103
|
return { emitted, committed: committed ?? null, diff: manifestDiff(emitted, committed) };
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
/**
|
|
105
|
-
* `@ultimat3/cache` keeps the report of every `invalidateTags` fan-out; the panel reads it back
|
|
106
|
-
* as its log. Only the shape differs — the cache owns the facts, /_x owns the rendering.
|
|
107
|
-
*/
|
|
108
|
-
const invalidationFacts = (): readonly InvalidationFact[] =>
|
|
109
|
-
recentInvalidations().map((event) => ({
|
|
110
|
-
at: event.at,
|
|
111
|
-
tags: event.tags,
|
|
112
|
-
busted: event.busted,
|
|
113
|
-
source: event.source,
|
|
114
|
-
}));
|
|
115
|
-
|
|
116
106
|
/**
|
|
117
107
|
* Every source only this process can answer. It owns the SQL connection, the caught outbox, the
|
|
118
108
|
* committed manifest on disk, the span exporter and the app's registries — no other host can.
|
|
@@ -126,6 +116,7 @@ const invalidationFacts = (): readonly InvalidationFact[] =>
|
|
|
126
116
|
export function devSources(input: DevDashboardInput): DevSources {
|
|
127
117
|
const traces = input.traces;
|
|
128
118
|
const statements = input.statements;
|
|
119
|
+
const invalidations = input.invalidations;
|
|
129
120
|
// Only the memory driver retains what it accepted. Once a credential selects a real transport
|
|
130
121
|
// the messages are at the provider, so the hook is omitted rather than answered with `[]` —
|
|
131
122
|
// an empty outbox claims nobody was mailed, which is a different and unearned answer.
|
|
@@ -145,8 +136,14 @@ export function devSources(input: DevDashboardInput): DevSources {
|
|
|
145
136
|
mailTemplates: async (): Promise<readonly MailTemplateFact[]> =>
|
|
146
137
|
mailTemplateFacts((await appLocaleSet(input.root)).locales),
|
|
147
138
|
manifest: (): Promise<ManifestFact> => manifestFact(input.root),
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
// Spread for the traces' reason below: a host that subscribed no log falls back to the
|
|
140
|
+
// refusal, never to an empty list that would claim nothing was ever busted.
|
|
141
|
+
...(invalidations === undefined
|
|
142
|
+
? {}
|
|
143
|
+
: {
|
|
144
|
+
invalidations: (): Promise<readonly InvalidationFact[]> =>
|
|
145
|
+
Promise.resolve(invalidations.facts()),
|
|
146
|
+
}),
|
|
150
147
|
// Read through the app's own policies at request time, so a reload that changes a rule
|
|
151
148
|
// changes the matrix without a remount.
|
|
152
149
|
policyMatrix: (): Promise<readonly PolicyFact[]> => Promise.resolve(devPolicyMatrix()),
|
package/src/dev-n-plus-one.ts
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
// It counts and it warns once; what a verdict *means* — which code, which `fix:` — is
|
|
6
6
|
// `statement-loop.ts`'s, so all four surfaces read one answer.
|
|
7
7
|
|
|
8
|
-
import type { Ctx } from '@ultimat3/core';
|
|
8
|
+
import type { Ctx, StatementAttribution, DbStatementEvent as StatementEvent } from '@ultimat3/core';
|
|
9
9
|
import { assert, tryUseContext } from '@ultimat3/core';
|
|
10
|
-
import type { StatementAttribution, StatementEvent, StatementObserver } from '@ultimat3/db';
|
|
11
10
|
import { statementFingerprint, statementKind } from '@ultimat3/db';
|
|
12
11
|
import { N_PLUS_ONE_THRESHOLD } from '@ultimat3/entity';
|
|
13
12
|
import { loopFacts, warnLoop } from './statement-loop';
|
|
@@ -32,8 +31,13 @@ export interface RepeatedStatement {
|
|
|
32
31
|
readonly traceId: string;
|
|
33
32
|
}
|
|
34
33
|
|
|
34
|
+
/** What the ledger hears: one `db.statement` payload, handed over by `x dev`'s bus subscriber. */
|
|
35
|
+
interface StatementObserver {
|
|
36
|
+
onStatement(event: StatementEvent): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
export interface StatementLedger {
|
|
36
|
-
/**
|
|
40
|
+
/** `x dev` subscribes this to `db.statement`: `subscribe('db.statement', (e) => observer.onStatement(e.payload))`. */
|
|
37
41
|
readonly observer: StatementObserver;
|
|
38
42
|
/** Shapes that crossed the threshold, newest first. */
|
|
39
43
|
repeats(): readonly RepeatedStatement[];
|
package/src/dev-rebuild.ts
CHANGED
|
@@ -81,7 +81,8 @@ export function devRebuilder(
|
|
|
81
81
|
state.appFindings = findings;
|
|
82
82
|
state.islands = islands;
|
|
83
83
|
const unserved = await refreshDevices();
|
|
84
|
-
|
|
84
|
+
// Awaited one by one: a shared store answers over the network, and a dev save is rare.
|
|
85
|
+
for (const path of await isr.store().paths()) await isr.store().delete(path);
|
|
85
86
|
state.reloads += 1;
|
|
86
87
|
// Read on EVERY rebuild, so a pin one save reached is never reported against the next save.
|
|
87
88
|
const pins = takeStalePins();
|
package/src/dev-route-table.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface DevRouteTableInput {
|
|
|
51
51
|
/** A getter: the watcher tick rebuilds the islands, and a captured bundle would serve the first. */
|
|
52
52
|
readonly islands: () => IslandBundle;
|
|
53
53
|
/** `app.config.ts`'s `realtime`, as the boot obeyed it: off, no document names a sync node. */
|
|
54
|
-
readonly realtime: Pick<RealtimeConfig, 'enabled'>;
|
|
54
|
+
readonly realtime: Pick<RealtimeConfig, 'enabled' | 'maxQueued'>;
|
|
55
55
|
/** The web role's limiter store — what a bearer mount counts per-token allowances on. */
|
|
56
56
|
readonly rateLimitStore?: RateLimitStore | undefined;
|
|
57
57
|
/** `apps/<app>/runtime.ts`'s plain `routes`, mounted as the container mounts them. */
|
package/src/dev-traces.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// The `/_x` timeline panel's source: core's own spans, recorded in this process. `x dev` installs
|
|
2
|
-
//
|
|
2
|
+
// a `span.end` subscriber at boot, so every `withSpan` the framework already opens — the request, the action,
|
|
3
3
|
// the query, the cache bust — arrives here and is assembled back into the tree the flame draws.
|
|
4
4
|
// A tracer written here instead would be a second one, disagreeing with `x trace` by construction.
|
|
5
5
|
|
|
6
6
|
import type { RequestTrace, SpanKind, TimelineSpan } from '@ultimat3/admin/dev';
|
|
7
7
|
import type { ReadableSpan, SpanExporter } from '@ultimat3/core';
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
// The attribute names are core's semconv table — read, never restated, so a rename there is a
|
|
9
|
+
// compile error here instead of a panel that silently groups nothing.
|
|
10
|
+
import { finiteCount, SEMCONV } from '@ultimat3/core';
|
|
11
|
+
// `@ultimat3/http`'s pipeline stamps it on the request's root span and on nothing else.
|
|
12
|
+
import { REQUEST_ID_ATTRIBUTE } from '@ultimat3/http';
|
|
12
13
|
|
|
13
14
|
/** Traces retained. A dev panel shows recent requests; it does not page through history. */
|
|
14
15
|
const DEFAULT_LIMIT = 50;
|
|
15
16
|
|
|
16
17
|
export interface TraceRecorder {
|
|
17
|
-
/**
|
|
18
|
+
/** Feed it every ended span: `subscribe('span.end', (e) => recorder.exporter.export(e.payload))`. */
|
|
18
19
|
readonly exporter: SpanExporter;
|
|
19
20
|
/** Complete request traces, newest first. */
|
|
20
21
|
traces(): readonly RequestTrace[];
|
|
@@ -60,21 +61,21 @@ const attrNumber = (span: ReadableSpan, key: string): number | undefined => {
|
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
|
-
* The pipeline names its root span `<METHOD> <path>` and tags it with `http.*`. Reading the
|
|
64
|
+
* The pipeline names its root span `<METHOD> <path>` and tags it with semconv's `http.*`. Reading the
|
|
64
65
|
* attributes first and the name only as a fallback keeps the panel working against a root span
|
|
65
66
|
* from any host, while still preferring the facts the pipeline states outright.
|
|
66
67
|
*/
|
|
67
68
|
function requestFacts(root: ReadableSpan): { method: string; path: string } {
|
|
68
69
|
const [namedMethod = '', namedPath = ''] = root.name.split(' ');
|
|
69
70
|
return {
|
|
70
|
-
method: attrString(root,
|
|
71
|
-
path: attrString(root,
|
|
71
|
+
method: attrString(root, SEMCONV.httpRequestMethod) ?? namedMethod,
|
|
72
|
+
path: attrString(root, SEMCONV.httpRoute) ?? namedPath,
|
|
72
73
|
};
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
/**
|
|
76
|
+
/** The request id is stamped by the pipeline's root and by nothing else; the name is a fallback. */
|
|
76
77
|
const isHttpRoot = (span: ReadableSpan): boolean =>
|
|
77
|
-
span.attributes[
|
|
78
|
+
span.attributes[REQUEST_ID_ATTRIBUTE] !== undefined || /^[A-Z]+ \//.test(span.name);
|
|
78
79
|
|
|
79
80
|
/**
|
|
80
81
|
* The request's own span among a trace's. `parentSpanId === undefined` was a third CONDITION
|
|
@@ -98,10 +99,10 @@ function toTrace(root: ReadableSpan, spans: readonly ReadableSpan[]): RequestTra
|
|
|
98
99
|
const { method, path } = requestFacts(root);
|
|
99
100
|
const origin = root.startedAt;
|
|
100
101
|
return {
|
|
101
|
-
requestId: attrString(root,
|
|
102
|
+
requestId: attrString(root, REQUEST_ID_ATTRIBUTE) ?? root.context.traceId,
|
|
102
103
|
method,
|
|
103
104
|
path,
|
|
104
|
-
status: attrNumber(root,
|
|
105
|
+
status: attrNumber(root, SEMCONV.httpResponseStatusCode) ?? 0,
|
|
105
106
|
startedAt: new Date(origin).toISOString(),
|
|
106
107
|
totalMs: root.durationMs,
|
|
107
108
|
spans: spans
|
|
@@ -116,9 +117,9 @@ function toTrace(root: ReadableSpan, spans: readonly ReadableSpan[]): RequestTra
|
|
|
116
117
|
startMs: Math.max(0, span.startedAt - origin),
|
|
117
118
|
durationMs: span.durationMs,
|
|
118
119
|
// The panel counts repeats of `detail` to find the N+1. A statement states its own
|
|
119
|
-
// identity (`
|
|
120
|
+
// identity (`db.query.text`, set by `@ultimat3/db`'s funnels); for every other span
|
|
120
121
|
// the name is that identity — `query.feed` twice is two reads of one query.
|
|
121
|
-
detail: attrString(span,
|
|
122
|
+
detail: attrString(span, SEMCONV.dbQueryText) ?? span.name,
|
|
122
123
|
}),
|
|
123
124
|
)
|
|
124
125
|
.sort((a, b) => a.startMs - b.startMs),
|
package/src/document-options.ts
CHANGED
|
@@ -12,7 +12,18 @@ import type { NavigationDocumentHead } from './page-navigation';
|
|
|
12
12
|
* no island was built, and a page that renders one then fails by name rather than emitting a
|
|
13
13
|
* `data-x-entry` nothing can import.
|
|
14
14
|
*/
|
|
15
|
-
export type IslandResolver = (routeFile: string) =>
|
|
15
|
+
export type IslandResolver = (routeFile: string) => IslandResolve;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* One route file's resolver: `src` → entry URL, plus — from a real bundle — the shared chunks an
|
|
19
|
+
* entry URL imports (`IslandChunk.imports`), which the document preloads for the islands it
|
|
20
|
+
* rendered (`route-islands-preload.ts`). Optional so a resolver that is only a URL map (a test
|
|
21
|
+
* double) still type-checks; it then earns no preload, never a wrong one.
|
|
22
|
+
*/
|
|
23
|
+
export interface IslandResolve {
|
|
24
|
+
(src: string): string;
|
|
25
|
+
readonly importsOf?: (entryUrl: string) => readonly string[];
|
|
26
|
+
}
|
|
16
27
|
|
|
17
28
|
export interface DocumentOptions {
|
|
18
29
|
readonly resolveIsland?: IslandResolver;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Single responsibility: whether the `drift` step has a SQL schema to judge. Migrations, drift and
|
|
2
|
+
// `x db` describe Postgres only; an app whose rows live in a `defineDriver` store owns its schema,
|
|
3
|
+
// and the step skips it with the reason printed rather than demanding `x db gen "initial"`.
|
|
4
|
+
|
|
5
|
+
import type { DriverStoreKind } from '@ultimat3/entity/adapter';
|
|
6
|
+
import { driverStores } from '@ultimat3/entity/adapter';
|
|
7
|
+
import { msg } from './messages';
|
|
8
|
+
import { MIGRATIONS_DIR } from './migrations';
|
|
9
|
+
import type { Finding } from './output';
|
|
10
|
+
import { fromFindings, type StepOutcome } from './verify-step';
|
|
11
|
+
|
|
12
|
+
type Stores = () => Readonly<Record<DriverStoreKind, readonly string[]>>;
|
|
13
|
+
|
|
14
|
+
/** A recorded migration is proof of a SQL schema, whatever the loaded modules constructed. */
|
|
15
|
+
const hasMigration = (root: string): boolean => {
|
|
16
|
+
// Scanned from the app root, which exists, so a missing migrations directory is no match.
|
|
17
|
+
for (const _ of new Bun.Glob(`${MIGRATIONS_DIR}/*.hash`).scanSync({ cwd: root })) return true;
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The reason to skip, or `undefined` to run. Read AFTER the app is loaded — the drivers its
|
|
23
|
+
* modules construct are what `driverStores()` records. Skips only when every noted store is a
|
|
24
|
+
* custom one AND no migration exists: a mixed app has migrations for its Postgres tables, so a
|
|
25
|
+
* Postgres driver that has not noted itself still cannot switch the step off.
|
|
26
|
+
*/
|
|
27
|
+
export const nonSqlDriftSkip = (
|
|
28
|
+
root: string,
|
|
29
|
+
stores: Stores = driverStores,
|
|
30
|
+
): string | undefined => {
|
|
31
|
+
const { sql, custom } = stores();
|
|
32
|
+
if (custom.length === 0 || sql.length > 0 || hasMigration(root)) return undefined;
|
|
33
|
+
return msg('cli.verify.driftNonSql', { stores: custom.join(', ') });
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export interface DriftRails {
|
|
37
|
+
/** The migration and schema rails — the ones a store owning its own schema has nothing for. */
|
|
38
|
+
readonly schema: () => Promise<readonly Finding[]>;
|
|
39
|
+
/** The generated client against its stamp: a fact about the app's API, whatever stores rows. */
|
|
40
|
+
readonly client: () => Promise<readonly Finding[]>;
|
|
41
|
+
readonly stores?: Stores;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The `drift` step's outcome. A non-SQL app skips the schema rails, with the reason in `output`,
|
|
46
|
+
* and still runs the client rail — a stale `x client` is drift whatever the store is.
|
|
47
|
+
*/
|
|
48
|
+
export const driftOutcome = async (root: string, rails: DriftRails): Promise<StepOutcome> => {
|
|
49
|
+
const skipped = nonSqlDriftSkip(root, rails.stores);
|
|
50
|
+
const findings = [
|
|
51
|
+
...(skipped === undefined ? await rails.schema() : []),
|
|
52
|
+
...(await rails.client()),
|
|
53
|
+
];
|
|
54
|
+
return { ...fromFindings(findings), ...(skipped === undefined ? {} : { output: skipped }) };
|
|
55
|
+
};
|
package/src/error-catalog.ts
CHANGED
|
@@ -50,14 +50,14 @@ export const CATALOG_PACKAGES = [
|
|
|
50
50
|
* declare (`error-catalog.test.ts`), which is why `admin` is not here: `x dev` imports it and
|
|
51
51
|
* `package.json` depends on it. `ui` reaches the CLI only as `admin`'s own dependency, so an
|
|
52
52
|
* installer that keeps transitive packages private reports its codes `unavailable` rather than
|
|
53
|
-
* the CLI declaring a package no command imports. `scraping`
|
|
54
|
-
*
|
|
53
|
+
* the CLI declaring a package no command imports. `scraping` left this list in 31.0.0: the boot
|
|
54
|
+
* imports its `./adapter` when `runtime.ts` supplies a `scrapeDriver`, so it is declared. Every other
|
|
55
55
|
* entry above is a real runtime import and must be a declared dependency — `error-catalog.test.ts`
|
|
56
56
|
* holds the list to exactly that, because an undeclared one resolves through workspace symlinks
|
|
57
57
|
* here and through nothing in an installed app, where `x errors explain X_FLAG_EXPIRED` then
|
|
58
58
|
* refuses a code the wiki promises.
|
|
59
59
|
*/
|
|
60
|
-
export const CATALOG_OPTIONAL_HOSTS: readonly string[] = ['@ultimat3/
|
|
60
|
+
export const CATALOG_OPTIONAL_HOSTS: readonly string[] = ['@ultimat3/ui'];
|
|
61
61
|
|
|
62
62
|
export interface ErrorCatalog {
|
|
63
63
|
/** Packages whose codes are now registered. */
|
|
@@ -135,6 +135,11 @@ export async function buildErrorCatalog(
|
|
|
135
135
|
* `@ultimat3/core` at all. Nothing schema-specific happens here any more.
|
|
136
136
|
*/
|
|
137
137
|
async function importAll(): Promise<ErrorCatalog> {
|
|
138
|
+
// `@ultimat3/admin` and `@ultimat3/ui` ship `.tsx`: without the render loader Bun compiles their
|
|
139
|
+
// JSX itself and the import dies on `Export named 'jsxDEV' not found`. The barrel installs it as
|
|
140
|
+
// a side effect, so it has to finish before the catalog imports run — not race them. The test
|
|
141
|
+
// preload installs it for every suite, which is why only `error-catalog-process.test.ts` sees it.
|
|
142
|
+
await import('@ultimat3/render/server');
|
|
138
143
|
return buildErrorCatalog((specifier) => import(specifier));
|
|
139
144
|
}
|
|
140
145
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The X_* codes of the `boundaries` step's import rules — the app's surfaces, its layers, its
|
|
2
|
+
// packages, the adapter and loader subpaths — split out of `error-codes.ts` at its 500-line
|
|
3
|
+
// ceiling, as `error-codes-shot.ts` was. `@ultimat3/render` owns the surface *rule*; the CLI owns the diagnostic
|
|
4
|
+
// (`app-boundaries.ts` holds the one rule-to-code table). That file registers these in its one call.
|
|
5
|
+
|
|
6
|
+
/** Codes the `boundaries` step and `x fix boundary` report. */
|
|
7
|
+
export const CLI_BOUNDARY_ERROR_CODES = [
|
|
8
|
+
'X_BOUNDARY_SITE_TO_APP',
|
|
9
|
+
'X_BOUNDARY_SHARED_LEAF',
|
|
10
|
+
'X_BOUNDARY_APP_TO_API',
|
|
11
|
+
'X_BOUNDARY_ROUTE_TO_DB',
|
|
12
|
+
'X_BOUNDARY_SERVICE_TO_HTTP',
|
|
13
|
+
'X_BOUNDARY_SURFACE_IMPORT',
|
|
14
|
+
'X_BOUNDARY_PACKAGE_TO_APP',
|
|
15
|
+
'X_BOUNDARY_ADAPTER_IMPORT',
|
|
16
|
+
'X_BOUNDARY_LOADER_IMPORT',
|
|
17
|
+
] as const;
|
|
18
|
+
|
|
19
|
+
export type CliBoundaryErrorCode = (typeof CLI_BOUNDARY_ERROR_CODES)[number];
|
|
20
|
+
|
|
21
|
+
/** Their titles, typed over the list above so a code without one is a build error. */
|
|
22
|
+
export const CLI_BOUNDARY_ERROR_TITLES: Readonly<Record<CliBoundaryErrorCode, string>> = {
|
|
23
|
+
X_BOUNDARY_SITE_TO_APP: 'site/ imported app/',
|
|
24
|
+
X_BOUNDARY_SHARED_LEAF: 'shared/ imported a surface',
|
|
25
|
+
X_BOUNDARY_APP_TO_API: 'app/ imported api/ at runtime',
|
|
26
|
+
X_BOUNDARY_ROUTE_TO_DB: 'a route touched the database',
|
|
27
|
+
X_BOUNDARY_SERVICE_TO_HTTP: 'a service imported HTTP',
|
|
28
|
+
X_BOUNDARY_SURFACE_IMPORT: 'a surface imports one SURFACE_SPECS does not allow',
|
|
29
|
+
X_BOUNDARY_PACKAGE_TO_APP: 'packages/ imported apps/ at runtime',
|
|
30
|
+
X_BOUNDARY_ADAPTER_IMPORT: 'an app module imports an adapter installer',
|
|
31
|
+
X_BOUNDARY_LOADER_IMPORT: 'an app module imports a registration loader',
|
|
32
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// The X_* codes of the `package-shape` and `filesize` steps — what a workspace owes the repo it lives
|
|
2
|
+
// in — split out of `error-codes.ts` at its 500-line ceiling, as `error-codes-shot.ts` was. That
|
|
3
|
+
// file folds these into the CLI's one owned union and registers them in its one call.
|
|
4
|
+
|
|
5
|
+
/** Codes the workspace-shape rules declare and own. */
|
|
6
|
+
export const CLI_PACKAGE_ERROR_CODES = [
|
|
7
|
+
'X_FILE_TOO_LONG',
|
|
8
|
+
'X_PACKAGE_SHAPE',
|
|
9
|
+
// The build graph's own membership rule. `tsc -b` compiles referenced projects and nothing
|
|
10
|
+
// else, so a workspace no root reference names is one the `typecheck` step passes over without
|
|
11
|
+
// reading — the hole that let `scripts/` hold seven type errors under a green gate.
|
|
12
|
+
'X_PACKAGE_UNREFERENCED',
|
|
13
|
+
'X_RELEASE_VERSION_SKEW',
|
|
14
|
+
'X_WORKSPACE_DEP_UNDECLARED',
|
|
15
|
+
// Two module instances of a registry-holding package inside ONE app's `node_modules`. Its own
|
|
16
|
+
// code and not the registry's (`X_CATALOG_UNREGISTERED`, `X_PERMISSION_UNKNOWN`): those carry a
|
|
17
|
+
// source-level fix, and an agent following it here edits a file that is already right — the
|
|
18
|
+
// repair is an install, and only `duplicate-packages.ts` can see that.
|
|
19
|
+
'X_PACKAGE_DUPLICATED',
|
|
20
|
+
'X_PACKAGE_TEST_ONLY_SHIPPED',
|
|
21
|
+
// A registry import only a SIBLING declares: hoisting resolves it until a clean install does not.
|
|
22
|
+
'X_WORKSPACE_EXTERNAL_DEP_UNDECLARED',
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
export type CliPackageErrorCode = (typeof CLI_PACKAGE_ERROR_CODES)[number];
|
|
26
|
+
|
|
27
|
+
/** Their titles, typed over the list above so a code without one is a build error. */
|
|
28
|
+
export const CLI_PACKAGE_ERROR_TITLES: Readonly<Record<CliPackageErrorCode, string>> = {
|
|
29
|
+
X_FILE_TOO_LONG: 'a source file is over 500 lines',
|
|
30
|
+
X_PACKAGE_SHAPE: 'a workspace package is missing a contract file',
|
|
31
|
+
X_PACKAGE_UNREFERENCED: 'a published workspace is not in the root tsconfig build graph',
|
|
32
|
+
X_RELEASE_VERSION_SKEW: 'a workspace is not at the lockstep version',
|
|
33
|
+
X_WORKSPACE_DEP_UNDECLARED: 'a workspace imports another workspace it does not declare',
|
|
34
|
+
X_PACKAGE_DUPLICATED: 'two copies of one registry-holding framework package are installed',
|
|
35
|
+
X_PACKAGE_TEST_ONLY_SHIPPED: 'a test-only module ships in the tarball',
|
|
36
|
+
X_WORKSPACE_EXTERNAL_DEP_UNDECLARED:
|
|
37
|
+
'a workspace imports a registry package that neither it nor the app root declares',
|
|
38
|
+
};
|
package/src/error-codes.ts
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
// the CLI is the surface an agent reads first — a failure here has to be actionable without a doc
|
|
4
4
|
// lookup or a second round-trip. The classes that throw these codes live in `./errors`.
|
|
5
5
|
import { registerErrorCodes } from '@ultimat3/core';
|
|
6
|
+
import type { CliBoundaryErrorCode } from './error-codes-boundary';
|
|
7
|
+
import { CLI_BOUNDARY_ERROR_CODES, CLI_BOUNDARY_ERROR_TITLES } from './error-codes-boundary';
|
|
8
|
+
import type { CliPackageErrorCode } from './error-codes-package';
|
|
9
|
+
import { CLI_PACKAGE_ERROR_CODES, CLI_PACKAGE_ERROR_TITLES } from './error-codes-package';
|
|
6
10
|
import type { CliShotErrorCode } from './error-codes-shot';
|
|
7
11
|
import { CLI_SHOT_ERROR_CODES, CLI_SHOT_ERROR_TITLES } from './error-codes-shot';
|
|
8
12
|
import type { CliToolingErrorCode } from './error-codes-tooling';
|
|
@@ -49,13 +53,6 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
49
53
|
// repo already ran it, in which case the suite was deleted and the gate would otherwise print
|
|
50
54
|
// one more green line for it.
|
|
51
55
|
'X_VERIFY_SUITE_VANISHED',
|
|
52
|
-
'X_FILE_TOO_LONG',
|
|
53
|
-
'X_PACKAGE_SHAPE',
|
|
54
|
-
// The build graph's own membership rule. `tsc -b` compiles referenced projects and nothing
|
|
55
|
-
// else, so a workspace no root reference names is one the `typecheck` step passes over without
|
|
56
|
-
// reading — the hole that let `scripts/` hold seven type errors under a green gate.
|
|
57
|
-
'X_PACKAGE_UNREFERENCED',
|
|
58
|
-
'X_RELEASE_VERSION_SKEW',
|
|
59
56
|
// The framework's own tables, refused by name rather than by the driver's rejection: a raw
|
|
60
57
|
// `permission denied for schema public` says which statement failed and neither which framework
|
|
61
58
|
// table it was creating nor which package wants it.
|
|
@@ -91,7 +88,7 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
91
88
|
// so the remedy printed was `kill <self>` — unrunnable, and a cause that was simply untrue.
|
|
92
89
|
'X_DEV_LOCK_UNREADABLE',
|
|
93
90
|
// The boot's own consistency check. `startServices` captures the drivers it built, and
|
|
94
|
-
// `loadApp` runs AFTER it — so an app module calling `
|
|
91
|
+
// `loadApp` runs AFTER it — so an app module calling `installJobDriver(theirs)` moved the ambient
|
|
95
92
|
// slot and left the captured object alone: every `handle.enqueue()` went to their queue while
|
|
96
93
|
// the worker claimed from Postgres, and the `/_x` panel read the ambient one and agreed with
|
|
97
94
|
// the enqueue side. Nothing failed. Refused here rather than documented, per axiom 3.
|
|
@@ -131,14 +128,6 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
131
128
|
// `x errors explain` hand back the one remedy — name the tier — instead of the flag code's
|
|
132
129
|
// "unknown flag, missing value, or a value the command refuses", which covers a dozen causes.
|
|
133
130
|
'X_SEED_ENVIRONMENT',
|
|
134
|
-
// The five app-surface boundary codes. `@ultimat3/render` owns the *rule* (`checkSurfaceBoundary`)
|
|
135
|
-
// and the CLI owns the diagnostic, because `x verify` and `x fix boundary` are the two commands
|
|
136
|
-
// that report it — see `app-boundaries.ts`, which holds the one rule-to-code table.
|
|
137
|
-
'X_BOUNDARY_SITE_TO_APP',
|
|
138
|
-
'X_BOUNDARY_SHARED_LEAF',
|
|
139
|
-
'X_BOUNDARY_APP_TO_API',
|
|
140
|
-
'X_BOUNDARY_ROUTE_TO_DB',
|
|
141
|
-
'X_BOUNDARY_SERVICE_TO_HTTP',
|
|
142
131
|
// The three ways an app's own guard can fail to be one. A guard is the app's convention made
|
|
143
132
|
// into a build error, so a guard the gate cannot trust has to be a finding rather than a skip:
|
|
144
133
|
// an app that believes its rule is enforced and is not is worse off than one with no rule.
|
|
@@ -159,12 +148,6 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
159
148
|
// CLI's problem alone, and core would have no `fix:` to offer for one.
|
|
160
149
|
'X_SECRETS_EDITOR_MISSING',
|
|
161
150
|
'X_SECRETS_EDIT_FAILED',
|
|
162
|
-
'X_WORKSPACE_DEP_UNDECLARED',
|
|
163
|
-
// Two module instances of a registry-holding package inside ONE app's `node_modules`. Its own
|
|
164
|
-
// code and not the registry's (`X_CATALOG_UNREGISTERED`, `X_PERMISSION_UNKNOWN`): those carry a
|
|
165
|
-
// source-level fix, and an agent following it here edits a file that is already right — the
|
|
166
|
-
// repair is an install, and only `duplicate-packages.ts` can see that.
|
|
167
|
-
'X_PACKAGE_DUPLICATED',
|
|
168
151
|
'X_GH_UNAVAILABLE',
|
|
169
152
|
'X_GH_NOT_AUTHENTICATED',
|
|
170
153
|
'X_GH_COMMAND_FAILED',
|
|
@@ -173,7 +156,6 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
173
156
|
'X_CI_RUN_NOT_FOUND',
|
|
174
157
|
'X_APP_NAME_EMPTY',
|
|
175
158
|
'X_APP_EMPTY',
|
|
176
|
-
'X_BOUNDARY_SURFACE_IMPORT',
|
|
177
159
|
'X_PERMISSION_UNGRANTED',
|
|
178
160
|
'X_JOB_UNREGISTERED',
|
|
179
161
|
'X_FEATURE_UNKNOWN',
|
|
@@ -205,7 +187,6 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
205
187
|
'X_PERMISSION_BORROWED',
|
|
206
188
|
'X_ERROR_CODE_UNTHROWN_STALE',
|
|
207
189
|
'X_DEV_STATE_UNWRITABLE',
|
|
208
|
-
'X_PACKAGE_TEST_ONLY_SHIPPED',
|
|
209
190
|
'X_ISLAND_MODULE_DUPLICATED',
|
|
210
191
|
'X_BACKFILL_SLICE_ENTITY',
|
|
211
192
|
'X_LAYOUT_SIBLING_MODULE',
|
|
@@ -227,7 +208,6 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
227
208
|
'X_DEPLOY_BUILD_MISMATCH',
|
|
228
209
|
'X_JOB_OUTLASTS_DRAIN',
|
|
229
210
|
'X_FEATURE_REQUIRED',
|
|
230
|
-
'X_BOUNDARY_PACKAGE_TO_APP',
|
|
231
211
|
'X_APP_IMPORT_UNRESOLVED',
|
|
232
212
|
'X_STREAM_ALREADY_FLUSHED',
|
|
233
213
|
'X_QUERY_SLICE_ENTITY',
|
|
@@ -251,6 +231,11 @@ export const CLI_OWNED_ERROR_CODES = [
|
|
|
251
231
|
'X_ISLAND_DISPOSER_MISSING',
|
|
252
232
|
'X_SOCKET_HAND_ROLLED',
|
|
253
233
|
'X_EXERCISE_FILE_UNEDITABLE',
|
|
234
|
+
'X_ERROR_REPORTER_DSN_UNCLAIMED',
|
|
235
|
+
'X_PREBUILT_REGISTRY_STALE',
|
|
236
|
+
'X_APP_ROOT_NESTED',
|
|
237
|
+
'X_WORKSPACE_NAME_TAKEN',
|
|
238
|
+
'X_PARTITIONS_UNMAINTAINED',
|
|
254
239
|
] as const;
|
|
255
240
|
|
|
256
241
|
/**
|
|
@@ -286,6 +271,8 @@ export const CLI_BORROWED_ERROR_CODES = [
|
|
|
286
271
|
/** Every code the CLI can throw: the ones it owns plus the one it borrows. */
|
|
287
272
|
export const CLI_ERROR_CODES = [
|
|
288
273
|
...CLI_OWNED_ERROR_CODES,
|
|
274
|
+
...CLI_BOUNDARY_ERROR_CODES,
|
|
275
|
+
...CLI_PACKAGE_ERROR_CODES,
|
|
289
276
|
...CLI_SHOT_ERROR_CODES,
|
|
290
277
|
...CLI_TOOLING_ERROR_CODES,
|
|
291
278
|
...CLI_BORROWED_ERROR_CODES,
|
|
@@ -293,7 +280,12 @@ export const CLI_ERROR_CODES = [
|
|
|
293
280
|
|
|
294
281
|
/** The codes listed in THIS file — the ones `CLI_ERROR_TITLES` below must title. */
|
|
295
282
|
type CliListedErrorCode = (typeof CLI_OWNED_ERROR_CODES)[number];
|
|
296
|
-
export type CliOwnedErrorCode =
|
|
283
|
+
export type CliOwnedErrorCode =
|
|
284
|
+
| CliListedErrorCode
|
|
285
|
+
| CliBoundaryErrorCode
|
|
286
|
+
| CliPackageErrorCode
|
|
287
|
+
| CliShotErrorCode
|
|
288
|
+
| CliToolingErrorCode;
|
|
297
289
|
export type CliErrorCode = (typeof CLI_ERROR_CODES)[number];
|
|
298
290
|
|
|
299
291
|
/**
|
|
@@ -331,10 +323,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
331
323
|
X_LINT_FAILED: 'Biome failed',
|
|
332
324
|
X_TEST_FAILED: 'a test type failed',
|
|
333
325
|
X_VERIFY_SUITE_VANISHED: 'a step the committed floor requires had nothing left to check',
|
|
334
|
-
X_FILE_TOO_LONG: 'a source file is over 500 lines',
|
|
335
|
-
X_PACKAGE_SHAPE: 'a workspace package is missing a contract file',
|
|
336
|
-
X_PACKAGE_UNREFERENCED: 'a published workspace is not in the root tsconfig build graph',
|
|
337
|
-
X_RELEASE_VERSION_SKEW: 'a workspace is not at the lockstep version',
|
|
338
326
|
X_MANIFEST_STALE: 'openapi.json is stale',
|
|
339
327
|
X_MANIFEST_MISSING: 'the app ships no x.manifest.json',
|
|
340
328
|
X_BUDGET_UNMEASURED: 'a route declares a budget the build never measured',
|
|
@@ -358,11 +346,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
358
346
|
X_DB_BRANCH_FAILED: 'an x db branch step failed',
|
|
359
347
|
X_DB_STUDIO_FAILED: 'x db studio failed',
|
|
360
348
|
X_SEED_ENVIRONMENT: 'the seed tier is not one this environment runs',
|
|
361
|
-
X_BOUNDARY_SITE_TO_APP: 'site/ imported app/',
|
|
362
|
-
X_BOUNDARY_SHARED_LEAF: 'shared/ imported a surface',
|
|
363
|
-
X_BOUNDARY_APP_TO_API: 'app/ imported api/ at runtime',
|
|
364
|
-
X_BOUNDARY_ROUTE_TO_DB: 'a route touched the database',
|
|
365
|
-
X_BOUNDARY_SERVICE_TO_HTTP: 'a service imported HTTP',
|
|
366
349
|
X_GUARD_INVALID: 'a file in guards/ exports no usable guard',
|
|
367
350
|
X_GUARD_FAILED: 'an app guard threw instead of returning findings',
|
|
368
351
|
X_GUARD_FINDING_INVALID: "an app guard's finding breaks the error contract",
|
|
@@ -373,8 +356,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
373
356
|
X_CLI_FLAG_UNREAD: 'a command declares a flag no code reads',
|
|
374
357
|
X_SECRETS_EDITOR_MISSING: 'no $EDITOR to open the decrypted secrets in',
|
|
375
358
|
X_SECRETS_EDIT_FAILED: 'the editor exited non-zero, so nothing was resealed',
|
|
376
|
-
X_WORKSPACE_DEP_UNDECLARED: 'a workspace imports another workspace it does not declare',
|
|
377
|
-
X_PACKAGE_DUPLICATED: 'two copies of one registry-holding framework package are installed',
|
|
378
359
|
X_GH_UNAVAILABLE: 'the GitHub CLI is not runnable from here',
|
|
379
360
|
X_GH_NOT_AUTHENTICATED: 'gh holds no credentials for this host',
|
|
380
361
|
X_GH_COMMAND_FAILED: 'a gh invocation exited non-zero',
|
|
@@ -383,7 +364,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
383
364
|
X_CI_RUN_NOT_FOUND: 'no workflow run for this branch',
|
|
384
365
|
X_APP_NAME_EMPTY: 'the app name has no letters or digits',
|
|
385
366
|
X_APP_EMPTY: 'an app with an app.config.ts registered no primitive',
|
|
386
|
-
X_BOUNDARY_SURFACE_IMPORT: 'a surface imports one SURFACE_SPECS does not allow',
|
|
387
367
|
X_PERMISSION_UNGRANTED: 'an action, query or route requires a permission no role grants',
|
|
388
368
|
X_JOB_UNREGISTERED: 'a job reached the manifest under its positional anonymous name',
|
|
389
369
|
X_FEATURE_UNKNOWN: 'x g --feature names a slice that does not exist',
|
|
@@ -424,7 +404,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
424
404
|
X_ERROR_CODE_UNTHROWN_STALE:
|
|
425
405
|
'a code UNTHROWN_CODES lists as thrown by nothing is thrown again — delete it from UNTHROWN_CODES in packages/cli/src/unthrown-codes.ts',
|
|
426
406
|
X_DEV_STATE_UNWRITABLE: 'x dev cannot claim its state directory',
|
|
427
|
-
X_PACKAGE_TEST_ONLY_SHIPPED: 'a test-only module ships in the tarball',
|
|
428
407
|
X_ISLAND_MODULE_DUPLICATED: 'An island chunk bundles one module more than once',
|
|
429
408
|
X_BACKFILL_SLICE_ENTITY: 'the slice holds no entity a generated backfill can sweep',
|
|
430
409
|
X_LAYOUT_SIBLING_MODULE: 'a primitive module beside its directory',
|
|
@@ -446,7 +425,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
446
425
|
X_DEPLOY_BUILD_MISMATCH: 'production never served this build',
|
|
447
426
|
X_JOB_OUTLASTS_DRAIN: "a job's declared timeout outlasts the worker's budget",
|
|
448
427
|
X_FEATURE_REQUIRED: 'x g query or x g backfill named no slice to read',
|
|
449
|
-
X_BOUNDARY_PACKAGE_TO_APP: 'packages/ imported apps/ at runtime',
|
|
450
428
|
X_APP_IMPORT_UNRESOLVED: 'an app module imports what does not resolve',
|
|
451
429
|
X_STREAM_ALREADY_FLUSHED: 'a response header was written after the stream flushed',
|
|
452
430
|
X_QUERY_SLICE_ENTITY: 'x g query into a slice whose entity is not the one it scaffolds',
|
|
@@ -472,6 +450,14 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
|
|
|
472
450
|
X_ISLAND_DISPOSER_MISSING: "an island's mount returns no disposer",
|
|
473
451
|
X_SOCKET_HAND_ROLLED: 'an app upgrades a websocket itself',
|
|
474
452
|
X_EXERCISE_FILE_UNEDITABLE: 'x g could not add an entry to apps/web/exercise.ts',
|
|
453
|
+
X_ERROR_REPORTER_DSN_UNCLAIMED:
|
|
454
|
+
'SENTRY_DSN is set, and the app installed a reporter marked neither as its Sentry transport nor as a local sink',
|
|
455
|
+
X_PREBUILT_REGISTRY_STALE:
|
|
456
|
+
"the image's prebuilt module registry does not list the app's modules, so the role scanned instead",
|
|
457
|
+
X_APP_ROOT_NESTED: 'a second app.config.ts inside the app',
|
|
458
|
+
X_WORKSPACE_NAME_TAKEN:
|
|
459
|
+
'x g app or x g package was given a name the other workspace kind already holds',
|
|
460
|
+
X_PARTITIONS_UNMAINTAINED: 'a partitioned entity with no partitions() job',
|
|
475
461
|
};
|
|
476
462
|
|
|
477
463
|
// One unconditional call, so a second package claiming one of the CLI's codes throws
|
|
@@ -480,6 +466,8 @@ registerErrorCodes(
|
|
|
480
466
|
Object.fromEntries(
|
|
481
467
|
Object.entries({
|
|
482
468
|
...CLI_ERROR_TITLES,
|
|
469
|
+
...CLI_BOUNDARY_ERROR_TITLES,
|
|
470
|
+
...CLI_PACKAGE_ERROR_TITLES,
|
|
483
471
|
...CLI_SHOT_ERROR_TITLES,
|
|
484
472
|
...CLI_TOOLING_ERROR_TITLES,
|
|
485
473
|
}).map(([code, title]) => [code, { title }]),
|