@mcpjam/cli 4.2.0 → 5.0.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/dist/index.js +436 -85
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command, CommanderError, Option } from 'commander';
|
|
3
3
|
import { realpathSync, readFileSync, existsSync, mkdirSync, writeFileSync, unlinkSync, statSync, closeSync, renameSync, openSync } from 'fs';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
|
-
import { probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, OPENAI_SUBMISSION_MODES, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunHtml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, openUrlInBrowser, buildEvalRunReport,
|
|
5
|
+
import { probeMcpServer, redactForTelemetry, runServerDoctor, collectServerSnapshot, serializeStableServerSnapshot, serializeServerSnapshot, buildServerDiffReport, classifyMcpHeader, validateToolCallResult, isCallToolResultError, buildToolCallValidationReport, listResources, readResource, SubscriptionCoordinator, listTools, listPrompts, getPrompt, MCPAppsConformanceTest, scoreFromAppsResult, MCPAppsConformanceSuite, MCPTasksConformanceTest, scoreFromTasksResult, runOAuthLogin, OAuthConformanceTest, scoreFromOAuthResult, OAuthConformanceSuite, runXaaFlow, MCPConformanceTest, scoreFromProtocolResult, MCPConformanceSuite, runConformance, isConformanceReportingConfigured, reportConformanceRun, reportConformanceRunSafely, OPENAI_SUBMISSION_MODES, withEphemeralClient, diffServerSnapshots, ServerSnapshotFormatError, renderStructuredRunJUnitXml, renderStructuredRunHtml, renderStructuredRunJson, DEFAULT_SUBSCRIPTION_RECONNECT_POLICY, isKnownProtocolVersion, describeConformanceScore, toConformanceReport, buildConformanceRunReport, renderConformanceReportJUnitXml, renderConformanceReportJson, formatOAuthConformanceHuman, formatOAuthConformanceSuiteHuman, fetchOAuthMetadata, executeOAuthProxy, executeDebugOAuthProxy, normalizeRegistrationStrategy, normalizeXaaClientAuth, normalizeIdentityAssertionFormat, IDENTITY_ASSERTION_FORMATS, XAA_CONFIDENTIAL_CIMD_ORIGIN, getLocalConfidentialCimdProvider, MCP_PROTOCOL_VERSIONS, gatherClaudeReadinessEvidence, gradeClaudeReadiness, gatherOpenAIReadinessEvidence, xmldomParseXml, gradeOpenAIReadiness, openUrlInBrowser, buildEvalRunReport, GATE_WAIVER_MAX_REASON_LENGTH, GATE_WAIVER_REASON_NOTICE, MCPClientManager, decodeMcpHeaderValue, canDeclareTasksExtension, createStrictElicitationContentValidator, MCP_APPS_CHECK_CATEGORIES, MCP_APPS_CHECK_IDS, MCP_TASKS_CHECK_CATEGORIES, MCP_TASKS_CHECK_IDS, OAuthProxyError, isLoopbackHost, MCP_CHECK_CATEGORIES, MCP_CHECK_IDS, OPENAI_SUBMISSION_MODE_SHAPES, createDirectoryPluginFileSource, collectZipArchiveObservations, createZipPluginFileSource, generateRandomString, generateCodeChallenge, createInteractiveAuthorizationSession, loadEvalSuiteFile, formatEvalRunDecisionSummary, gateOutcomeVerdict, applyGateWaiver, formatGateReport, formatGateWaiverLine, detectFlakyCases, evaluateCompareGates, buildRunCompareReport, formatSuiteFileFindings, serializeEvalSuiteFile, MAX_SUITE_FILE_BYTES, buildCorpus, HostedOnlyCaseError, verifyCorpusLock, TaskLifecycleEngine, driveTaskToTerminal, extensionTaskToObservation, legacyTaskToObservation, canonicalDigest, readEvalRunDecisionSummary as readEvalRunDecisionSummary$1, buildEvalRunDecisionSummary, evaluateGates, gateInputFromPlatformRun, isGateWaiverInForce, calculateLatencyStats, CORPUS_LOCK_VERSION, passRateFractionFromPercent, DEFAULT_MIN_EFFECT_SIZE, DEFAULT_MIN_SAMPLE_SIZE, suiteFilePointer, isUnknownTaskError, isMCPTasksWireError, LEGACY_TASK_STATUSES } from '@mcpjam/sdk';
|
|
6
6
|
import path7, { join, dirname, basename } from 'path';
|
|
7
7
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
8
8
|
import { mkdir, writeFile, readFile, chmod, rename, rm, open, unlink, stat } from 'fs/promises';
|
|
@@ -27,7 +27,7 @@ import { PostHog } from 'posthog-node';
|
|
|
27
27
|
|
|
28
28
|
// package.json
|
|
29
29
|
var package_default = {
|
|
30
|
-
version: "
|
|
30
|
+
version: "5.0.0"};
|
|
31
31
|
function conformanceExitCode(result) {
|
|
32
32
|
if (result.outcome === "incomplete") return 3;
|
|
33
33
|
if (result.outcome === "failed") return 1;
|
|
@@ -603,7 +603,7 @@ function writeReporterResult(reporter, report) {
|
|
|
603
603
|
}
|
|
604
604
|
function writeEvalDecisionSummary(format, summary, destination = process.stdout) {
|
|
605
605
|
if (format !== "human" || !summary) return;
|
|
606
|
-
destination.write(`${
|
|
606
|
+
destination.write(`${formatEvalRunDecisionSummary(summary)}
|
|
607
607
|
`);
|
|
608
608
|
}
|
|
609
609
|
async function writeJsonArtifact(outputPath, payload) {
|
|
@@ -6180,6 +6180,14 @@ function evalGateExitCode(report) {
|
|
|
6180
6180
|
switch (report.outcome) {
|
|
6181
6181
|
case "passed":
|
|
6182
6182
|
return 0;
|
|
6183
|
+
// An authorized, recorded, time-boxed override of a real failure. Exit 0,
|
|
6184
|
+
// because unblocking the release is what a waiver is FOR — but it reaches
|
|
6185
|
+
// 0 by its own named outcome rather than by being turned into `passed`
|
|
6186
|
+
// upstream, so nothing downstream has to reconstruct which of the two
|
|
6187
|
+
// happened. The report, and every artifact built from it, still says the
|
|
6188
|
+
// gate failed and was waived.
|
|
6189
|
+
case "waived":
|
|
6190
|
+
return 0;
|
|
6183
6191
|
case "failed":
|
|
6184
6192
|
return 1;
|
|
6185
6193
|
case "usage_error":
|
|
@@ -6439,20 +6447,79 @@ function assertRunIdBaseline(baseline, runId) {
|
|
|
6439
6447
|
}
|
|
6440
6448
|
if (SHA_LIKE_BASELINE.test(normalized)) {
|
|
6441
6449
|
throw usageError(
|
|
6442
|
-
`--baseline "${baseline}" looks like a git SHA.
|
|
6450
|
+
`--baseline "${baseline}" looks like a git commit SHA. Pass it as --baseline-sha to pin the baseline by source SHA, or pass a run id to --baseline.`
|
|
6451
|
+
);
|
|
6452
|
+
}
|
|
6453
|
+
return normalized;
|
|
6454
|
+
}
|
|
6455
|
+
function assertCommitShaBaseline(baselineSha) {
|
|
6456
|
+
const normalized = baselineSha.trim();
|
|
6457
|
+
if (normalized === "") {
|
|
6458
|
+
throw usageError(
|
|
6459
|
+
`--baseline-sha must not be blank. Pass a commit SHA, or omit the flag entirely to gate on absolute thresholds only.`
|
|
6443
6460
|
);
|
|
6444
6461
|
}
|
|
6445
6462
|
return normalized;
|
|
6446
6463
|
}
|
|
6464
|
+
function resolveBaselineSelector(input) {
|
|
6465
|
+
if (input.baseline !== void 0 && input.baselineSha !== void 0) {
|
|
6466
|
+
throw usageError(
|
|
6467
|
+
`--baseline and --baseline-sha are mutually exclusive. Pass a run id to --baseline, or a source commit SHA to --baseline-sha, not both.`
|
|
6468
|
+
);
|
|
6469
|
+
}
|
|
6470
|
+
if (input.baselineSha !== void 0) {
|
|
6471
|
+
return {
|
|
6472
|
+
kind: "commitSha",
|
|
6473
|
+
commitSha: assertCommitShaBaseline(input.baselineSha)
|
|
6474
|
+
};
|
|
6475
|
+
}
|
|
6476
|
+
if (input.baseline !== void 0) {
|
|
6477
|
+
return {
|
|
6478
|
+
kind: "run",
|
|
6479
|
+
runId: assertRunIdBaseline(input.baseline, input.runId)
|
|
6480
|
+
};
|
|
6481
|
+
}
|
|
6482
|
+
return void 0;
|
|
6483
|
+
}
|
|
6484
|
+
function compareBaseSelector(input) {
|
|
6485
|
+
if (input.baseRun !== void 0 && input.baseSha !== void 0) {
|
|
6486
|
+
throw usageError(
|
|
6487
|
+
`--base-run and --base-sha are mutually exclusive. Pass a run id to --base-run, or a source commit SHA to --base-sha, not both.`
|
|
6488
|
+
);
|
|
6489
|
+
}
|
|
6490
|
+
if (input.baseSha !== void 0) {
|
|
6491
|
+
const normalized = input.baseSha.trim();
|
|
6492
|
+
if (normalized === "") {
|
|
6493
|
+
throw usageError(
|
|
6494
|
+
`--base-sha must not be blank. Pass a commit SHA, or omit the flag to compare against the nearest earlier completed run.`
|
|
6495
|
+
);
|
|
6496
|
+
}
|
|
6497
|
+
return { baseCommitSha: normalized };
|
|
6498
|
+
}
|
|
6499
|
+
if (input.baseRun !== void 0) {
|
|
6500
|
+
const normalized = input.baseRun.trim();
|
|
6501
|
+
if (normalized === "") {
|
|
6502
|
+
throw usageError(
|
|
6503
|
+
`--base-run must not be blank. Pass a run id, or omit the flag to compare against the nearest earlier completed run.`
|
|
6504
|
+
);
|
|
6505
|
+
}
|
|
6506
|
+
return { baseRunId: normalized };
|
|
6507
|
+
}
|
|
6508
|
+
return {};
|
|
6509
|
+
}
|
|
6510
|
+
function baselineCompareParams(baseline) {
|
|
6511
|
+
return baseline.kind === "run" ? { baseRunId: baseline.runId } : { baseCommitSha: baseline.commitSha };
|
|
6512
|
+
}
|
|
6447
6513
|
function comparePolicyFromGateOptions(options) {
|
|
6448
6514
|
const hasComparativeFlag = options.minSampleSize !== void 0 || options.minEffectSizePercent !== void 0 || options.gateDeterministicRegressions === true || options.maxP95LatencyIncreaseMs !== void 0;
|
|
6449
|
-
|
|
6515
|
+
const hasBaseline = Boolean(options.baseline) || Boolean(options.baselineSha);
|
|
6516
|
+
if (hasComparativeFlag && !hasBaseline) {
|
|
6450
6517
|
throw usageError(
|
|
6451
|
-
"--min-sample-size, --min-effect-size-percent, --gate-deterministic-regressions, and --max-p95-latency-increase-ms tune the baseline regression gate; pass --baseline to enable it."
|
|
6518
|
+
"--min-sample-size, --min-effect-size-percent, --gate-deterministic-regressions, and --max-p95-latency-increase-ms tune the baseline regression gate; pass --baseline or --baseline-sha to enable it."
|
|
6452
6519
|
);
|
|
6453
6520
|
}
|
|
6454
6521
|
return comparePolicyFromOptions({
|
|
6455
|
-
gateRegressions:
|
|
6522
|
+
gateRegressions: hasBaseline,
|
|
6456
6523
|
minSampleSize: options.minSampleSize,
|
|
6457
6524
|
minEffectSizePercent: options.minEffectSizePercent,
|
|
6458
6525
|
gateDeterministicRegressions: options.gateDeterministicRegressions,
|
|
@@ -6465,6 +6532,15 @@ function baselineNotFoundReason(error) {
|
|
|
6465
6532
|
}
|
|
6466
6533
|
var OUTCOME_RANK = {
|
|
6467
6534
|
passed: 0,
|
|
6535
|
+
// UNREACHABLE by construction: a waiver is folded in by `applyGateWaiver`
|
|
6536
|
+
// AFTER the two halves are merged, so no input to this function can carry
|
|
6537
|
+
// it. Ranked with `passed` rather than left to a lookup miss (`undefined`,
|
|
6538
|
+
// whose every comparison is false, would silently pin the merged outcome to
|
|
6539
|
+
// whichever side was evaluated first) — and ranked LOWEST deliberately: if
|
|
6540
|
+
// one half were ever waived, an unwaived failure on the other half must
|
|
6541
|
+
// still win. A waiver granted over the threshold gate is not consent to
|
|
6542
|
+
// ship a baseline regression.
|
|
6543
|
+
waived: 0,
|
|
6468
6544
|
incomplete: 1,
|
|
6469
6545
|
failed: 2,
|
|
6470
6546
|
usage_error: 3
|
|
@@ -6502,8 +6578,23 @@ function buildBaselineProvenance(requestedBaseline, compare, input, policy) {
|
|
|
6502
6578
|
compare.scoreContract.evaluationConfigChanged
|
|
6503
6579
|
)
|
|
6504
6580
|
}));
|
|
6581
|
+
const requested = {
|
|
6582
|
+
requestedBaselineKind: requestedBaseline.kind,
|
|
6583
|
+
...requestedBaseline.kind === "run" ? { requestedBaselineRunId: requestedBaseline.runId } : { requestedBaselineCommitSha: requestedBaseline.commitSha },
|
|
6584
|
+
// The RESOLVED source SHA as the backend echoed it, kept separate from
|
|
6585
|
+
// the requested one: a mixed-version backend can resolve without echoing,
|
|
6586
|
+
// and silently presenting the request as the answer would fabricate
|
|
6587
|
+
// confirmation the server never gave.
|
|
6588
|
+
...typeof compare.baseline.baseCommitSha === "string" ? { resolvedBaselineCommitSha: compare.baseline.baseCommitSha } : {}
|
|
6589
|
+
};
|
|
6590
|
+
const ambiguity = typeof compare.baseline.matchCount === "number" ? {
|
|
6591
|
+
baselineMatchCount: compare.baseline.matchCount,
|
|
6592
|
+
baselineMatchCountTruncated: compare.baseline.matchCountTruncated === true,
|
|
6593
|
+
baselineMatchUnique: false
|
|
6594
|
+
} : { baselineMatchUnique: true };
|
|
6505
6595
|
return {
|
|
6506
|
-
|
|
6596
|
+
...requested,
|
|
6597
|
+
...ambiguity,
|
|
6507
6598
|
baseline: compare.baseline,
|
|
6508
6599
|
baseRunId: compare.baseRun.id,
|
|
6509
6600
|
compareRunId: compare.compareRun.id,
|
|
@@ -6554,7 +6645,9 @@ async function evaluateBaselineComparison(input) {
|
|
|
6554
6645
|
{
|
|
6555
6646
|
projectId: input.projectId,
|
|
6556
6647
|
runId: input.runId,
|
|
6557
|
-
baseRunId
|
|
6648
|
+
// Exactly ONE of `baseRunId` / `baseCommitSha` — sending both is a 400
|
|
6649
|
+
// at the route and at the action alike.
|
|
6650
|
+
...baselineCompareParams(input.baseline)
|
|
6558
6651
|
},
|
|
6559
6652
|
{ signal: input.signal }
|
|
6560
6653
|
);
|
|
@@ -6628,6 +6721,40 @@ async function evaluateBaselineComparison(input) {
|
|
|
6628
6721
|
)
|
|
6629
6722
|
};
|
|
6630
6723
|
}
|
|
6724
|
+
function activeWaiverForRun(run, now = Date.now()) {
|
|
6725
|
+
const waiver = run?.gateWaiver;
|
|
6726
|
+
if (!waiver) return void 0;
|
|
6727
|
+
if (waiver.active !== true) return void 0;
|
|
6728
|
+
if (waiver.revokedAt !== null) return void 0;
|
|
6729
|
+
if (!isGateWaiverInForce(waiver, now)) return void 0;
|
|
6730
|
+
return {
|
|
6731
|
+
id: waiver.id,
|
|
6732
|
+
reason: waiver.reason,
|
|
6733
|
+
expiresAt: waiver.expiresAt,
|
|
6734
|
+
createdAt: waiver.createdAt,
|
|
6735
|
+
createdBy: waiver.createdBy,
|
|
6736
|
+
createdByEmail: waiver.createdByEmail,
|
|
6737
|
+
policySnapshot: waiver.policySnapshot
|
|
6738
|
+
};
|
|
6739
|
+
}
|
|
6740
|
+
var DURATION_UNIT_MS = {
|
|
6741
|
+
m: 6e4,
|
|
6742
|
+
h: 36e5,
|
|
6743
|
+
d: 864e5
|
|
6744
|
+
};
|
|
6745
|
+
function parseWaiverExpiry(raw, now = Date.now()) {
|
|
6746
|
+
const match = /^(\d+)\s*([mhd])$/i.exec(raw.trim());
|
|
6747
|
+
if (!match) {
|
|
6748
|
+
throw usageError(
|
|
6749
|
+
`--expires-in must be a duration like 30m, 12h, or 7d, got "${raw}".`
|
|
6750
|
+
);
|
|
6751
|
+
}
|
|
6752
|
+
const amount = Number(match[1]);
|
|
6753
|
+
if (!Number.isFinite(amount) || amount <= 0) {
|
|
6754
|
+
throw usageError(`--expires-in must be greater than zero, got "${raw}".`);
|
|
6755
|
+
}
|
|
6756
|
+
return now + amount * DURATION_UNIT_MS[match[2].toLowerCase()];
|
|
6757
|
+
}
|
|
6631
6758
|
|
|
6632
6759
|
// src/lib/eval-run-exit-code.ts
|
|
6633
6760
|
var SEVERITY_ORDER = [1, 3, 4, 5, 0];
|
|
@@ -6698,6 +6825,19 @@ function classifyWaitErrorExitCode(code) {
|
|
|
6698
6825
|
if (code !== void 0 && AUTH_SHAPED_CODES.has(code)) return 3;
|
|
6699
6826
|
return 5;
|
|
6700
6827
|
}
|
|
6828
|
+
function decisionSummaryFromIterations(input) {
|
|
6829
|
+
return buildEvalRunDecisionSummary({
|
|
6830
|
+
projectId: input.projectId,
|
|
6831
|
+
run: input.run,
|
|
6832
|
+
iterations: input.iterations.items,
|
|
6833
|
+
page: { complete: input.iterations.complete }
|
|
6834
|
+
});
|
|
6835
|
+
}
|
|
6836
|
+
async function readEvalRunDecisionSummary(client, signal, projectId, run) {
|
|
6837
|
+
return readEvalRunDecisionSummary$1(client, signal, projectId, run, {
|
|
6838
|
+
limit: 200
|
|
6839
|
+
});
|
|
6840
|
+
}
|
|
6701
6841
|
|
|
6702
6842
|
// src/lib/terminal-image.ts
|
|
6703
6843
|
var ESC = "\x1B";
|
|
@@ -7242,10 +7382,11 @@ function launchFailureCases(result) {
|
|
|
7242
7382
|
});
|
|
7243
7383
|
}
|
|
7244
7384
|
function gateReportCase(report, baselineProvenance) {
|
|
7245
|
-
const
|
|
7385
|
+
const waived = report.outcome === "waived";
|
|
7386
|
+
const passed = report.outcome === "passed" || waived;
|
|
7246
7387
|
return {
|
|
7247
7388
|
id: "gate",
|
|
7248
|
-
title: "Eval gate",
|
|
7389
|
+
title: waived ? "Eval gate (WAIVED)" : "Eval gate",
|
|
7249
7390
|
category: "gate",
|
|
7250
7391
|
passed,
|
|
7251
7392
|
// Only a real FAILED gate is a confirmed regression. `incomplete` and
|
|
@@ -7253,10 +7394,26 @@ function gateReportCase(report, baselineProvenance) {
|
|
|
7253
7394
|
// way), but reporting them as `breaking` — the same class a genuine
|
|
7254
7395
|
// failure gets — would claim a defect the run never observed. Mirrors
|
|
7255
7396
|
// `gateCase` in sdk/src/run-compare.ts.
|
|
7256
|
-
classification: report.outcome === "failed" ? "breaking" : passed ? "non_breaking" : "informational",
|
|
7257
|
-
|
|
7258
|
-
|
|
7397
|
+
classification: report.outcome === "failed" ? "breaking" : waived ? "informational" : passed ? "non_breaking" : "informational",
|
|
7398
|
+
// The failing verdicts are carried on a WAIVED case too. The waiver
|
|
7399
|
+
// explains why the build was not blocked; it is not a reason to stop
|
|
7400
|
+
// saying what failed.
|
|
7401
|
+
...passed && !waived ? {} : {
|
|
7402
|
+
error: report.verdicts.filter(
|
|
7403
|
+
(verdict) => verdict.status !== "passed" && verdict.status !== "waived"
|
|
7404
|
+
).map((verdict) => verdict.message).join("; ")
|
|
7259
7405
|
},
|
|
7406
|
+
...report.waiver ? {
|
|
7407
|
+
waiver: {
|
|
7408
|
+
id: report.waiver.id,
|
|
7409
|
+
reason: report.waiver.reason,
|
|
7410
|
+
expiresAt: report.waiver.expiresAt,
|
|
7411
|
+
createdAt: report.waiver.createdAt,
|
|
7412
|
+
createdBy: report.waiver.createdBy,
|
|
7413
|
+
createdByEmail: report.waiver.createdByEmail,
|
|
7414
|
+
policySnapshot: report.waiver.policySnapshot
|
|
7415
|
+
}
|
|
7416
|
+
} : {},
|
|
7260
7417
|
// The baseline provenance rides along on the case row too, not only in
|
|
7261
7418
|
// the report's top-level metadata: `--reporter junit-xml` has no other
|
|
7262
7419
|
// place to carry it, and a regression visible in the exit code but
|
|
@@ -7267,13 +7424,21 @@ function gateReportCase(report, baselineProvenance) {
|
|
|
7267
7424
|
var DEFAULT_GATE_WAIT_TIMEOUT_MS = 6e5;
|
|
7268
7425
|
async function runEvalGate(options, command) {
|
|
7269
7426
|
const globalOptions = getGlobalOptions(command);
|
|
7427
|
+
const runId = options.run?.trim();
|
|
7428
|
+
if (!runId) {
|
|
7429
|
+
throw usageError("--run <id> is required. Pass the eval run to gate.");
|
|
7430
|
+
}
|
|
7270
7431
|
const reporter = parseReporterFormat(options.reporter);
|
|
7271
7432
|
const needsReport = reporter !== void 0 || options.out !== void 0;
|
|
7272
7433
|
const policy = policyFromOptions({
|
|
7273
7434
|
...options,
|
|
7274
7435
|
noGatingScoreErrors: options.gatingScoreErrors === false
|
|
7275
7436
|
});
|
|
7276
|
-
const baseline =
|
|
7437
|
+
const baseline = resolveBaselineSelector({
|
|
7438
|
+
baseline: options.baseline,
|
|
7439
|
+
baselineSha: options.baselineSha,
|
|
7440
|
+
runId
|
|
7441
|
+
});
|
|
7277
7442
|
const comparePolicy = comparePolicyFromGateOptions(options);
|
|
7278
7443
|
const waitTimeoutMs = options.waitTimeout !== void 0 ? parsePositiveInteger(options.waitTimeout, "--wait-timeout") : DEFAULT_GATE_WAIT_TIMEOUT_MS;
|
|
7279
7444
|
const resolved = resolveCloudProjectArgs(options);
|
|
@@ -7294,11 +7459,17 @@ async function runEvalGate(options, command) {
|
|
|
7294
7459
|
const project = resolution.project;
|
|
7295
7460
|
const deadline = Date.now() + waitTimeoutMs;
|
|
7296
7461
|
let run = await client.getEvalRun(
|
|
7297
|
-
{ projectId: project.id, runId
|
|
7462
|
+
{ projectId: project.id, runId },
|
|
7298
7463
|
{ signal }
|
|
7299
7464
|
);
|
|
7300
7465
|
while (!TERMINAL_RUN_STATUSES.has(run.status)) {
|
|
7301
7466
|
if (!options.wait) {
|
|
7467
|
+
decisionSummary = await readEvalRunDecisionSummary(
|
|
7468
|
+
client,
|
|
7469
|
+
signal,
|
|
7470
|
+
project.id,
|
|
7471
|
+
run
|
|
7472
|
+
);
|
|
7302
7473
|
return {
|
|
7303
7474
|
report: {
|
|
7304
7475
|
outcome: "incomplete",
|
|
@@ -7310,10 +7481,17 @@ async function runEvalGate(options, command) {
|
|
|
7310
7481
|
message: `run is ${run.status}; pass --wait, or gate it once it finishes`
|
|
7311
7482
|
}
|
|
7312
7483
|
]
|
|
7313
|
-
}
|
|
7484
|
+
},
|
|
7485
|
+
run
|
|
7314
7486
|
};
|
|
7315
7487
|
}
|
|
7316
7488
|
if (Date.now() >= deadline) {
|
|
7489
|
+
decisionSummary = await readEvalRunDecisionSummary(
|
|
7490
|
+
client,
|
|
7491
|
+
signal,
|
|
7492
|
+
project.id,
|
|
7493
|
+
run
|
|
7494
|
+
);
|
|
7317
7495
|
return {
|
|
7318
7496
|
report: {
|
|
7319
7497
|
outcome: "incomplete",
|
|
@@ -7325,12 +7503,13 @@ async function runEvalGate(options, command) {
|
|
|
7325
7503
|
message: `run still ${run.status} after ${waitTimeoutMs}ms`
|
|
7326
7504
|
}
|
|
7327
7505
|
]
|
|
7328
|
-
}
|
|
7506
|
+
},
|
|
7507
|
+
run
|
|
7329
7508
|
};
|
|
7330
7509
|
}
|
|
7331
7510
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
7332
7511
|
run = await client.getEvalRun(
|
|
7333
|
-
{ projectId: project.id, runId
|
|
7512
|
+
{ projectId: project.id, runId },
|
|
7334
7513
|
{ signal }
|
|
7335
7514
|
);
|
|
7336
7515
|
}
|
|
@@ -7342,13 +7521,23 @@ async function runEvalGate(options, command) {
|
|
|
7342
7521
|
client,
|
|
7343
7522
|
signal,
|
|
7344
7523
|
project.id,
|
|
7345
|
-
|
|
7524
|
+
runId
|
|
7346
7525
|
);
|
|
7347
7526
|
} catch (error) {
|
|
7348
7527
|
iterationError = error instanceof Error ? error.message : String(error);
|
|
7349
7528
|
}
|
|
7350
7529
|
}
|
|
7351
7530
|
if (isNonVerdictRunStatus(run.status) || isNonVerdictRunResult(run.result)) {
|
|
7531
|
+
decisionSummary = iterations && iterationError === void 0 ? decisionSummaryFromIterations({
|
|
7532
|
+
projectId: project.id,
|
|
7533
|
+
run,
|
|
7534
|
+
iterations
|
|
7535
|
+
}) : await readEvalRunDecisionSummary(
|
|
7536
|
+
client,
|
|
7537
|
+
signal,
|
|
7538
|
+
project.id,
|
|
7539
|
+
run
|
|
7540
|
+
);
|
|
7352
7541
|
return {
|
|
7353
7542
|
report: {
|
|
7354
7543
|
outcome: "incomplete",
|
|
@@ -7368,14 +7557,17 @@ async function runEvalGate(options, command) {
|
|
|
7368
7557
|
};
|
|
7369
7558
|
}
|
|
7370
7559
|
if (iterations) {
|
|
7371
|
-
decisionSummary =
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7560
|
+
decisionSummary = decisionSummaryFromIterations({
|
|
7561
|
+
projectId: project.id,
|
|
7562
|
+
run,
|
|
7563
|
+
iterations
|
|
7564
|
+
});
|
|
7565
|
+
} else {
|
|
7566
|
+
decisionSummary = await readEvalRunDecisionSummary(
|
|
7567
|
+
client,
|
|
7568
|
+
signal,
|
|
7569
|
+
project.id,
|
|
7570
|
+
run
|
|
7379
7571
|
);
|
|
7380
7572
|
}
|
|
7381
7573
|
const thresholdReport = iterationError ? {
|
|
@@ -7407,7 +7599,7 @@ async function runEvalGate(options, command) {
|
|
|
7407
7599
|
client,
|
|
7408
7600
|
signal,
|
|
7409
7601
|
projectId: project.id,
|
|
7410
|
-
runId
|
|
7602
|
+
runId,
|
|
7411
7603
|
baseline,
|
|
7412
7604
|
policy: comparePolicy,
|
|
7413
7605
|
compareIterations: iterations
|
|
@@ -7427,7 +7619,7 @@ async function runEvalGate(options, command) {
|
|
|
7427
7619
|
throw error;
|
|
7428
7620
|
}
|
|
7429
7621
|
const detail = error instanceof Error ? error.message : String(error);
|
|
7430
|
-
const
|
|
7622
|
+
const report2 = {
|
|
7431
7623
|
outcome: "incomplete",
|
|
7432
7624
|
scoreIntegrity: "unknown",
|
|
7433
7625
|
verdicts: [
|
|
@@ -7439,8 +7631,8 @@ async function runEvalGate(options, command) {
|
|
|
7439
7631
|
]
|
|
7440
7632
|
};
|
|
7441
7633
|
const structured2 = needsReport ? buildEvalRunReport([], {
|
|
7442
|
-
cases: [gateReportCase(
|
|
7443
|
-
verdict: gateOutcomeVerdict(
|
|
7634
|
+
cases: [gateReportCase(report2)],
|
|
7635
|
+
verdict: gateOutcomeVerdict(report2.outcome)
|
|
7444
7636
|
}) : void 0;
|
|
7445
7637
|
if (options.out && structured2) {
|
|
7446
7638
|
await writeReporterArtifact(
|
|
@@ -7453,14 +7645,18 @@ async function runEvalGate(options, command) {
|
|
|
7453
7645
|
writeReporterResult(reporter, structured2);
|
|
7454
7646
|
} else {
|
|
7455
7647
|
writeResult(
|
|
7456
|
-
{ gate:
|
|
7648
|
+
{ gate: report2, exitCode: EVAL_GATE_INCOMPLETE_EXIT_CODE },
|
|
7457
7649
|
globalOptions.format
|
|
7458
7650
|
);
|
|
7459
7651
|
}
|
|
7460
7652
|
setProcessExitCode(EVAL_GATE_INCOMPLETE_EXIT_CODE);
|
|
7461
7653
|
return;
|
|
7462
7654
|
}
|
|
7463
|
-
const
|
|
7655
|
+
const report = applyGateWaiver(
|
|
7656
|
+
outcome.report,
|
|
7657
|
+
activeWaiverForRun(outcome.run)
|
|
7658
|
+
);
|
|
7659
|
+
const exitCode = evalGateExitCode(report);
|
|
7464
7660
|
const structured = needsReport ? buildEvalRunReport(
|
|
7465
7661
|
outcome.run ? [
|
|
7466
7662
|
{
|
|
@@ -7471,8 +7667,8 @@ async function runEvalGate(options, command) {
|
|
|
7471
7667
|
}
|
|
7472
7668
|
] : [],
|
|
7473
7669
|
{
|
|
7474
|
-
cases: [gateReportCase(
|
|
7475
|
-
verdict: gateOutcomeVerdict(
|
|
7670
|
+
cases: [gateReportCase(report, outcome.baselineProvenance)],
|
|
7671
|
+
verdict: gateOutcomeVerdict(report.outcome),
|
|
7476
7672
|
...decisionSummary ? { decisionSummary } : {},
|
|
7477
7673
|
...outcome.baselineProvenance ? { metadata: { baselineComparison: outcome.baselineProvenance } } : {}
|
|
7478
7674
|
}
|
|
@@ -7487,10 +7683,17 @@ async function runEvalGate(options, command) {
|
|
|
7487
7683
|
if (reporter && structured) {
|
|
7488
7684
|
writeReporterResult(reporter, structured);
|
|
7489
7685
|
} else {
|
|
7490
|
-
writeResult(
|
|
7686
|
+
writeResult(
|
|
7687
|
+
globalOptions.format === "json" ? {
|
|
7688
|
+
gate: report,
|
|
7689
|
+
exitCode,
|
|
7690
|
+
...decisionSummary ? { decisionSummary } : {}
|
|
7691
|
+
} : { gate: report, exitCode },
|
|
7692
|
+
globalOptions.format
|
|
7693
|
+
);
|
|
7491
7694
|
}
|
|
7492
7695
|
if (globalOptions.format === "human" && !reporter) {
|
|
7493
|
-
process.stderr.write(`${formatGateReport(
|
|
7696
|
+
process.stderr.write(`${formatGateReport(report)}
|
|
7494
7697
|
`);
|
|
7495
7698
|
writeEvalDecisionSummary(
|
|
7496
7699
|
globalOptions.format,
|
|
@@ -7502,9 +7705,110 @@ async function runEvalGate(options, command) {
|
|
|
7502
7705
|
setProcessExitCode(exitCode);
|
|
7503
7706
|
}
|
|
7504
7707
|
}
|
|
7708
|
+
function gateSubcommandScope(command) {
|
|
7709
|
+
const parentOptions = command.parent?.opts() ?? {};
|
|
7710
|
+
const run = parentOptions.run?.trim();
|
|
7711
|
+
if (!run) {
|
|
7712
|
+
throw usageError("--run <id> is required. Pass the eval run to act on.");
|
|
7713
|
+
}
|
|
7714
|
+
return {
|
|
7715
|
+
run,
|
|
7716
|
+
...parentOptions.project !== void 0 ? { project: parentOptions.project } : {}
|
|
7717
|
+
};
|
|
7718
|
+
}
|
|
7719
|
+
async function runEvalGateWaive(options, command) {
|
|
7720
|
+
const globalOptions = getGlobalOptions(command);
|
|
7721
|
+
const scope = gateSubcommandScope(command);
|
|
7722
|
+
const expiresAt = parseWaiverExpiry(options.expiresIn);
|
|
7723
|
+
const resolved = resolveCloudProjectArgs(scope);
|
|
7724
|
+
if (globalOptions.format === "human") {
|
|
7725
|
+
process.stderr.write(`Gate waiver reason: ${GATE_WAIVER_REASON_NOTICE}
|
|
7726
|
+
`);
|
|
7727
|
+
}
|
|
7728
|
+
const result = await runPlatformOperation(
|
|
7729
|
+
platformOptionsOf(command),
|
|
7730
|
+
globalOptions.timeout,
|
|
7731
|
+
async ({ client, signal }) => {
|
|
7732
|
+
const projects = await client.listProjects({}, { signal });
|
|
7733
|
+
const resolution = resolveProject(projects.items, resolved.project);
|
|
7734
|
+
if (!resolution.ok) {
|
|
7735
|
+
throw usageError(
|
|
7736
|
+
appendProjectLinkHint(resolution.message, resolved.projectScope)
|
|
7737
|
+
);
|
|
7738
|
+
}
|
|
7739
|
+
return await client.createGateWaiver(
|
|
7740
|
+
{
|
|
7741
|
+
projectId: resolution.project.id,
|
|
7742
|
+
runId: scope.run,
|
|
7743
|
+
reason: options.reason,
|
|
7744
|
+
expiresAt
|
|
7745
|
+
},
|
|
7746
|
+
{ signal }
|
|
7747
|
+
);
|
|
7748
|
+
}
|
|
7749
|
+
);
|
|
7750
|
+
writeResult(result, globalOptions.format);
|
|
7751
|
+
if (globalOptions.format === "human") {
|
|
7752
|
+
process.stderr.write(
|
|
7753
|
+
`${result.status === "conflict" ? "A waiver was already in force over this run; it was NOT replaced." : "Gate waived."} ${formatGateWaiverLine(result.waiver)}
|
|
7754
|
+
`
|
|
7755
|
+
);
|
|
7756
|
+
process.stderr.write(
|
|
7757
|
+
`Republished ${result.republishedChecks} GitHub check run(s).
|
|
7758
|
+
`
|
|
7759
|
+
);
|
|
7760
|
+
}
|
|
7761
|
+
}
|
|
7762
|
+
async function runEvalGateUnwaive(options, command) {
|
|
7763
|
+
const globalOptions = getGlobalOptions(command);
|
|
7764
|
+
const scope = gateSubcommandScope(command);
|
|
7765
|
+
const resolved = resolveCloudProjectArgs(scope);
|
|
7766
|
+
const result = await runPlatformOperation(
|
|
7767
|
+
platformOptionsOf(command),
|
|
7768
|
+
globalOptions.timeout,
|
|
7769
|
+
async ({ client, signal }) => {
|
|
7770
|
+
const projects = await client.listProjects({}, { signal });
|
|
7771
|
+
const resolution = resolveProject(projects.items, resolved.project);
|
|
7772
|
+
if (!resolution.ok) {
|
|
7773
|
+
throw usageError(
|
|
7774
|
+
appendProjectLinkHint(resolution.message, resolved.projectScope)
|
|
7775
|
+
);
|
|
7776
|
+
}
|
|
7777
|
+
const projectId = resolution.project.id;
|
|
7778
|
+
let waiverId = options.waiver?.trim();
|
|
7779
|
+
if (!waiverId) {
|
|
7780
|
+
const { waiver } = await client.getGateWaiver(
|
|
7781
|
+
{ projectId, runId: scope.run },
|
|
7782
|
+
{ signal }
|
|
7783
|
+
);
|
|
7784
|
+
if (!waiver) {
|
|
7785
|
+
throw usageError(
|
|
7786
|
+
`No waiver is in force over run "${scope.run}". Pass --waiver <id> to revoke a specific one.`
|
|
7787
|
+
);
|
|
7788
|
+
}
|
|
7789
|
+
waiverId = waiver.id;
|
|
7790
|
+
}
|
|
7791
|
+
return await client.revokeGateWaiver(
|
|
7792
|
+
{ projectId, runId: scope.run, waiverId },
|
|
7793
|
+
{ signal }
|
|
7794
|
+
);
|
|
7795
|
+
}
|
|
7796
|
+
);
|
|
7797
|
+
writeResult(result, globalOptions.format);
|
|
7798
|
+
if (globalOptions.format === "human") {
|
|
7799
|
+
process.stderr.write(
|
|
7800
|
+
`${result.status === "already_revoked" ? "This waiver was already revoked; the existing revocation stands." : "Gate waiver revoked."} Republished ${result.republishedChecks} GitHub check run(s).
|
|
7801
|
+
`
|
|
7802
|
+
);
|
|
7803
|
+
}
|
|
7804
|
+
}
|
|
7505
7805
|
async function runEvalCompare(options, command) {
|
|
7506
7806
|
const globalOptions = getGlobalOptions(command);
|
|
7507
7807
|
const policy = comparePolicyFromOptions(options);
|
|
7808
|
+
const baseSelector = compareBaseSelector({
|
|
7809
|
+
baseRun: options.baseRun,
|
|
7810
|
+
baseSha: options.baseSha
|
|
7811
|
+
});
|
|
7508
7812
|
const reporter = parseReporterFormat(options.reporter);
|
|
7509
7813
|
const resolved = resolveCloudProjectArgs(options);
|
|
7510
7814
|
let outcome;
|
|
@@ -7525,7 +7829,7 @@ async function runEvalCompare(options, command) {
|
|
|
7525
7829
|
{
|
|
7526
7830
|
projectId: project.id,
|
|
7527
7831
|
runId: options.run,
|
|
7528
|
-
...
|
|
7832
|
+
...baseSelector
|
|
7529
7833
|
},
|
|
7530
7834
|
{ signal }
|
|
7531
7835
|
);
|
|
@@ -7573,18 +7877,20 @@ async function runEvalCompare(options, command) {
|
|
|
7573
7877
|
baseP95Ms: p95Of(baseIterations),
|
|
7574
7878
|
compareP95Ms: p95Of(compareIterations)
|
|
7575
7879
|
});
|
|
7880
|
+
const compareRunDetail = await client.getEvalRun(
|
|
7881
|
+
{ projectId: project.id, runId: compare.compareRun.id },
|
|
7882
|
+
{ signal }
|
|
7883
|
+
).catch(() => void 0);
|
|
7576
7884
|
return {
|
|
7577
7885
|
report: evaluateCompareGates(input, policy),
|
|
7578
7886
|
compare,
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
}
|
|
7587
|
-
) : void 0,
|
|
7887
|
+
// About the COMPARE side only. A baseline's own failures are a
|
|
7888
|
+
// different run's diagnostics and would read here as this run's.
|
|
7889
|
+
decisionSummary: compareIterations && compareRunDetail ? decisionSummaryFromIterations({
|
|
7890
|
+
projectId: project.id,
|
|
7891
|
+
run: compareRunDetail,
|
|
7892
|
+
iterations: compareIterations
|
|
7893
|
+
}) : void 0,
|
|
7588
7894
|
// Reported, NEVER gated. See `detectFlakyCases`.
|
|
7589
7895
|
flakyCases: compareIterations?.complete ? detectFlakyCases(flakyInputFrom(compareIterations.items)) : []
|
|
7590
7896
|
};
|
|
@@ -7633,6 +7939,11 @@ async function runEvalCompare(options, command) {
|
|
|
7633
7939
|
if (globalOptions.format === "human" && !reporter) {
|
|
7634
7940
|
process.stderr.write(`${formatGateReport(outcome.report)}
|
|
7635
7941
|
`);
|
|
7942
|
+
writeEvalDecisionSummary(
|
|
7943
|
+
globalOptions.format,
|
|
7944
|
+
outcome.decisionSummary,
|
|
7945
|
+
process.stderr
|
|
7946
|
+
);
|
|
7636
7947
|
}
|
|
7637
7948
|
if (exitCode !== 0) {
|
|
7638
7949
|
setProcessExitCode(exitCode);
|
|
@@ -8305,11 +8616,18 @@ function registerEvalCommands(program) {
|
|
|
8305
8616
|
] : []
|
|
8306
8617
|
);
|
|
8307
8618
|
if (!needsReport) {
|
|
8619
|
+
const soloSummary = globalOptions.format === "human" && result.targets.length === 1 && runs.length === 1 && TERMINAL_RUN_STATUSES.has(runs[0].status) ? await readEvalRunDecisionSummary(
|
|
8620
|
+
client,
|
|
8621
|
+
signal,
|
|
8622
|
+
result.project.id,
|
|
8623
|
+
runs[0]
|
|
8624
|
+
) : void 0;
|
|
8308
8625
|
return {
|
|
8309
8626
|
runs,
|
|
8310
8627
|
waitErrors,
|
|
8311
8628
|
reportInputs: [],
|
|
8312
|
-
iterationErrorCodes: /* @__PURE__ */ new Map()
|
|
8629
|
+
iterationErrorCodes: /* @__PURE__ */ new Map(),
|
|
8630
|
+
...soloSummary ? { decisionSummary: soloSummary } : {}
|
|
8313
8631
|
};
|
|
8314
8632
|
}
|
|
8315
8633
|
const iterationErrorCodes = /* @__PURE__ */ new Map();
|
|
@@ -8340,7 +8658,22 @@ function registerEvalCommands(program) {
|
|
|
8340
8658
|
}
|
|
8341
8659
|
})
|
|
8342
8660
|
);
|
|
8343
|
-
|
|
8661
|
+
const solo = result.targets.length === 1 && runs.length === 1 && reportInputs.length === 1 ? reportInputs[0] : void 0;
|
|
8662
|
+
const decisionSummary = solo && solo.iterationError === void 0 ? decisionSummaryFromIterations({
|
|
8663
|
+
projectId: result.project.id,
|
|
8664
|
+
run: solo.run,
|
|
8665
|
+
iterations: {
|
|
8666
|
+
items: [...solo.iterations],
|
|
8667
|
+
complete: solo.iterationsComplete
|
|
8668
|
+
}
|
|
8669
|
+
}) : void 0;
|
|
8670
|
+
return {
|
|
8671
|
+
runs,
|
|
8672
|
+
waitErrors,
|
|
8673
|
+
reportInputs,
|
|
8674
|
+
iterationErrorCodes,
|
|
8675
|
+
...decisionSummary ? { decisionSummary } : {}
|
|
8676
|
+
};
|
|
8344
8677
|
},
|
|
8345
8678
|
{
|
|
8346
8679
|
projectScope: resolved.projectScope,
|
|
@@ -8362,7 +8695,8 @@ function registerEvalCommands(program) {
|
|
|
8362
8695
|
project: result.project,
|
|
8363
8696
|
suite: result.suite,
|
|
8364
8697
|
...result.runGroupId ? { runGroupId: result.runGroupId } : {}
|
|
8365
|
-
}
|
|
8698
|
+
},
|
|
8699
|
+
...completion.decisionSummary ? { decisionSummary: completion.decisionSummary } : {}
|
|
8366
8700
|
}) : void 0;
|
|
8367
8701
|
const reportingErrors = completion.reportInputs.filter(
|
|
8368
8702
|
(input) => !input.iterationsComplete || input.iterationError
|
|
@@ -8403,6 +8737,11 @@ function registerEvalCommands(program) {
|
|
|
8403
8737
|
globalOptions.format
|
|
8404
8738
|
);
|
|
8405
8739
|
writeRunGroupSummary(globalOptions.format, webOrigin, result);
|
|
8740
|
+
writeEvalDecisionSummary(
|
|
8741
|
+
globalOptions.format,
|
|
8742
|
+
completion.decisionSummary,
|
|
8743
|
+
process.stdout
|
|
8744
|
+
);
|
|
8406
8745
|
}
|
|
8407
8746
|
if (outWriteError !== void 0) {
|
|
8408
8747
|
throw cliError("OUT_WRITE_FAILED", outWriteError, worstOf([code, 4]));
|
|
@@ -8450,25 +8789,8 @@ function registerEvalCommands(program) {
|
|
|
8450
8789
|
},
|
|
8451
8790
|
{ client: context.client, signal: context.signal }
|
|
8452
8791
|
);
|
|
8453
|
-
if (globalOptions.format === "human" && TERMINAL_RUN_STATUSES.has(result2.run.status) && result2.run.result
|
|
8454
|
-
|
|
8455
|
-
const iterations = await fetchAllIterations(
|
|
8456
|
-
context.client,
|
|
8457
|
-
context.signal,
|
|
8458
|
-
result2.project.id,
|
|
8459
|
-
result2.run.id
|
|
8460
|
-
);
|
|
8461
|
-
decisionSummary = buildEvalDecisionSummaryFromIterations(
|
|
8462
|
-
iterations.items,
|
|
8463
|
-
{
|
|
8464
|
-
total: result2.run.summary?.total,
|
|
8465
|
-
passed: result2.run.summary?.passed,
|
|
8466
|
-
failed: result2.run.summary?.failed,
|
|
8467
|
-
iterationWalkComplete: iterations.complete
|
|
8468
|
-
}
|
|
8469
|
-
);
|
|
8470
|
-
} catch {
|
|
8471
|
-
}
|
|
8792
|
+
if (globalOptions.format === "human" && TERMINAL_RUN_STATUSES.has(result2.run.status) && result2.run.result !== "passed") {
|
|
8793
|
+
decisionSummary = result2.decisionSummary;
|
|
8472
8794
|
}
|
|
8473
8795
|
return result2;
|
|
8474
8796
|
},
|
|
@@ -8477,18 +8799,22 @@ function registerEvalCommands(program) {
|
|
|
8477
8799
|
quiet: globalOptions.quiet
|
|
8478
8800
|
}
|
|
8479
8801
|
);
|
|
8480
|
-
|
|
8802
|
+
const resultForOutput = globalOptions.format === "human" ? (() => {
|
|
8803
|
+
const { decisionSummary: _decisionSummary, ...humanResult } = result;
|
|
8804
|
+
return humanResult;
|
|
8805
|
+
})() : result;
|
|
8806
|
+
writeResult(resultForOutput, globalOptions.format);
|
|
8481
8807
|
writeJudgeSummary(globalOptions.format, result.run.judges);
|
|
8482
|
-
writeRunLink(globalOptions.format, webOrigin, {
|
|
8483
|
-
projectId: result.project.id,
|
|
8484
|
-
suiteId: result.run.suiteId,
|
|
8485
|
-
runId: result.run.id
|
|
8486
|
-
});
|
|
8487
8808
|
writeEvalDecisionSummary(
|
|
8488
8809
|
globalOptions.format,
|
|
8489
8810
|
decisionSummary,
|
|
8490
8811
|
process.stdout
|
|
8491
8812
|
);
|
|
8813
|
+
writeRunLink(globalOptions.format, webOrigin, {
|
|
8814
|
+
projectId: result.project.id,
|
|
8815
|
+
suiteId: result.run.suiteId,
|
|
8816
|
+
runId: result.run.id
|
|
8817
|
+
});
|
|
8492
8818
|
}
|
|
8493
8819
|
);
|
|
8494
8820
|
addProjectOption(
|
|
@@ -8596,10 +8922,10 @@ function registerEvalCommands(program) {
|
|
|
8596
8922
|
);
|
|
8597
8923
|
}
|
|
8598
8924
|
);
|
|
8599
|
-
addProjectOption(
|
|
8925
|
+
const gateCommand = addProjectOption(
|
|
8600
8926
|
evals.command("gate").description(
|
|
8601
|
-
"Apply a pass/fail policy to a finished eval run and set an exit code (0 pass, 1 eval failure, 2 usage, 3 incomplete)"
|
|
8602
|
-
).
|
|
8927
|
+
"Apply a pass/fail policy to a finished eval run and set an exit code (0 pass or waived, 1 eval failure, 2 usage, 3 incomplete)"
|
|
8928
|
+
).option("--run <id>", "Eval run ID (from `eval run`)")
|
|
8603
8929
|
).option(
|
|
8604
8930
|
"--min-pass-rate-percent <0-100>",
|
|
8605
8931
|
"Minimum share of iterations that must pass, as a percentage"
|
|
@@ -8618,19 +8944,22 @@ function registerEvalCommands(program) {
|
|
|
8618
8944
|
[]
|
|
8619
8945
|
).option(
|
|
8620
8946
|
"--baseline <runId>",
|
|
8621
|
-
"Baseline run ID to gate a regression delta against
|
|
8947
|
+
"Baseline run ID to gate a regression delta against; mutually exclusive with --baseline-sha"
|
|
8948
|
+
).option(
|
|
8949
|
+
"--baseline-sha <sha>",
|
|
8950
|
+
"Baseline source commit SHA, resolved to the completed run in this suite recorded against it; mutually exclusive with --baseline"
|
|
8622
8951
|
).option(
|
|
8623
8952
|
"--min-sample-size <n>",
|
|
8624
|
-
"Iterations required on EACH side before a pass-rate regression is decidable (default 5); requires --baseline"
|
|
8953
|
+
"Iterations required on EACH side before a pass-rate regression is decidable (default 5); requires --baseline or --baseline-sha"
|
|
8625
8954
|
).option(
|
|
8626
8955
|
"--min-effect-size-percent <0-100>",
|
|
8627
|
-
"Smallest pass-rate drop worth failing on, as a percentage (default 1); requires --baseline"
|
|
8956
|
+
"Smallest pass-rate drop worth failing on, as a percentage (default 1); requires --baseline or --baseline-sha"
|
|
8628
8957
|
).option(
|
|
8629
8958
|
"--gate-deterministic-regressions",
|
|
8630
|
-
"Fail if a deterministic gating scorer flipped from passed to failed; requires --baseline"
|
|
8959
|
+
"Fail if a deterministic gating scorer flipped from passed to failed; requires --baseline or --baseline-sha"
|
|
8631
8960
|
).option(
|
|
8632
8961
|
"--max-p95-latency-increase-ms <ms>",
|
|
8633
|
-
"Fail if p95 end-to-end latency rose by more than this many milliseconds vs the baseline; requires --baseline"
|
|
8962
|
+
"Fail if p95 end-to-end latency rose by more than this many milliseconds vs the baseline; requires --baseline or --baseline-sha"
|
|
8634
8963
|
).option("--wait", "Poll until the run reaches a terminal status").option(
|
|
8635
8964
|
"--wait-timeout <ms>",
|
|
8636
8965
|
"Give up waiting after this many milliseconds (default 600000)"
|
|
@@ -8645,13 +8974,35 @@ function registerEvalCommands(program) {
|
|
|
8645
8974
|
await runEvalGate(options, command);
|
|
8646
8975
|
}
|
|
8647
8976
|
);
|
|
8977
|
+
gateCommand.command("waive").description(
|
|
8978
|
+
"Override a FAILING run's gate until an expiry you name. Does not make the run pass: the run keeps its result, and the waiver is named in every report and check."
|
|
8979
|
+
).requiredOption(
|
|
8980
|
+
"--reason <text>",
|
|
8981
|
+
`Why the gate is being overridden (max ${GATE_WAIVER_MAX_REASON_LENGTH} characters). ${GATE_WAIVER_REASON_NOTICE}`
|
|
8982
|
+
).requiredOption(
|
|
8983
|
+
"--expires-in <duration>",
|
|
8984
|
+
"How long the waiver lasts, e.g. 30m, 12h, 7d. Capped at 30 days by the platform \u2014 there is no permanent waiver."
|
|
8985
|
+
).action(async (options, command) => {
|
|
8986
|
+
await runEvalGateWaive(options, command);
|
|
8987
|
+
});
|
|
8988
|
+
gateCommand.command("unwaive").description(
|
|
8989
|
+
"Revoke a gate waiver, putting the gate and the GitHub Check Run back. Idempotent."
|
|
8990
|
+
).option(
|
|
8991
|
+
"--waiver <id>",
|
|
8992
|
+
"Waiver ID to revoke. Omit to revoke the waiver currently in force over --run."
|
|
8993
|
+
).action(async (options, command) => {
|
|
8994
|
+
await runEvalGateUnwaive(options, command);
|
|
8995
|
+
});
|
|
8648
8996
|
addProjectOption(
|
|
8649
8997
|
evals.command("compare").description(
|
|
8650
8998
|
"Compare a finished eval run against a baseline and set an exit code (0 pass, 1 regression, 2 usage, 3 incomplete)"
|
|
8651
8999
|
).requiredOption("--run <id>", "Eval run ID to compare")
|
|
8652
9000
|
).option(
|
|
8653
9001
|
"--base-run <id>",
|
|
8654
|
-
"Baseline run ID (defaults to the nearest earlier completed run in the same suite)"
|
|
9002
|
+
"Baseline run ID (defaults to the nearest earlier completed run in the same suite); mutually exclusive with --base-sha"
|
|
9003
|
+
).option(
|
|
9004
|
+
"--base-sha <sha>",
|
|
9005
|
+
"Baseline source commit SHA, resolved to the completed run in this suite recorded against it; mutually exclusive with --base-run"
|
|
8655
9006
|
).option(
|
|
8656
9007
|
"--gate-regressions",
|
|
8657
9008
|
"Fail on a statistically significant pass-rate regression"
|