@testsprite/testsprite-cli 0.12.0 → 0.14.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/README.md +59 -49
- package/dist/commands/agent.js +16 -13
- package/dist/commands/auth.d.ts +19 -0
- package/dist/commands/auth.js +60 -24
- package/dist/commands/ci.d.ts +86 -1
- package/dist/commands/ci.js +436 -5
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +34 -20
- package/dist/commands/init.js +14 -11
- package/dist/commands/project-env.d.ts +11 -1
- package/dist/commands/project-env.js +408 -70
- package/dist/commands/project-sign-in.d.ts +60 -0
- package/dist/commands/project-sign-in.js +289 -0
- package/dist/commands/project.d.ts +14 -5
- package/dist/commands/project.js +110 -70
- package/dist/commands/schedule.d.ts +14 -0
- package/dist/commands/schedule.js +193 -15
- package/dist/commands/test.d.ts +123 -44
- package/dist/commands/test.js +2993 -636
- package/dist/commands/testlist.d.ts +10 -5
- package/dist/commands/testlist.js +217 -47
- package/dist/commands/tunnel.d.ts +26 -3
- package/dist/commands/tunnel.js +221 -18
- package/dist/commands/usage.d.ts +3 -0
- package/dist/commands/usage.js +12 -5
- package/dist/index.js +39 -50
- package/dist/lib/agent-targets.d.ts +3 -3
- package/dist/lib/agent-targets.js +2 -2
- package/dist/lib/billing-refusal.d.ts +43 -0
- package/dist/lib/billing-refusal.js +171 -0
- package/dist/lib/bundle.d.ts +5 -0
- package/dist/lib/bundle.js +43 -13
- package/dist/lib/ci-linkage.d.ts +90 -0
- package/dist/lib/ci-linkage.js +181 -0
- package/dist/lib/client-factory.d.ts +16 -2
- package/dist/lib/client-factory.js +37 -6
- package/dist/lib/config.d.ts +17 -0
- package/dist/lib/config.js +20 -1
- package/dist/lib/conflict-reason.d.ts +27 -3
- package/dist/lib/conflict-reason.js +53 -4
- package/dist/lib/credentials.js +56 -14
- package/dist/lib/dry-run/samples.d.ts +13 -1
- package/dist/lib/dry-run/samples.js +104 -7
- package/dist/lib/environment-tunnel.d.ts +109 -0
- package/dist/lib/environment-tunnel.js +465 -0
- package/dist/lib/errors.d.ts +18 -11
- package/dist/lib/errors.js +123 -14
- package/dist/lib/failing-fe-resolver.d.ts +1 -1
- package/dist/lib/failing-fe-resolver.js +3 -3
- package/dist/lib/gh-output.d.ts +1 -0
- package/dist/lib/gh-output.js +16 -4
- package/dist/lib/history-retention.d.ts +8 -0
- package/dist/lib/history-retention.js +24 -0
- package/dist/lib/http.d.ts +39 -19
- package/dist/lib/http.js +46 -24
- package/dist/lib/interrupt.d.ts +21 -13
- package/dist/lib/interrupt.js +32 -21
- package/dist/lib/junit-report.d.ts +18 -4
- package/dist/lib/junit-report.js +23 -5
- package/dist/lib/local-target.d.ts +14 -4
- package/dist/lib/local-target.js +48 -13
- package/dist/lib/output.js +15 -1
- package/dist/lib/plan-poll.d.ts +11 -11
- package/dist/lib/plan-poll.js +15 -16
- package/dist/lib/plans.types.d.ts +9 -9
- package/dist/lib/plans.types.js +3 -3
- package/dist/lib/poll.d.ts +2 -2
- package/dist/lib/poll.js +9 -3
- package/dist/lib/redact.d.ts +38 -0
- package/dist/lib/redact.js +140 -0
- package/dist/lib/render-error.d.ts +21 -5
- package/dist/lib/render-error.js +44 -0
- package/dist/lib/response-schemas.d.ts +54 -12
- package/dist/lib/response-schemas.js +88 -7
- package/dist/lib/runs.types.d.ts +68 -11
- package/dist/lib/secret-file.js +72 -14
- package/dist/lib/skill-nudge.d.ts +6 -1
- package/dist/lib/skill-nudge.js +32 -5
- package/dist/lib/target-url-preflight.d.ts +6 -4
- package/dist/lib/target-url-preflight.js +64 -51
- package/dist/lib/target-url.js +11 -11
- package/dist/lib/telemetry.d.ts +10 -8
- package/dist/lib/telemetry.js +24 -17
- package/dist/lib/testlist.types.d.ts +1 -0
- package/dist/lib/ticker.d.ts +9 -0
- package/dist/lib/ticker.js +111 -4
- package/dist/lib/tunnel-session.d.ts +16 -4
- package/dist/lib/tunnel-session.js +7 -5
- package/dist/lib/tunnel.types.d.ts +12 -2
- package/dist/lib/tunnel.types.js +2 -2
- package/dist/lib/v3-advisory.js +0 -1
- package/dist/lib/wait-exit.d.ts +8 -0
- package/dist/lib/wait-exit.js +76 -4
- package/dist/lib/workspace-status.d.ts +23 -0
- package/dist/lib/workspace-status.js +15 -0
- package/dist/vendor/tunnel-client/client.d.ts +15 -8
- package/dist/vendor/tunnel-client/client.js +477 -407
- package/dist/vendor/tunnel-client/config.d.ts +5 -5
- package/dist/vendor/tunnel-client/config.js +5 -5
- package/dist/vendor/tunnel-client/index.d.ts +4 -4
- package/dist/vendor/tunnel-client/index.js +4 -4
- package/dist/vendor/tunnel-client/types.d.ts +19 -34
- package/dist/vendor/tunnel-client/types.js +1 -0
- package/dist/vendor/tunnel-client/ws-compat.d.ts +13 -3
- package/dist/vendor/tunnel-client/ws-compat.js +70 -12
- package/dist/version-guard.d.ts +7 -1
- package/dist/version-guard.js +19 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/skills/testsprite-onboard.skill.md +8 -8
- package/skills/testsprite-verify.codex.md +59 -57
- package/skills/testsprite-verify.skill.md +53 -38
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { FetchImpl, HttpClientOptions } from './http.js';
|
|
1
|
+
import type { DebugEvent, FetchImpl, HttpClientOptions } from './http.js';
|
|
2
2
|
import { HttpClient } from './http.js';
|
|
3
|
+
import { type ShutdownHandle } from './interrupt.js';
|
|
3
4
|
import type { OutputMode } from './output.js';
|
|
4
5
|
export interface CommonOptions {
|
|
5
6
|
profile: string;
|
|
@@ -42,11 +43,13 @@ export interface ClientFactoryDeps {
|
|
|
42
43
|
fetchImpl?: FetchImpl;
|
|
43
44
|
stderr?: (line: string) => void;
|
|
44
45
|
/**
|
|
45
|
-
* Shutdown signal composed into every outgoing fetch
|
|
46
|
+
* Shutdown signal composed into every outgoing fetch.
|
|
46
47
|
* Defaults to `globalShutdown.signal` so an armed SIGINT/SIGTERM aborts an
|
|
47
48
|
* in-flight request; tests inject their own controller's signal.
|
|
48
49
|
*/
|
|
49
50
|
shutdownSignal?: AbortSignal;
|
|
51
|
+
/** Defaults to `globalShutdown` so disarmed signals can see in-flight requests. */
|
|
52
|
+
shutdown?: Pick<ShutdownHandle, 'runCriticalOperation'>;
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
52
55
|
* Accepted TestSprite API-key prefixes, in the order they are reported to the
|
|
@@ -145,3 +148,14 @@ export declare function makeHttpClient(opts: CommonOptions, deps?: ClientFactory
|
|
|
145
148
|
export type HttpClientFactory = (overrides?: Pick<HttpClientOptions, 'requestTimeoutMs' | 'shutdownSignal'>) => HttpClient;
|
|
146
149
|
/** Resolve the profile once so related requests share an identity and endpoint. */
|
|
147
150
|
export declare function createHttpClientFactory(opts: CommonOptions, deps?: ClientFactoryDeps): HttpClientFactory;
|
|
151
|
+
/**
|
|
152
|
+
* `DebugEvent` today carries only method/url/attempt/status/errorCode/
|
|
153
|
+
* durationMs/requestId/delayMs — no headers or body — so there is nothing to
|
|
154
|
+
* redact in the current shape. This still routes through `redactDeep` so a
|
|
155
|
+
* future field (request/response headers or body added to `DebugEvent` for
|
|
156
|
+
* richer `--debug` tracing) is protected from day one rather than needing a
|
|
157
|
+
* second fix when that lands. Exported for direct unit coverage of that
|
|
158
|
+
* forward-compatibility contract.
|
|
159
|
+
*/
|
|
160
|
+
export declare function formatDebug(event: DebugEvent): string;
|
|
161
|
+
export declare function formatDryRunDebug(event: DebugEvent): string;
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
* with the command.
|
|
15
15
|
*/
|
|
16
16
|
import { loadConfig } from './config.js';
|
|
17
|
-
import { defaultCredentialsPath } from './credentials.js';
|
|
17
|
+
import { DEFAULT_PROFILE, defaultCredentialsPath } from './credentials.js';
|
|
18
18
|
import { ApiError, localValidationError } from './errors.js';
|
|
19
19
|
import { facadeBaseUrl } from './facade.js';
|
|
20
20
|
import { HttpClient, REQUEST_TIMEOUT_DEFAULT_MS, REQUEST_TIMEOUT_MAX_MS, REQUEST_TIMEOUT_MIN_MS, } from './http.js';
|
|
21
21
|
import { globalShutdown } from './interrupt.js';
|
|
22
22
|
import { createDryRunFetch } from './dry-run/fetch.js';
|
|
23
|
+
import { redactDeep } from './redact.js';
|
|
23
24
|
import { noteServerVersion } from './version-notice.js';
|
|
24
25
|
import { VERSION } from '../version.js';
|
|
25
26
|
/**
|
|
@@ -190,6 +191,25 @@ export function parseRequestTimeoutFlag(raw) {
|
|
|
190
191
|
}
|
|
191
192
|
return Math.round(n * 1000); // seconds → milliseconds
|
|
192
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* The profile name to echo in a missing-key error, or `undefined` to keep the
|
|
196
|
+
* generic wording.
|
|
197
|
+
*
|
|
198
|
+
* Two cases are deliberately not named. The default profile is the plain
|
|
199
|
+
* "not set up yet" case, where naming it adds nothing. And a name shaped like
|
|
200
|
+
* a TestSprite API key is withheld: the credentials-file guard only checks
|
|
201
|
+
* that a name is a safe INI section (`/^[A-Za-z0-9._-]+$/`), which every key
|
|
202
|
+
* format also satisfies, so `TESTSPRITE_PROFILE=$SOME_KEY_VAR` would otherwise
|
|
203
|
+
* print the key to stderr and into `details` under `--output json` — straight
|
|
204
|
+
* into a CI log.
|
|
205
|
+
*/
|
|
206
|
+
function nameableProfile(profile) {
|
|
207
|
+
if (profile === DEFAULT_PROFILE)
|
|
208
|
+
return undefined;
|
|
209
|
+
if (API_KEY_PREFIXES.some(prefix => profile.startsWith(prefix)))
|
|
210
|
+
return undefined;
|
|
211
|
+
return profile;
|
|
212
|
+
}
|
|
193
213
|
export function makeHttpClient(opts, deps = {}) {
|
|
194
214
|
return new HttpClient(resolveHttpClientOptions(opts, deps));
|
|
195
215
|
}
|
|
@@ -218,6 +238,7 @@ function resolveHttpClientOptions(opts, deps) {
|
|
|
218
238
|
env,
|
|
219
239
|
requestTimeoutMs,
|
|
220
240
|
shutdownSignal: deps.shutdownSignal ?? globalShutdown.signal,
|
|
241
|
+
shutdown: deps.shutdown ?? globalShutdown,
|
|
221
242
|
};
|
|
222
243
|
}
|
|
223
244
|
const credentialsPath = deps.credentialsPath ?? defaultCredentialsPath();
|
|
@@ -232,7 +253,7 @@ function resolveHttpClientOptions(opts, deps) {
|
|
|
232
253
|
// VALIDATION_ERROR rather than an opaque URL throw or a retried "fetch failed".
|
|
233
254
|
assertValidEndpointUrl(config.apiUrl);
|
|
234
255
|
if (!config.apiKey)
|
|
235
|
-
throw ApiError.authRequired();
|
|
256
|
+
throw ApiError.authRequired(undefined, nameableProfile(config.profile));
|
|
236
257
|
assertValidApiKey(config.apiKey);
|
|
237
258
|
return {
|
|
238
259
|
baseUrl: facadeBaseUrl(config.apiUrl),
|
|
@@ -254,12 +275,22 @@ function resolveHttpClientOptions(opts, deps) {
|
|
|
254
275
|
env,
|
|
255
276
|
requestTimeoutMs,
|
|
256
277
|
shutdownSignal: deps.shutdownSignal ?? globalShutdown.signal,
|
|
278
|
+
shutdown: deps.shutdown ?? globalShutdown,
|
|
257
279
|
};
|
|
258
280
|
}
|
|
259
|
-
|
|
260
|
-
|
|
281
|
+
/**
|
|
282
|
+
* `DebugEvent` today carries only method/url/attempt/status/errorCode/
|
|
283
|
+
* durationMs/requestId/delayMs — no headers or body — so there is nothing to
|
|
284
|
+
* redact in the current shape. This still routes through `redactDeep` so a
|
|
285
|
+
* future field (request/response headers or body added to `DebugEvent` for
|
|
286
|
+
* richer `--debug` tracing) is protected from day one rather than needing a
|
|
287
|
+
* second fix when that lands. Exported for direct unit coverage of that
|
|
288
|
+
* forward-compatibility contract.
|
|
289
|
+
*/
|
|
290
|
+
export function formatDebug(event) {
|
|
291
|
+
return `[debug ${new Date().toISOString()}] ${JSON.stringify(redactDeep(event))}`;
|
|
261
292
|
}
|
|
262
|
-
function formatDryRunDebug(event) {
|
|
263
|
-
return `[debug ${new Date().toISOString()}] ${JSON.stringify({ ...event, mode: 'dry-run' })}`;
|
|
293
|
+
export function formatDryRunDebug(event) {
|
|
294
|
+
return `[debug ${new Date().toISOString()}] ${JSON.stringify(redactDeep({ ...event, mode: 'dry-run' }))}`;
|
|
264
295
|
}
|
|
265
296
|
//# sourceMappingURL=client-factory.js.map
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -12,6 +12,23 @@ export interface LoadConfigOptions {
|
|
|
12
12
|
/** Treat empty / whitespace-only env values as unset for `??` resolution chains. */
|
|
13
13
|
export declare function normalizeEnvVar(value: string | undefined): string | undefined;
|
|
14
14
|
export declare function defaultConfigPath(): string;
|
|
15
|
+
/**
|
|
16
|
+
* The single place the documented profile-resolution order lives:
|
|
17
|
+
*
|
|
18
|
+
* `--profile` flag > `TESTSPRITE_PROFILE` env var > `"default"`
|
|
19
|
+
*
|
|
20
|
+
* Every command needs the resolved name before it can build a client (and
|
|
21
|
+
* `auth` / `setup` need it to read and write the right credentials section), so
|
|
22
|
+
* each one used to inline `flag ?? 'default'`. That collapsed to the literal
|
|
23
|
+
* `'default'` whenever the flag was absent and made the env var unreachable
|
|
24
|
+
* from every entry point — `loadConfig` never got the `undefined` its own `??`
|
|
25
|
+
* chain needs. Resolving here keeps the order in one place and keeps the
|
|
26
|
+
* blank-value normalization ({@link normalizeEnvVar}) that a hand-written
|
|
27
|
+
* `flag ?? env.TESTSPRITE_PROFILE ?? 'default'` would drop: an empty or
|
|
28
|
+
* whitespace-only value must fall back to the default profile, not fail the
|
|
29
|
+
* INI section-name guard on every command.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveProfileName(flagValue: string | undefined, env?: NodeJS.ProcessEnv): string;
|
|
15
32
|
/**
|
|
16
33
|
* Resolves the active profile name and its (apiUrl, apiKey) pair.
|
|
17
34
|
*
|
package/dist/lib/config.js
CHANGED
|
@@ -9,6 +9,25 @@ export function normalizeEnvVar(value) {
|
|
|
9
9
|
export function defaultConfigPath() {
|
|
10
10
|
return join(homedir(), '.testsprite', 'config');
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The single place the documented profile-resolution order lives:
|
|
14
|
+
*
|
|
15
|
+
* `--profile` flag > `TESTSPRITE_PROFILE` env var > `"default"`
|
|
16
|
+
*
|
|
17
|
+
* Every command needs the resolved name before it can build a client (and
|
|
18
|
+
* `auth` / `setup` need it to read and write the right credentials section), so
|
|
19
|
+
* each one used to inline `flag ?? 'default'`. That collapsed to the literal
|
|
20
|
+
* `'default'` whenever the flag was absent and made the env var unreachable
|
|
21
|
+
* from every entry point — `loadConfig` never got the `undefined` its own `??`
|
|
22
|
+
* chain needs. Resolving here keeps the order in one place and keeps the
|
|
23
|
+
* blank-value normalization ({@link normalizeEnvVar}) that a hand-written
|
|
24
|
+
* `flag ?? env.TESTSPRITE_PROFILE ?? 'default'` would drop: an empty or
|
|
25
|
+
* whitespace-only value must fall back to the default profile, not fail the
|
|
26
|
+
* INI section-name guard on every command.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveProfileName(flagValue, env = process.env) {
|
|
29
|
+
return flagValue ?? normalizeEnvVar(env.TESTSPRITE_PROFILE) ?? DEFAULT_PROFILE;
|
|
30
|
+
}
|
|
12
31
|
/**
|
|
13
32
|
* Resolves the active profile name and its (apiUrl, apiKey) pair.
|
|
14
33
|
*
|
|
@@ -22,7 +41,7 @@ export function defaultConfigPath() {
|
|
|
22
41
|
*/
|
|
23
42
|
export function loadConfig(options = {}) {
|
|
24
43
|
const env = options.env ?? process.env;
|
|
25
|
-
const profile = options.profile
|
|
44
|
+
const profile = resolveProfileName(options.profile, env);
|
|
26
45
|
const credentialsPath = options.credentialsPath ?? defaultCredentialsPath();
|
|
27
46
|
const fileEntry = readProfile(profile, { path: credentialsPath });
|
|
28
47
|
// Empty / whitespace-only env vars are treated as unset so they do not
|
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
* Absent ⇒ a legacy / pre-discriminator backend: treated as `in_flight` (the
|
|
8
8
|
* historical rendering) for backward compatibility.
|
|
9
9
|
*
|
|
10
|
-
* `insufficient_credits` / `
|
|
10
|
+
* `insufficient_credits` / `paused` (or `billing_hold`, the deprecated spelling
|
|
11
|
+
* older backends send) are billing refusals the backend folds
|
|
11
12
|
* into `conflicts[]` for a MIXED batch (some cases dispatched, some refused). A
|
|
12
13
|
* batch where nothing dispatched and every refusal was credits comes back as a
|
|
13
14
|
* plain 402 `INSUFFICIENT_CREDITS` envelope instead — the same shape the
|
|
14
15
|
* single-run route answers — so both surfaces exit 12.
|
|
15
16
|
*/
|
|
16
17
|
import { ApiError } from './errors.js';
|
|
17
|
-
export type ConflictReason = 'in_flight' | 'mcp_view_only' | 'local_address' | 'not_found' | 'insufficient_credits' | '
|
|
18
|
+
export type ConflictReason = 'in_flight' | 'mcp_view_only' | 'local_address' | 'not_found' | 'insufficient_credits' | 'paused'
|
|
19
|
+
/** Deprecated spelling of `paused`, still sent by older backends. */
|
|
20
|
+
| 'billing_hold' | 'error';
|
|
18
21
|
/** A conflict entry on a run response. `message` carries actionable detail for
|
|
19
|
-
* `local_address` / `insufficient_credits` / `
|
|
22
|
+
* `local_address` / `insufficient_credits` / `paused` / `error` (the
|
|
20
23
|
* backend's nextAction). */
|
|
21
24
|
export interface RunConflict {
|
|
22
25
|
testId: string;
|
|
@@ -30,6 +33,15 @@ export interface RunConflict {
|
|
|
30
33
|
* bare `{testId, currentRunId?}` conflicts read exactly as they did before.
|
|
31
34
|
*/
|
|
32
35
|
export declare function describeConflict(c: RunConflict): string;
|
|
36
|
+
/**
|
|
37
|
+
* True when the set is non-empty and every entry is the legacy in-flight
|
|
38
|
+
* cause (absent reason ⇒ `in_flight` too). Callers use this to restore the
|
|
39
|
+
* original, pre-reason-aware "N test(s) already in flight" wording for the
|
|
40
|
+
* common pure case, while any OTHER reason present (paused,
|
|
41
|
+
* mcp_view_only, …) still falls through to `summarizeConflicts`'s
|
|
42
|
+
* reason-aware summary instead of a misleading blanket "in flight".
|
|
43
|
+
*/
|
|
44
|
+
export declare function allConflictsInFlight(conflicts: readonly RunConflict[]): boolean;
|
|
33
45
|
/**
|
|
34
46
|
* One-line summary of a conflict set grouped by reason, e.g.
|
|
35
47
|
* `2 already in flight, 1 environment not runnable`. Used where a single line
|
|
@@ -61,6 +73,18 @@ export declare function isAllCreditsRefusal(resp: {
|
|
|
61
73
|
deferred: readonly unknown[];
|
|
62
74
|
conflicts: readonly RunConflict[];
|
|
63
75
|
}): boolean;
|
|
76
|
+
export declare function isPausedRefusal(resp: {
|
|
77
|
+
accepted: readonly unknown[];
|
|
78
|
+
deferred: readonly unknown[];
|
|
79
|
+
conflicts: readonly RunConflict[];
|
|
80
|
+
}): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The exit-13 refusal for a batch refused because the workspace is paused —
|
|
83
|
+
* the same `FEATURE_GATED` envelope the backend answers a single run with. The server's message on the conflicts says why
|
|
84
|
+
* the workspace is paused; the fallback deliberately doesn't guess.
|
|
85
|
+
*/
|
|
86
|
+
export declare function pausedConflictError(conflicts: readonly RunConflict[], apiUrl?: string): ApiError;
|
|
87
|
+
export declare function billingConflictLink(conflicts: readonly RunConflict[], apiUrl?: string): string;
|
|
64
88
|
/**
|
|
65
89
|
* The exit-12 refusal for an all-credits batch — the SAME `INSUFFICIENT_CREDITS`
|
|
66
90
|
* envelope the single-run route answers (code, exit code, billing `nextAction`),
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
* Absent ⇒ a legacy / pre-discriminator backend: treated as `in_flight` (the
|
|
8
8
|
* historical rendering) for backward compatibility.
|
|
9
9
|
*
|
|
10
|
-
* `insufficient_credits` / `
|
|
10
|
+
* `insufficient_credits` / `paused` (or `billing_hold`, the deprecated spelling
|
|
11
|
+
* older backends send) are billing refusals the backend folds
|
|
11
12
|
* into `conflicts[]` for a MIXED batch (some cases dispatched, some refused). A
|
|
12
13
|
* batch where nothing dispatched and every refusal was credits comes back as a
|
|
13
14
|
* plain 402 `INSUFFICIENT_CREDITS` envelope instead — the same shape the
|
|
14
15
|
* single-run route answers — so both surfaces exit 12.
|
|
15
16
|
*/
|
|
16
17
|
import { ApiError, insufficientCreditsNextAction } from './errors.js';
|
|
18
|
+
import { classifyBillingRefusal, isPausedReason } from './billing-refusal.js';
|
|
17
19
|
/**
|
|
18
20
|
* Short human label for a conflict's cause — the reason a case did NOT dispatch.
|
|
19
21
|
* Absent reason renders as the legacy "already in flight" so an old backend's
|
|
@@ -29,8 +31,9 @@ export function describeConflict(c) {
|
|
|
29
31
|
return 'not found in this workspace';
|
|
30
32
|
case 'insufficient_credits':
|
|
31
33
|
return c.message || 'insufficient credits';
|
|
34
|
+
case 'paused':
|
|
32
35
|
case 'billing_hold':
|
|
33
|
-
return c.message || '
|
|
36
|
+
return c.message || 'workspace paused';
|
|
34
37
|
case 'error':
|
|
35
38
|
return c.message || 'dispatch failed';
|
|
36
39
|
case 'in_flight':
|
|
@@ -44,9 +47,21 @@ const CONFLICT_LABELS = {
|
|
|
44
47
|
local_address: 'environment not runnable',
|
|
45
48
|
not_found: 'not found',
|
|
46
49
|
insufficient_credits: 'insufficient credits',
|
|
47
|
-
|
|
50
|
+
paused: 'workspace paused',
|
|
51
|
+
billing_hold: 'workspace paused',
|
|
48
52
|
error: 'dispatch error',
|
|
49
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* True when the set is non-empty and every entry is the legacy in-flight
|
|
56
|
+
* cause (absent reason ⇒ `in_flight` too). Callers use this to restore the
|
|
57
|
+
* original, pre-reason-aware "N test(s) already in flight" wording for the
|
|
58
|
+
* common pure case, while any OTHER reason present (paused,
|
|
59
|
+
* mcp_view_only, …) still falls through to `summarizeConflicts`'s
|
|
60
|
+
* reason-aware summary instead of a misleading blanket "in flight".
|
|
61
|
+
*/
|
|
62
|
+
export function allConflictsInFlight(conflicts) {
|
|
63
|
+
return conflicts.length > 0 && conflicts.every(c => (c.reason ?? 'in_flight') === 'in_flight');
|
|
64
|
+
}
|
|
50
65
|
/** Per-reason occurrence counts, insertion-ordered; absent reason ⇒ `in_flight`. */
|
|
51
66
|
function countByReason(conflicts) {
|
|
52
67
|
const counts = new Map();
|
|
@@ -105,6 +120,40 @@ export function isAllCreditsRefusal(resp) {
|
|
|
105
120
|
resp.deferred.length === 0 &&
|
|
106
121
|
everyConflictIs(resp.conflicts, 'insufficient_credits'));
|
|
107
122
|
}
|
|
123
|
+
export function isPausedRefusal(resp) {
|
|
124
|
+
// Paused takes precedence over credits: topping up cannot resume the workspace.
|
|
125
|
+
return (resp.accepted.length === 0 &&
|
|
126
|
+
resp.deferred.length === 0 &&
|
|
127
|
+
resp.conflicts.some(c => isPausedReason(c.reason)) &&
|
|
128
|
+
resp.conflicts.every(c => isPausedReason(c.reason) || c.reason === 'insufficient_credits'));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The exit-13 refusal for a batch refused because the workspace is paused —
|
|
132
|
+
* the same `FEATURE_GATED` envelope the backend answers a single run with. The server's message on the conflicts says why
|
|
133
|
+
* the workspace is paused; the fallback deliberately doesn't guess.
|
|
134
|
+
*/
|
|
135
|
+
export function pausedConflictError(conflicts, apiUrl) {
|
|
136
|
+
const message = conflicts.find(c => isPausedReason(c.reason) && c.message?.trim())?.message;
|
|
137
|
+
return ApiError.fromEnvelope({
|
|
138
|
+
error: {
|
|
139
|
+
code: 'FEATURE_GATED',
|
|
140
|
+
message: message ?? 'This workspace is paused.',
|
|
141
|
+
nextAction: '',
|
|
142
|
+
requestId: 'local',
|
|
143
|
+
details: { reason: 'paused', conflicts: conflicts.map(c => c.testId) },
|
|
144
|
+
},
|
|
145
|
+
}, 403, undefined, apiUrl);
|
|
146
|
+
}
|
|
147
|
+
export function billingConflictLink(conflicts, apiUrl) {
|
|
148
|
+
const hasPaused = conflicts.some(c => isPausedReason(c.reason));
|
|
149
|
+
const hasCredits = conflicts.some(c => c.reason === 'insufficient_credits');
|
|
150
|
+
if (!hasPaused && !hasCredits)
|
|
151
|
+
return '';
|
|
152
|
+
const refusal = classifyBillingRefusal(hasPaused
|
|
153
|
+
? pausedConflictError(conflicts, apiUrl)
|
|
154
|
+
: insufficientCreditsConflictError(conflicts, apiUrl));
|
|
155
|
+
return refusal ? ` Upgrade: ${refusal.links.pricing}; billing: ${refusal.links.billing}.` : '';
|
|
156
|
+
}
|
|
108
157
|
/**
|
|
109
158
|
* The exit-12 refusal for an all-credits batch — the SAME `INSUFFICIENT_CREDITS`
|
|
110
159
|
* envelope the single-run route answers (code, exit code, billing `nextAction`),
|
|
@@ -126,6 +175,6 @@ export function insufficientCreditsConflictError(conflicts, apiUrl) {
|
|
|
126
175
|
requestId: 'local',
|
|
127
176
|
details: { reason: 'insufficient_credits', conflicts: conflicts.map(c => c.testId) },
|
|
128
177
|
},
|
|
129
|
-
});
|
|
178
|
+
}, 402, undefined, apiUrl);
|
|
130
179
|
}
|
|
131
180
|
//# sourceMappingURL=conflict-reason.js.map
|
package/dist/lib/credentials.js
CHANGED
|
@@ -57,6 +57,11 @@ const FIELD_TO_FILE_KEY = {
|
|
|
57
57
|
};
|
|
58
58
|
const CREDENTIALS_LOCK_RETRY_MS = 25;
|
|
59
59
|
const CREDENTIALS_LOCK_WAIT_MS = 5_000;
|
|
60
|
+
// On Windows a lock file that another process is closing or deleting (or that
|
|
61
|
+
// a scanner briefly holds) reports EPERM/EBUSY/EACCES instead of EEXIST. That
|
|
62
|
+
// clears within milliseconds; one that persists this long is a real permission
|
|
63
|
+
// problem and is surfaced as such.
|
|
64
|
+
const CREDENTIALS_LOCK_TRANSIENT_WAIT_MS = 1_000;
|
|
60
65
|
const CREDENTIALS_LOCK_STALE_MS = 30_000;
|
|
61
66
|
export function parseCredentials(content) {
|
|
62
67
|
const result = {};
|
|
@@ -263,6 +268,7 @@ function acquireCredentialsLock(path) {
|
|
|
263
268
|
createdAt: Date.now(),
|
|
264
269
|
token,
|
|
265
270
|
};
|
|
271
|
+
let transientSince;
|
|
266
272
|
while (true) {
|
|
267
273
|
try {
|
|
268
274
|
writeFileSync(lockPath, `${JSON.stringify(lockInfo)}\n`, {
|
|
@@ -276,10 +282,30 @@ function acquireCredentialsLock(path) {
|
|
|
276
282
|
};
|
|
277
283
|
}
|
|
278
284
|
catch (error) {
|
|
279
|
-
|
|
285
|
+
let transient = undefined;
|
|
286
|
+
if (isErrnoException(error) && error.code === 'EEXIST') {
|
|
287
|
+
transient = reclaimStaleCredentialsLock(lockPath);
|
|
288
|
+
}
|
|
289
|
+
else if (isWindowsLockContention(error)) {
|
|
290
|
+
transient = error;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
280
293
|
rethrowCredentialsWriteError(error);
|
|
281
294
|
}
|
|
282
|
-
|
|
295
|
+
if (transient === undefined) {
|
|
296
|
+
transientSince = undefined;
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
transientSince ??= Date.now();
|
|
300
|
+
if (Date.now() - transientSince >= CREDENTIALS_LOCK_TRANSIENT_WAIT_MS ||
|
|
301
|
+
Date.now() >= deadline) {
|
|
302
|
+
// Persistent, so not contention: fail exactly as the non-Windows
|
|
303
|
+
// path does for the same error.
|
|
304
|
+
if (transient === error)
|
|
305
|
+
rethrowCredentialsWriteError(error);
|
|
306
|
+
throw transient;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
283
309
|
if (Date.now() >= deadline) {
|
|
284
310
|
throw localValidationError('credentialsLock', 'timed out waiting for another credential update to finish; retry the command', undefined, 'field');
|
|
285
311
|
}
|
|
@@ -315,6 +341,10 @@ function acquireCredentialsLock(path) {
|
|
|
315
341
|
* succeeding on the next `wx` attempt, so there is no need for this function
|
|
316
342
|
* to draw that conclusion itself.
|
|
317
343
|
*/
|
|
344
|
+
/**
|
|
345
|
+
* Returns a Windows lock-contention error from the removal attempt so the
|
|
346
|
+
* caller can retry it within the transient budget; any other failure throws.
|
|
347
|
+
*/
|
|
318
348
|
function reclaimStaleCredentialsLock(lockPath) {
|
|
319
349
|
let lockInfo;
|
|
320
350
|
try {
|
|
@@ -346,10 +376,13 @@ function reclaimStaleCredentialsLock(lockPath) {
|
|
|
346
376
|
unlinkSync(lockPath);
|
|
347
377
|
}
|
|
348
378
|
catch (error) {
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
|
|
379
|
+
if (isErrnoException(error) && error.code === 'ENOENT')
|
|
380
|
+
return undefined;
|
|
381
|
+
if (isWindowsLockContention(error))
|
|
382
|
+
return error;
|
|
383
|
+
throw error;
|
|
352
384
|
}
|
|
385
|
+
return undefined;
|
|
353
386
|
}
|
|
354
387
|
function assertCredentialsLockHeld(lockPath, token) {
|
|
355
388
|
const lockInfo = readCredentialsLockInfo(lockPath);
|
|
@@ -358,18 +391,27 @@ function assertCredentialsLockHeld(lockPath, token) {
|
|
|
358
391
|
throw localValidationError('credentialsLock', 'lost ownership of the credential update lock; retry the command', undefined, 'field');
|
|
359
392
|
}
|
|
360
393
|
function releaseCredentialsLock(lockPath, token) {
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
394
|
+
const deadline = Date.now() + CREDENTIALS_LOCK_TRANSIENT_WAIT_MS;
|
|
395
|
+
while (readCredentialsLockInfo(lockPath)?.token === token) {
|
|
396
|
+
try {
|
|
397
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- `lockPath` is `${path}.lock`, derived from the internal credentials-file path; same risk profile as the other lock fs calls in this file.
|
|
398
|
+
unlinkSync(lockPath);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
catch (error) {
|
|
402
|
+
if (isErrnoException(error) && error.code === 'ENOENT')
|
|
403
|
+
return;
|
|
404
|
+
if (!isWindowsLockContention(error) || Date.now() >= deadline)
|
|
405
|
+
throw error;
|
|
406
|
+
sleepSync(CREDENTIALS_LOCK_RETRY_MS);
|
|
370
407
|
}
|
|
371
408
|
}
|
|
372
409
|
}
|
|
410
|
+
function isWindowsLockContention(error) {
|
|
411
|
+
return (process.platform === 'win32' &&
|
|
412
|
+
isErrnoException(error) &&
|
|
413
|
+
(error.code === 'EPERM' || error.code === 'EBUSY' || error.code === 'EACCES'));
|
|
414
|
+
}
|
|
373
415
|
function readCredentialsLockInfo(lockPath) {
|
|
374
416
|
try {
|
|
375
417
|
return JSON.parse(readFileSync(lockPath, 'utf-8'));
|
|
@@ -37,6 +37,15 @@ export interface DryRunSampleEntry {
|
|
|
37
37
|
*/
|
|
38
38
|
body: (requestBody?: unknown) => unknown;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Build the matcher RegExp for a route template, e.g.
|
|
42
|
+
* `/tests/{testId}/code` → /^\/tests\/[^/]+\/code$/. Splits on the
|
|
43
|
+
* `{param}` placeholders first, then regex-escapes every literal segment in
|
|
44
|
+
* between (including any literal backslash) so a route literal containing a
|
|
45
|
+
* regex metacharacter is matched literally instead of being reinterpreted as
|
|
46
|
+
* part of the pattern.
|
|
47
|
+
*/
|
|
48
|
+
declare function buildPathPattern(pathTemplate: string): RegExp;
|
|
40
49
|
/**
|
|
41
50
|
* Resolve a fetch URL to its canned sample. Matches against the path
|
|
42
51
|
* portion only (query string is ignored — auto-pagination's `cursor`
|
|
@@ -55,10 +64,13 @@ export interface DryRunSampleEntry {
|
|
|
55
64
|
* `undefined`. For dry-run paths that resolve samples DIRECTLY (bypassing the
|
|
56
65
|
* dry-run fetch impl, which has its own loud INTERNAL envelope for this):
|
|
57
66
|
* without the throw, a lost registry entry surfaces as a raw TypeError deep
|
|
58
|
-
* in a renderer (
|
|
67
|
+
* in a renderer (`samples.ts` is a real merge-conflict
|
|
59
68
|
* hotspot, so a silently dropped entry is a live hazard, not a hypothetical).
|
|
60
69
|
*/
|
|
61
70
|
export declare function findSampleOrThrow(method: string, url: string, requestBody?: unknown): DryRunSampleEntry;
|
|
62
71
|
export declare function findSample(method: string, url: string, requestBody?: unknown): DryRunSampleEntry | undefined;
|
|
63
72
|
/** Test-only export so `samples.test.ts` can iterate the catalog. */
|
|
64
73
|
export declare const DRY_RUN_SAMPLE_ENTRIES: ReadonlyArray<DryRunSampleEntry>;
|
|
74
|
+
/** Test-only export so `samples.test.ts` can verify the route-template matcher directly. */
|
|
75
|
+
export declare const buildDryRunPathPattern: typeof buildPathPattern;
|
|
76
|
+
export {};
|
|
@@ -10,6 +10,8 @@ const SAMPLE_TEST_ID_BLOCKED = 'test_blocked_4f7a';
|
|
|
10
10
|
export const SAMPLE_RUN_ID = 'run_abc';
|
|
11
11
|
const SAMPLE_SCHEDULE_ID = 'sch_7d21ac48';
|
|
12
12
|
const SAMPLE_SCHEDULE_RUN_ID = 'exec_5c08f1b2';
|
|
13
|
+
const SAMPLE_TUNNEL_ID_1 = '00000000-0000-4000-8000-000000000001';
|
|
14
|
+
const SAMPLE_TUNNEL_ID_2 = '00000000-0000-4000-8000-000000000002';
|
|
13
15
|
// Documented sentinel for `test steps --run-id run_failed_sample --dry-run`:
|
|
14
16
|
// keeps wait flows on the default passed sample while still demonstrating a
|
|
15
17
|
// run-scoped failed step offline.
|
|
@@ -440,10 +442,84 @@ const failedRunSample = {
|
|
|
440
442
|
],
|
|
441
443
|
};
|
|
442
444
|
const PATH_PREFIX = '/api/cli/v1';
|
|
445
|
+
// Regex metacharacters that must be escaped when a literal string is spliced
|
|
446
|
+
// into a `new RegExp(...)` source string, so the literal matches only itself.
|
|
447
|
+
const REGEXP_METACHAR = /[.*+?^${}()|[\]\\]/g;
|
|
448
|
+
function escapeRegExpLiteral(literal) {
|
|
449
|
+
return literal.replace(REGEXP_METACHAR, '\\$&');
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Build the matcher RegExp for a route template, e.g.
|
|
453
|
+
* `/tests/{testId}/code` → /^\/tests\/[^/]+\/code$/. Splits on the
|
|
454
|
+
* `{param}` placeholders first, then regex-escapes every literal segment in
|
|
455
|
+
* between (including any literal backslash) so a route literal containing a
|
|
456
|
+
* regex metacharacter is matched literally instead of being reinterpreted as
|
|
457
|
+
* part of the pattern.
|
|
458
|
+
*/
|
|
459
|
+
function buildPathPattern(pathTemplate) {
|
|
460
|
+
const regexSrc = pathTemplate
|
|
461
|
+
.split(/(\{[^}]+\})/g)
|
|
462
|
+
.map(part => (/^\{[^}]+\}$/.test(part) ? '[^/]+' : escapeRegExpLiteral(part)))
|
|
463
|
+
.join('');
|
|
464
|
+
return new RegExp(`^${regexSrc}$`);
|
|
465
|
+
}
|
|
443
466
|
const ENTRIES = [
|
|
444
467
|
entry('whoami', 'GET', '/me', me),
|
|
445
468
|
entry('listProjects', 'GET', '/projects', pageOf(projects)),
|
|
446
|
-
|
|
469
|
+
entry('getProjectSignIn', 'GET', '/projects/{projectId}/sign-in', {
|
|
470
|
+
projectId: SAMPLE_PROJECT_ID,
|
|
471
|
+
environment: {
|
|
472
|
+
id: 'env_dryrun',
|
|
473
|
+
name: 'default',
|
|
474
|
+
url: 'https://app.example.com',
|
|
475
|
+
isDefault: true,
|
|
476
|
+
authMode: 'public',
|
|
477
|
+
hasCredentials: false,
|
|
478
|
+
username: null,
|
|
479
|
+
enableOtp: false,
|
|
480
|
+
updatedAt: '2026-09-25T00:00:00.000Z',
|
|
481
|
+
},
|
|
482
|
+
signIn: { mode: 'public', account: null, otp: null, manual: null },
|
|
483
|
+
nextAction: null,
|
|
484
|
+
}),
|
|
485
|
+
entry('setProjectSignIn', 'PUT', '/projects/{projectId}/sign-in', (request) => {
|
|
486
|
+
const body = request;
|
|
487
|
+
const mode = body?.mode ?? 'manual';
|
|
488
|
+
return {
|
|
489
|
+
projectId: SAMPLE_PROJECT_ID,
|
|
490
|
+
environment: {
|
|
491
|
+
id: 'env_dryrun',
|
|
492
|
+
name: 'default',
|
|
493
|
+
url: 'https://app.example.com',
|
|
494
|
+
isDefault: true,
|
|
495
|
+
authMode: mode,
|
|
496
|
+
hasCredentials: mode === 'account',
|
|
497
|
+
username: mode === 'account' ? 'qa@example.com' : null,
|
|
498
|
+
enableOtp: mode === 'otp',
|
|
499
|
+
updatedAt: '2026-09-25T00:00:00.000Z',
|
|
500
|
+
},
|
|
501
|
+
signIn: {
|
|
502
|
+
mode,
|
|
503
|
+
account: mode === 'account' ? { username: 'qa@example.com', passwordSet: true } : null,
|
|
504
|
+
otp: mode === 'otp'
|
|
505
|
+
? { channels: ['email'], email: 'dryrun@inbox.example', phone: null }
|
|
506
|
+
: null,
|
|
507
|
+
manual: mode === 'manual'
|
|
508
|
+
? {
|
|
509
|
+
sessionReuseTtlSeconds: 3600,
|
|
510
|
+
hasValidSession: false,
|
|
511
|
+
needsReauth: true,
|
|
512
|
+
reason: 'never',
|
|
513
|
+
capturedAt: null,
|
|
514
|
+
expiresAt: null,
|
|
515
|
+
}
|
|
516
|
+
: null,
|
|
517
|
+
},
|
|
518
|
+
changed: mode !== 'otp',
|
|
519
|
+
nextAction: mode === 'manual' ? 'Log in once in the Portal.' : null,
|
|
520
|
+
};
|
|
521
|
+
}),
|
|
522
|
+
// Plan-generation surface. All three MUST be registered
|
|
447
523
|
// BEFORE `getProject`: findSample is first-match-wins and the projects/*
|
|
448
524
|
// family shares the `/projects/…` prefix, so the more specific plans
|
|
449
525
|
// paths are listed first (same defensive convention as `/tests/{id}/runs`
|
|
@@ -516,7 +592,7 @@ const ENTRIES = [
|
|
|
516
592
|
caseKeys: ids.map(id => `case_dryrun_${id}`),
|
|
517
593
|
};
|
|
518
594
|
}),
|
|
519
|
-
//
|
|
595
|
+
// `project docs upload` two-step facade routes.
|
|
520
596
|
// Registered BEFORE the broader project patterns (design doc §7 ordering
|
|
521
597
|
// rule; findSample is first-match-wins) and with `/docs/upload-url` before
|
|
522
598
|
// `/docs`. NOT consumed by the command's dry-run path: `project docs
|
|
@@ -868,7 +944,7 @@ const ENTRIES = [
|
|
|
868
944
|
// returning status: "failed" for `test wait --dry-run`.
|
|
869
945
|
entry('getRun', 'GET', `/runs/${SAMPLE_FAILED_RUN_ID}`, failedRunSample),
|
|
870
946
|
entry('getRun', 'GET', '/runs/{runId}', passedRunSample),
|
|
871
|
-
//
|
|
947
|
+
// POST /runs/{runId}/cancel. Method-guarded in
|
|
872
948
|
// `findSample` (POST vs `getRun`'s GET), so this can't be shadowed by the
|
|
873
949
|
// broader `/runs/{runId}` pattern above despite sharing its path prefix.
|
|
874
950
|
// `alreadyCancelled: false` — a fresh cancel is the more instructive shape
|
|
@@ -927,16 +1003,35 @@ const ENTRIES = [
|
|
|
927
1003
|
entry('deleteSchedule', 'DELETE', '/schedules/{scheduleId}', {
|
|
928
1004
|
scheduleId: SAMPLE_SCHEDULE_ID,
|
|
929
1005
|
}),
|
|
1006
|
+
entry('listTunnels', 'GET', '/tunnel', {
|
|
1007
|
+
tunnels: [
|
|
1008
|
+
{
|
|
1009
|
+
clientId: SAMPLE_TUNNEL_ID_1,
|
|
1010
|
+
status: 'online',
|
|
1011
|
+
createdAt: '2026-01-01T00:00:00.000Z',
|
|
1012
|
+
expiresAt: '2026-01-01T01:00:00.000Z',
|
|
1013
|
+
},
|
|
1014
|
+
{
|
|
1015
|
+
clientId: SAMPLE_TUNNEL_ID_2,
|
|
1016
|
+
status: 'offline',
|
|
1017
|
+
createdAt: null,
|
|
1018
|
+
expiresAt: '2026-01-01T02:00:00.000Z',
|
|
1019
|
+
},
|
|
1020
|
+
],
|
|
1021
|
+
}),
|
|
1022
|
+
entry('getTunnelStatus', 'GET', '/tunnel/{clientId}', {
|
|
1023
|
+
clientId: SAMPLE_TUNNEL_ID_1,
|
|
1024
|
+
status: 'online',
|
|
1025
|
+
expiresAt: '2026-01-01T01:00:00.000Z',
|
|
1026
|
+
}),
|
|
930
1027
|
];
|
|
931
1028
|
function entry(operationId, method, pathTemplate, body) {
|
|
932
|
-
// Convert `/tests/{testId}/code` → /^\/tests\/[^/]+\/code$/
|
|
933
|
-
const regexSrc = pathTemplate.replace(/\{[^}]+\}/g, '[^/]+').replace(/\//g, '\\/');
|
|
934
1029
|
const bodyFn = typeof body === 'function' ? body : () => body;
|
|
935
1030
|
return {
|
|
936
1031
|
operationId,
|
|
937
1032
|
method,
|
|
938
1033
|
pathTemplate,
|
|
939
|
-
pattern:
|
|
1034
|
+
pattern: buildPathPattern(pathTemplate),
|
|
940
1035
|
body: bodyFn,
|
|
941
1036
|
};
|
|
942
1037
|
}
|
|
@@ -965,7 +1060,7 @@ function pageOf(items) {
|
|
|
965
1060
|
* `undefined`. For dry-run paths that resolve samples DIRECTLY (bypassing the
|
|
966
1061
|
* dry-run fetch impl, which has its own loud INTERNAL envelope for this):
|
|
967
1062
|
* without the throw, a lost registry entry surfaces as a raw TypeError deep
|
|
968
|
-
* in a renderer (
|
|
1063
|
+
* in a renderer (`samples.ts` is a real merge-conflict
|
|
969
1064
|
* hotspot, so a silently dropped entry is a live hazard, not a hypothetical).
|
|
970
1065
|
*/
|
|
971
1066
|
export function findSampleOrThrow(method, url, requestBody) {
|
|
@@ -1013,4 +1108,6 @@ function extractPath(url) {
|
|
|
1013
1108
|
}
|
|
1014
1109
|
/** Test-only export so `samples.test.ts` can iterate the catalog. */
|
|
1015
1110
|
export const DRY_RUN_SAMPLE_ENTRIES = ENTRIES;
|
|
1111
|
+
/** Test-only export so `samples.test.ts` can verify the route-template matcher directly. */
|
|
1112
|
+
export const buildDryRunPathPattern = buildPathPattern;
|
|
1016
1113
|
//# sourceMappingURL=samples.js.map
|