@gate-forge/cli 0.21.1 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/commands/test-gates.d.ts +0 -11
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +8 -192
- package/dist/commands/test-gates.js.map +1 -1
- package/dist/reseal.d.ts +0 -32
- package/dist/reseal.d.ts.map +1 -1
- package/dist/reseal.js +0 -32
- package/dist/reseal.js.map +1 -1
- package/guides/QUICKSTART.md +5 -5
- package/guides/REFERENCE.md +65 -7
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.22.1
|
|
4
|
+
|
|
5
|
+
- **Fixed: `test-gates --scope changed` refuses with exit 2 when the change
|
|
6
|
+
set maps to no runnable slice.** Nothing is executed, no receipt is
|
|
7
|
+
sealed, and the previous receipt is invalidated; the run no longer exits 0
|
|
8
|
+
on a parent's carried counts. A docs-only changed set still seals the
|
|
9
|
+
zero-record docs-only receipt.
|
|
10
|
+
- **Fixed: the capability reference no longer marks `crud:*` fail-closed.**
|
|
11
|
+
The namespace grades through the engine-owned browser drive (an
|
|
12
|
+
engine-observed `ui.action` plus the witnessed session exchange, a
|
|
13
|
+
session-bound visible result, and a persistence echo); a suite-posted
|
|
14
|
+
`ui.action` never earns browser credit, and the reference says so.
|
|
15
|
+
- **Fixed: the reference states the three file scopes a run reads (candidate
|
|
16
|
+
tree, input digest, detector input) and the fail-closed drift rule, with a
|
|
17
|
+
run-scoped recipe (`PYTEST_ADDOPTS='-p no:cacheprovider'
|
|
18
|
+
PYTHONDONTWRITEBYTECODE=1`) that keeps pytest cache and bytecode files out
|
|
19
|
+
of the candidate tree.**
|
|
20
|
+
|
|
21
|
+
## 0.22.0
|
|
22
|
+
|
|
23
|
+
- **Added: wrapper verb from a call-site `method` option.**
|
|
24
|
+
`scan.httpClients.wrapperFunctions[].methodOption` names the wrapper
|
|
25
|
+
parameter whose `method` property carries the verb. A literal is the
|
|
26
|
+
verb, a missing option is the entry's `method`, and anything else is
|
|
27
|
+
`HTTP_METHOD_DYNAMIC`. Existing entries are unaffected.
|
|
28
|
+
|
|
3
29
|
## 0.21.1
|
|
4
30
|
|
|
5
31
|
- **Fixed: pack-sqlalchemy discover waits up to 10 minutes before the plugin is killed.**
|
|
@@ -274,17 +274,6 @@ export interface NamedTestSelection {
|
|
|
274
274
|
export declare function resolveTestSelectors(selectors: readonly string[], rows: readonly {
|
|
275
275
|
logicalKey: string;
|
|
276
276
|
}[]): NamedTestSelection[];
|
|
277
|
-
/**
|
|
278
|
-
* Resolves the exact merge-base commit from a supported CI diff provider.
|
|
279
|
-
*
|
|
280
|
-
* Args:
|
|
281
|
-
* io: process context with CI provider environment.
|
|
282
|
-
* provider: configured changed-file provider identity.
|
|
283
|
-
*
|
|
284
|
-
* Returns:
|
|
285
|
-
* string | null: verified 40-character base commit, or null when unavailable.
|
|
286
|
-
*/
|
|
287
|
-
export declare function resolveCarryForwardBaseSha(io: Io, provider: 'github-pr' | 'gitlab-mr' | 'local-staged' | 'all-files'): string | null;
|
|
288
277
|
/** The sealed parent a re-seal carries from, and what it proved. */
|
|
289
278
|
export interface ResealParent {
|
|
290
279
|
/** Which kind of document the parent is: a gate receipt or a run record. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-gates.d.ts","sourceRoot":"","sources":["../../src/commands/test-gates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"test-gates.d.ts","sourceRoot":"","sources":["../../src/commands/test-gates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAC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E,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiJhG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,aAAa,EAAE,CAajB;AAwiID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,eAAe,GAAG,IAAI,EACvC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GACrC,MAAM,CAgDR;AAkID;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB/F;AAqFD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,OAAO,GAAG,IAAI,EACvB,eAAe,EAAE,eAAe,GAAG,IAAI,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA8B1B"}
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
* EVIDENCE_SCOPE_INCOMPLETE block, and an empty slice seals nothing.
|
|
54
54
|
* Without the flag the mode stays `full` — byte-identical behavior.
|
|
55
55
|
*/
|
|
56
|
-
import { spawn
|
|
56
|
+
import { spawn } from 'node:child_process';
|
|
57
57
|
import { createHash, randomUUID } from 'node:crypto';
|
|
58
58
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
|
|
59
59
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
@@ -67,7 +67,7 @@ import { UsageError } from '../errors.js';
|
|
|
67
67
|
import { writeLine } from '../io.js';
|
|
68
68
|
import { runDiagnosticSuites, runWitnessedPytestSuites } from '../diagnostics.js';
|
|
69
69
|
import { claimInjectionsFor, planScopedExpectedSet, trustedPolicyDigestForConfig, issueGateReceipt, issueRunRecord, parentSha, planExpectedSet, plannedProjectScopes, plannedRowsWithProjectDependencies, sealExecutionResult, supervisionBlocking, SUPERVISED_INVOCATION, } from '../execution.js';
|
|
70
|
-
import { evaluateRun, scopeBlocking
|
|
70
|
+
import { evaluateRun, scopeBlocking } from '../evaluate.js';
|
|
71
71
|
import { businessRuleInventory, businessRuleReportEntries, businessRuleRunFacts, gradeBusinessRules, partitionBusinessRuleEntries, witnessedRunnersOf, } from '../business-rules.js';
|
|
72
72
|
import { bindPageRouteParams, createdEntityIdsFromRecords, pageReportEntries } from '../page-obligations.js';
|
|
73
73
|
import { installedPlaywrightCompatibilityError } from '../package-compatibility.js';
|
|
@@ -77,15 +77,15 @@ import { collectInputFiles, computeInputSnapshot, diffInputFiles, SnapshotUnavai
|
|
|
77
77
|
import { findRunnerConfigPath, mappingBlocking, mappedCoverageFrom, nativeInventoryBlocking, nativeInventoryProblem, observeObligationIds, resolveRepositoryMappings, serverE2eObligationIds, TEST_MAP_RELATIVE } from '../mapping.js';
|
|
78
78
|
import { runPipeline, sourcesByResourceId } from '../pipeline.js';
|
|
79
79
|
import { loadReceiptFor, receiptScope, tryReuseReceipt } from '../receipts.js';
|
|
80
|
-
import {
|
|
80
|
+
import { classifyResealChange, parentCommitAcceptance, resealDisregardNotice, RESEAL_REFUSAL_SUFFIX, resealRefusal } from '../reseal.js';
|
|
81
81
|
import { authenticateContributingEvidence, carriedEvidenceDigestOf, carriedEvidenceDocuments, carriedTestIdentities, clearRetainedParentEvidence, readRetainedParentEvidence, readRunAttestation, stringField, writeRetainedParentEvidence, } from '../reseal-evidence.js';
|
|
82
82
|
import { clearResealChain, RESEAL_CHAIN_MAX_HOPS, resealChainHopCount, retainedChainCarriedTests, retainedEvidenceContributors, writeResealChainHop, writeResealChainParentEvidence, } from '../reseal-chain.js';
|
|
83
83
|
import { obligationFingerprint } from '../evaluate.js';
|
|
84
84
|
import { computeEvaluationScope } from '../scope.js';
|
|
85
|
-
import { candidateTreeCoversCommit, computeCandidateTreeSnapshot, listTrackedPaths, resolveGitDir
|
|
85
|
+
import { candidateTreeCoversCommit, computeCandidateTreeSnapshot, listTrackedPaths, resolveGitDir } from '../candidate-tree.js';
|
|
86
86
|
import { acceptedFreezeRequest, classifyGeneratedTargets, planNativeFreeze, preparedCandidateViolations, unfrozenPrerequisiteState, } from '../native-freeze.js';
|
|
87
87
|
import { loadRuntimeConfigAt, resolveRuntimeReuseDigest } from '../runtime.js';
|
|
88
|
-
import { mergeRequestScopePreflight,
|
|
88
|
+
import { mergeRequestScopePreflight, resolveProvider } from '../providers.js';
|
|
89
89
|
import { engineIdentity, reportEngineLine } from '../engine-identity.js';
|
|
90
90
|
import { assertReceiptApprovedPolicy, evaluateApprovedPolicy, resolveApprovedPolicyDigest } from '../trusted-policy.js';
|
|
91
91
|
import { resolveAdditionalAppOrigins } from '../additional-app-origins.js';
|
|
@@ -961,35 +961,6 @@ export function resolveTestSelectors(selectors, rows) {
|
|
|
961
961
|
return { selector, logicalKeys: candidates };
|
|
962
962
|
});
|
|
963
963
|
}
|
|
964
|
-
/**
|
|
965
|
-
* Resolves the exact merge-base commit from a supported CI diff provider.
|
|
966
|
-
*
|
|
967
|
-
* Args:
|
|
968
|
-
* io: process context with CI provider environment.
|
|
969
|
-
* provider: configured changed-file provider identity.
|
|
970
|
-
*
|
|
971
|
-
* Returns:
|
|
972
|
-
* string | null: verified 40-character base commit, or null when unavailable.
|
|
973
|
-
*/
|
|
974
|
-
export function resolveCarryForwardBaseSha(io, provider) {
|
|
975
|
-
if (provider === 'gitlab-mr') {
|
|
976
|
-
const sha = io.env['CI_MERGE_REQUEST_DIFF_BASE_SHA']?.trim() ?? '';
|
|
977
|
-
return /^[0-9a-f]{40}$/.test(sha) ? sha : null;
|
|
978
|
-
}
|
|
979
|
-
if (provider !== 'github-pr')
|
|
980
|
-
return null;
|
|
981
|
-
const authorityEnv = sanitizedAuthorityEnv(io.env);
|
|
982
|
-
const baseCommit = resolveGithubBaseCommit(io.cwd, io.env['GITHUB_BASE_REF'] ?? '', authorityEnv);
|
|
983
|
-
if (baseCommit === null)
|
|
984
|
-
return null;
|
|
985
|
-
const result = spawnSync('git', ['--no-replace-objects', 'merge-base', 'HEAD', baseCommit], {
|
|
986
|
-
cwd: io.cwd,
|
|
987
|
-
env: authorityEnv,
|
|
988
|
-
encoding: 'utf8',
|
|
989
|
-
});
|
|
990
|
-
const sha = (result.stdout ?? '').trim();
|
|
991
|
-
return result.error === undefined && result.status === 0 && /^[0-9a-f]{40}$/.test(sha) ? sha : null;
|
|
992
|
-
}
|
|
993
964
|
/**
|
|
994
965
|
* Builds a refusal naming the first binding that failed.
|
|
995
966
|
*
|
|
@@ -1198,18 +1169,6 @@ function receiptLoadRefusal(status) {
|
|
|
1198
1169
|
return 'it is bound to a different run than this one';
|
|
1199
1170
|
return 'it does not describe a whole-suite run of this repository';
|
|
1200
1171
|
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Authenticates a clean full-scope receipt for the exact merge-base commit.
|
|
1203
|
-
*
|
|
1204
|
-
* Args:
|
|
1205
|
-
* input: candidate policy, external pin, key ring, state directory, and merge base.
|
|
1206
|
-
*
|
|
1207
|
-
* Returns:
|
|
1208
|
-
* VerifiedCarryForwardParent | null: verified uncarried root receipt, or null to keep current behavior.
|
|
1209
|
-
*/
|
|
1210
|
-
function verifiedCarryForwardParent(input) {
|
|
1211
|
-
return verifyCarryForwardParent(input).parent;
|
|
1212
|
-
}
|
|
1213
1172
|
/**
|
|
1214
1173
|
* Authenticates the run record a FAILED whole-suite run left behind as
|
|
1215
1174
|
* the re-seal parent. A failing run seals no receipt (and clears the
|
|
@@ -2839,34 +2798,14 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
2839
2798
|
writeLine(io.stderr, `reused receipt ${reuse.receipt.receiptId} (identical authenticated inputs; complete result)`);
|
|
2840
2799
|
return gateCode;
|
|
2841
2800
|
}
|
|
2842
|
-
// 3.5 Scoped empty-slice
|
|
2801
|
+
// 3.5 Scoped empty-slice refusal (Goal 2): when the changed set maps
|
|
2843
2802
|
// to no testable slice there is nothing to run and nothing to seal —
|
|
2844
2803
|
// and launching the runner with an empty planned set would execute the
|
|
2845
2804
|
// WHOLE suite (the trusted config's file filter is omitted for empty
|
|
2846
2805
|
// selections). Fail closed here, before any witness/runner spawn: no
|
|
2847
2806
|
// slice receipt over nothing is ever minted, and the previous receipt
|
|
2848
|
-
// is invalidated (E07 discipline).
|
|
2807
|
+
// is invalidated (E07 discipline); this refusal exits 2.
|
|
2849
2808
|
if (options.scope === 'changed' && plannedRows.length === 0) {
|
|
2850
|
-
const baseSha = resolveCarryForwardBaseSha(io, providerIdentity);
|
|
2851
|
-
const carryParent = !options.resultOnly &&
|
|
2852
|
-
expectedDigest !== null &&
|
|
2853
|
-
frozenTreeId !== null &&
|
|
2854
|
-
approvedPolicyDigest !== null &&
|
|
2855
|
-
baseSha !== null
|
|
2856
|
-
? verifiedCarryForwardParent({
|
|
2857
|
-
io,
|
|
2858
|
-
config,
|
|
2859
|
-
stateDir,
|
|
2860
|
-
verifierKeyring,
|
|
2861
|
-
baseSha,
|
|
2862
|
-
gitDir: freezeGitDir,
|
|
2863
|
-
docsExclusions,
|
|
2864
|
-
cacheExclusions,
|
|
2865
|
-
trustedPolicyDigest: trustedPolicy,
|
|
2866
|
-
approvedPolicyDigest,
|
|
2867
|
-
executionBoundaryDigest,
|
|
2868
|
-
})
|
|
2869
|
-
: null;
|
|
2870
2809
|
const playwrightConfig = findRunnerConfigPath(io.cwd, runnerName);
|
|
2871
2810
|
const scopeDecision = catalog === null
|
|
2872
2811
|
? null
|
|
@@ -2880,129 +2819,6 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
2880
2819
|
strictE2E: false,
|
|
2881
2820
|
});
|
|
2882
2821
|
const behaviorBindings = behaviorReceiptBindings(pipeline.behaviorCatalog);
|
|
2883
|
-
const scannedEveryChangedFile = providerChangedFiles.length > 0 &&
|
|
2884
|
-
config.plugins.length > 0 &&
|
|
2885
|
-
pipeline.contributions.length === config.plugins.length &&
|
|
2886
|
-
providerChangedFiles.every((path) => pipeline.contributions.every((contribution) => contribution.scannedPaths?.includes(path) === true));
|
|
2887
|
-
// A sealed candidate tree carries gitignored and untracked bytes,
|
|
2888
|
-
// so a verified parent proves the outcomes for ITS bytes. The
|
|
2889
|
-
// plain carry-forward evaluates only the provider's changed files,
|
|
2890
|
-
// so it may reuse the parent's outcomes exclusively when the two
|
|
2891
|
-
// sealed trees differ in nothing else — a gitignored dependency or
|
|
2892
|
-
// an untracked file would be a proof nobody produced. (The re-seal
|
|
2893
|
-
// path needs no such test: it classifies the whole difference.)
|
|
2894
|
-
const carryDiffWithinScope = carryParent !== null &&
|
|
2895
|
-
frozenTreeId !== null &&
|
|
2896
|
-
freezeGitDir !== null &&
|
|
2897
|
-
scopeDecision !== null &&
|
|
2898
|
-
carryDiffIsWithinScope({
|
|
2899
|
-
gitDir: freezeGitDir,
|
|
2900
|
-
env: io.env,
|
|
2901
|
-
parentTreeId: carryParent.treeId,
|
|
2902
|
-
currentTreeId: frozenTreeId,
|
|
2903
|
-
evaluatedPaths: scopeDecision.changedFiles,
|
|
2904
|
-
});
|
|
2905
|
-
// The policy-debt term reads the ADOPTED-baseline view, not the raw
|
|
2906
|
-
// one. What a carry-forward must never seal over is NEW debt, and the
|
|
2907
|
-
// raw list cannot express that: in a repository that ran `gateforge
|
|
2908
|
-
// adopt` it holds the adopted classification, finding, unclassified
|
|
2909
|
-
// and unresolved entries forever, so the term denied the carry there
|
|
2910
|
-
// altogether. The split keeps the protection and drops only what
|
|
2911
|
-
// adoption forgave — an entry adoption never recorded still blocks —
|
|
2912
|
-
// and it is the same split `applyBaseline` grades through, so the guard
|
|
2913
|
-
// and the grading cannot disagree about what debt is forgiven.
|
|
2914
|
-
const unadoptedPolicyBlocking = splitBlockingByBaseline(adoptedBaseline, pipeline.policy.blocking).kept;
|
|
2915
|
-
// A planned re-seal is never a carry-forward: it re-runs the
|
|
2916
|
-
// affected tests and seals its own receipt. `affectedTestCount`
|
|
2917
|
-
// is the CHANGED-SCOPE plan's count, which a test-only change
|
|
2918
|
-
// leaves at zero — exactly the case this path would swallow.
|
|
2919
|
-
const carryIsSafe = reSealPlan === null &&
|
|
2920
|
-
carryParent !== null &&
|
|
2921
|
-
expectedDigest !== null &&
|
|
2922
|
-
frozenTreeId !== null &&
|
|
2923
|
-
pipeline.manifest.gitSha !== null &&
|
|
2924
|
-
catalog?.inventoryComplete === true &&
|
|
2925
|
-
discoveryError === null &&
|
|
2926
|
-
scopeDecision?.mode === 'changed' &&
|
|
2927
|
-
scopeDecision.expandedBecause.length === 0 &&
|
|
2928
|
-
scopeDecision.unmappedFiles.length === 0 &&
|
|
2929
|
-
carryDiffWithinScope &&
|
|
2930
|
-
coveredFingerprints.length === 0 &&
|
|
2931
|
-
affectedTestCount === 0 &&
|
|
2932
|
-
scopeBlockers.length === 0 &&
|
|
2933
|
-
mappingBlockers.length === 0 &&
|
|
2934
|
-
inventoryBlocking.length === 0 &&
|
|
2935
|
-
unadoptedPolicyBlocking.length === 0 &&
|
|
2936
|
-
(config.diagnostics?.suites.length ?? 0) === 0 &&
|
|
2937
|
-
pipeline.policy.obligations.length === carryParent.receipt.verdictSummary.total &&
|
|
2938
|
-
carryParent.receipt.behaviorCatalogDigest === behaviorBindings.behaviorCatalogDigest &&
|
|
2939
|
-
carryParent.receipt.requiredCaseSetDigest === behaviorBindings.requiredCaseSetDigest &&
|
|
2940
|
-
scannedEveryChangedFile;
|
|
2941
|
-
const activeVerifierKeyring = verifierKeyring;
|
|
2942
|
-
if (carryIsSafe &&
|
|
2943
|
-
activeVerifierKeyring !== null &&
|
|
2944
|
-
baseSha !== null &&
|
|
2945
|
-
pipeline.manifest.gitSha !== null &&
|
|
2946
|
-
freezeGitDir !== null &&
|
|
2947
|
-
carryParent !== null &&
|
|
2948
|
-
expectedDigest !== null &&
|
|
2949
|
-
frozenTreeId !== null) {
|
|
2950
|
-
const candidateSnapshot = computeCandidateTreeSnapshot(freezeGitDir, io.cwd, io.env, stateDir, 'record', runtimeReuseMounts, docsExclusions, cacheExclusions);
|
|
2951
|
-
if (candidateSnapshot.treeId === frozenTreeId) {
|
|
2952
|
-
const carried = issueGateReceipt({
|
|
2953
|
-
verifierKey: activeVerifierKeyring.active.key,
|
|
2954
|
-
verifierKeyId: activeVerifierKeyring.active.keyId,
|
|
2955
|
-
runId: carryParent.receipt.runId,
|
|
2956
|
-
invocationId: carryParent.receipt.invocationId,
|
|
2957
|
-
inputDigest: expectedDigest,
|
|
2958
|
-
gitSha: pipeline.manifest.gitSha,
|
|
2959
|
-
parentSha: baseSha,
|
|
2960
|
-
trustedPolicyDigest: trustedPolicy,
|
|
2961
|
-
approvedPolicyDigest,
|
|
2962
|
-
receiptStage: config.enforcement?.receiptStage,
|
|
2963
|
-
engine: engineIdentity(),
|
|
2964
|
-
carriedFrom: baseSha,
|
|
2965
|
-
parentReceiptDigest: carryParent.receiptDigest,
|
|
2966
|
-
invocation: carryParent.receipt.invocation,
|
|
2967
|
-
selectionDigest: carryParent.receipt.selectionDigest,
|
|
2968
|
-
catalogDigest: carryParent.receipt.catalogDigest,
|
|
2969
|
-
executionResultDigest: carryParent.receipt.executionResultDigest,
|
|
2970
|
-
evidenceAttestationDigest: carryParent.receipt.evidenceAttestationDigest,
|
|
2971
|
-
candidateTreeId: frozenTreeId,
|
|
2972
|
-
behaviorCatalogDigest: behaviorBindings.behaviorCatalogDigest,
|
|
2973
|
-
requiredCaseSetDigest: behaviorBindings.requiredCaseSetDigest,
|
|
2974
|
-
caseExecutionDigest: carryParent.receipt.caseExecutionDigest,
|
|
2975
|
-
engineBundleDigest: engineBundleDigestOf(VERSION, trustedPolicy),
|
|
2976
|
-
executionBoundaryDigest,
|
|
2977
|
-
targetArtifactDigest: targetArtifactDigestOf(frozenTreeId),
|
|
2978
|
-
verdictSummary: carryParent.receipt.verdictSummary,
|
|
2979
|
-
issuedAt: pipeline.now,
|
|
2980
|
-
});
|
|
2981
|
-
const carryReport = canonicalJson({
|
|
2982
|
-
schemaVersion: 1,
|
|
2983
|
-
carriedForward: true,
|
|
2984
|
-
carriedFrom: baseSha,
|
|
2985
|
-
parentReceiptDigest: carryParent.receiptDigest,
|
|
2986
|
-
receiptId: carried.receiptId,
|
|
2987
|
-
candidateTreeId: frozenTreeId,
|
|
2988
|
-
inputDigest: expectedDigest,
|
|
2989
|
-
scope: 'changed',
|
|
2990
|
-
changedFiles: [...providerChangedFiles],
|
|
2991
|
-
testsPerformedThisInvocation: 0,
|
|
2992
|
-
summary: carryParent.receipt.verdictSummary,
|
|
2993
|
-
evidenceState: 'receipt-carried-forward',
|
|
2994
|
-
engine: { ...engineIdentity() },
|
|
2995
|
-
});
|
|
2996
|
-
writeGateReceipt(stateDir, carried);
|
|
2997
|
-
writeCandidateTreeEntries(stateDir, candidateSnapshot.entries);
|
|
2998
|
-
writeReport(stateDir, carryReport);
|
|
2999
|
-
writeLine(io.stdout, format === 'json'
|
|
3000
|
-
? carryReport
|
|
3001
|
-
: `receipt ${carried.receiptId} carried forward from ${baseSha}; 0 tests run; full parent receipt and complete changed-file scan verified`);
|
|
3002
|
-
writeLine(io.stderr, `receipt ${carried.receiptId} carried forward; 0 tests performed this invocation`);
|
|
3003
|
-
return 0;
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
2822
|
if (!options.resultOnly)
|
|
3007
2823
|
clearGateReceipt(stateDir);
|
|
3008
2824
|
// 0.10.2 — the docs-only slice seals a receipt over ZERO records.
|
|
@@ -3242,7 +3058,7 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
3242
3058
|
});
|
|
3243
3059
|
writeLine(io.stdout, report);
|
|
3244
3060
|
writeLine(io.stderr, 'test-gates: --scope changed produced no runnable slice — nothing was executed and no receipt was sealed');
|
|
3245
|
-
return
|
|
3061
|
+
return 2;
|
|
3246
3062
|
}
|
|
3247
3063
|
// 4. Prepare the observer: spawn the loopback witness (unless the
|
|
3248
3064
|
// caller wired one), adopt identities, bind the trusted context, and
|