@codyswann/lisa 5.2.3 → 5.3.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/all/copy-overwrite/scripts/lib/automation-provenance-contract.mjs +38 -2
- package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +13 -9
- package/all/copy-overwrite/scripts/lib/github-attestation-recovery.mjs +12 -1
- package/all/copy-overwrite/scripts/lib/github-attestation-verifier.mjs +40 -3
- package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +9 -4
- package/all/copy-overwrite/scripts/lib/npm-update-cancel-origin.mjs +1 -1
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation-proof.mjs +16 -5
- package/all/copy-overwrite/scripts/lib/npm-update-cancellation.mjs +23 -6
- package/all/copy-overwrite/scripts/lib/npm-update-contract.mjs +9 -3
- package/all/copy-overwrite/scripts/lib/npm-update-controller-factory.mjs +4 -2
- package/all/copy-overwrite/scripts/lib/npm-update-gh-requests.mjs +5 -1
- package/all/copy-overwrite/scripts/lib/npm-update-github.mjs +28 -6
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-gate.mjs +6 -2
- package/all/copy-overwrite/scripts/lib/npm-update-hosted-scope.mjs +2 -2
- package/all/copy-overwrite/scripts/lib/npm-update-invariants.mjs +2 -0
- package/all/copy-overwrite/scripts/lib/npm-update-leaf-contract.mjs +31 -16
- package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +3 -3
- package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +40 -4
- package/all/copy-overwrite/scripts/lib/npm-update-publication.mjs +15 -4
- package/all/copy-overwrite/scripts/lib/npm-update-publish.mjs +2 -1
- package/all/copy-overwrite/scripts/lib/npm-update-quality.mjs +29 -6
- package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +3 -0
- package/all/copy-overwrite/scripts/lib/npm-update-supersession.mjs +1 -1
- package/all/copy-overwrite/scripts/lisa-automation-provenance.mjs +7 -1
- package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +46 -1
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +28 -25
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +56 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +33 -27
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/scripts/lib/phrase-tests/marker-classes.mjs +6 -6
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/** Pure environment, lifecycle and fixed Task data cannot import live claim or quality orchestration. */
|
|
5
5
|
import { canonicalJson } from "../lisa-automation-provenance.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
required,
|
|
8
|
+
DEFAULT_TARGET,
|
|
9
|
+
policyTarget,
|
|
10
|
+
} from "./npm-update-contract.mjs";
|
|
7
11
|
import {
|
|
8
12
|
trackerContract,
|
|
9
13
|
deployBranchEnvironments,
|
|
@@ -51,13 +55,13 @@ function vendorRoles(config, repository) {
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
/** Immutable host config, not candidate data or local aliases, chooses lifecycle. */
|
|
54
|
-
export function leafRoles(config, repository) {
|
|
58
|
+
export function leafRoles(config, repository, target = DEFAULT_TARGET) {
|
|
55
59
|
const held =
|
|
56
60
|
config.tracker === "jira" || config.tracker === "linear"
|
|
57
61
|
? vendorRoles(config, repository)
|
|
58
62
|
: githubRoles(config, repository);
|
|
59
63
|
const contract = trackerContract(config);
|
|
60
|
-
const targetEnvironment = environment(config);
|
|
64
|
+
const targetEnvironment = environment(config, target);
|
|
61
65
|
const terminal =
|
|
62
66
|
contract.lifecycle.done.find(([name]) => name === targetEnvironment)?.[1] ??
|
|
63
67
|
contract.lifecycle.terminalName;
|
|
@@ -89,25 +93,36 @@ export function leafRoles(config, repository) {
|
|
|
89
93
|
};
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
/** Reuse the canonical default while refusing an explicitly ambiguous
|
|
93
|
-
export function environment(config) {
|
|
96
|
+
/** Reuse the canonical default while refusing an explicitly ambiguous target mapping. */
|
|
97
|
+
export function environment(config, branch = DEFAULT_TARGET) {
|
|
94
98
|
const matches = Object.entries(config.deploy?.branches ?? {}).filter(
|
|
95
|
-
([,
|
|
99
|
+
([, mapped]) => mapped === branch
|
|
96
100
|
);
|
|
97
101
|
required(
|
|
98
102
|
matches.length <= 1,
|
|
99
|
-
|
|
103
|
+
`${branch} requires one unambiguous configured runtime environment`
|
|
100
104
|
);
|
|
101
105
|
// The same map trackerContract exposes for GitHub/Linear; Jira's contract has none.
|
|
102
|
-
const target = deployBranchEnvironments(config).get(
|
|
103
|
-
required(target,
|
|
106
|
+
const target = deployBranchEnvironments(config).get(branch);
|
|
107
|
+
required(target, `${branch} has no configured runtime environment`);
|
|
104
108
|
return target;
|
|
105
109
|
}
|
|
106
110
|
|
|
111
|
+
/**
|
|
112
|
+
* main keeps its historical remote-default assumption byte for byte. Another
|
|
113
|
+
* target comes from the committed npmUpdater target, which the body names.
|
|
114
|
+
*/
|
|
115
|
+
export function environmentDeclaration(env, target) {
|
|
116
|
+
return target === DEFAULT_TARGET
|
|
117
|
+
? `Assumption: ${env} — remote default branch main`
|
|
118
|
+
: `Inferred: ${env} — evidence: body`;
|
|
119
|
+
}
|
|
120
|
+
|
|
107
121
|
/** A standalone, build-ready Task has complete implementation and terminal evidence. */
|
|
108
122
|
export function buildDraft(proposal, policy, config, evidence) {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
123
|
+
const target = policyTarget(policy);
|
|
124
|
+
const roles = leafRoles(config, policy.repository, target);
|
|
125
|
+
const env = environment(config, target);
|
|
111
126
|
const versions = proposal.updates
|
|
112
127
|
.map(update => `${update.name}: ${update.from} -> ${update.to}`)
|
|
113
128
|
.join("\n");
|
|
@@ -127,7 +142,7 @@ Proposal key: ${proposal.key}
|
|
|
127
142
|
Selection key: ${proposal.selectionKey}
|
|
128
143
|
Update exactly ${manifest} and ${lock}${bun ? " and bun.lock" : ""}:
|
|
129
144
|
${versions}
|
|
130
|
-
Use the trusted four-job npm updater. Preparation performs an installed-tree npm outdated check and npm ci with lifecycle scripts disabled. Allocation precedes the first attributed commit. Ordinary commit and original pre-push gates remain mandatory. Publish only the exact gated unsigned raw Git object with unchanged parent, tree, identities, times and message. Preserve every unrelated dependency, script and existing assignee. Stop on stale base, unavailable authorization, hold, failed gate or mismatching bytes. Lisa is excluded only with verified local full-apply ownership.
|
|
145
|
+
${target === DEFAULT_TARGET ? "" : `Target branch: ${target} (committed npmUpdater target; deploy.branches maps it to ${env}).\n`}Use the trusted four-job npm updater. Preparation performs an installed-tree npm outdated check and npm ci with lifecycle scripts disabled. Allocation precedes the first attributed commit. Ordinary commit and original pre-push gates remain mandatory. Publish only the exact gated unsigned raw Git object with unchanged parent, tree, identities, times and message. Preserve every unrelated dependency, script and existing assignee. Stop on stale base, unavailable authorization, hold, failed gate or mismatching bytes. Lisa is excluded only with verified local full-apply ownership.
|
|
131
146
|
|
|
132
147
|
## Acceptance Criteria
|
|
133
148
|
|
|
@@ -136,7 +151,7 @@ Scenario: publish one coherent dependency proposal
|
|
|
136
151
|
Given parent ${proposal.parent} and the selected versions above
|
|
137
152
|
When the trusted updater claims this leaf and completes ordinary gates
|
|
138
153
|
Then the manifest and lock agree and npm ci preserves both file hashes${bun ? " and frozen Bun preserves all three hashes" : ""}
|
|
139
|
-
And the pull request into
|
|
154
|
+
And the pull request into ${target} contains exactly the gated commit and ${bun ? "three" : "two"} files
|
|
140
155
|
Scenario: refuse unauthorized or stale publication
|
|
141
156
|
Given a hold, changed parent, failed gate or mismatching proposal
|
|
142
157
|
When publication is attempted
|
|
@@ -157,12 +172,12 @@ ${policy.repository}
|
|
|
157
172
|
|
|
158
173
|
## Target Backend Environment
|
|
159
174
|
|
|
160
|
-
|
|
175
|
+
${environmentDeclaration(env, target)}
|
|
161
176
|
|
|
162
177
|
## Branch Plan
|
|
163
178
|
|
|
164
|
-
Branch from:
|
|
165
|
-
PR into:
|
|
179
|
+
Branch from: ${target}
|
|
180
|
+
PR into: ${target}
|
|
166
181
|
Derived from: Target Backend Environment ${env} via .lisa.config.json deploy.branches
|
|
167
182
|
|
|
168
183
|
## Sign-in Required
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { canonicalClassifier } from "./npm-update-helper.mjs";
|
|
10
10
|
import { canonicalJson } from "../lisa-automation-provenance.mjs";
|
|
11
|
-
import { required, CLAIM, keys } from "./npm-update-contract.mjs";
|
|
11
|
+
import { required, CLAIM, keys, policyTarget } from "./npm-update-contract.mjs";
|
|
12
12
|
import { qualityGates } from "./npm-update-quality.mjs";
|
|
13
13
|
import { leafRoles } from "./npm-update-leaf-contract.mjs";
|
|
14
14
|
export {
|
|
@@ -85,7 +85,7 @@ export async function inspectCancelledLeaf(issue, draft, policy, config) {
|
|
|
85
85
|
|
|
86
86
|
/** Both fixed state entry points preserve the original complete ownership and hold checks. */
|
|
87
87
|
async function inspectLeafFields(issue, draft, policy, config) {
|
|
88
|
-
const roles = leafRoles(config, policy.repository);
|
|
88
|
+
const roles = leafRoles(config, policy.repository, policyTarget(policy));
|
|
89
89
|
const labels = issue.labels.map(label => label.name);
|
|
90
90
|
required(
|
|
91
91
|
issue.children.length === 0 &&
|
|
@@ -184,7 +184,7 @@ export async function authorizeAllocation(
|
|
|
184
184
|
config
|
|
185
185
|
) {
|
|
186
186
|
const tracker = trackerFor(api, policy, config);
|
|
187
|
-
await api.main(proposal.parent);
|
|
187
|
+
await api.main(proposal.parent, proposal.target);
|
|
188
188
|
await tracker.assignable(policy.maintainer);
|
|
189
189
|
const issue = await tracker.issue(allocation.number);
|
|
190
190
|
const state = await inspectLeaf(issue, allocation.draft, policy, config);
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
// Do not edit directly — durable changes belong upstream in Lisa.
|
|
3
3
|
|
|
4
4
|
/** Fixed npm policy validation shares the optional signed runtime contract without cycles. */
|
|
5
|
-
import { keys, required } from "./npm-update-invariants.mjs";
|
|
5
|
+
import { keys, operatorRefusal, required } from "./npm-update-invariants.mjs";
|
|
6
6
|
import { railsRuntime } from "./npm-update-rails-runtime-contract.mjs";
|
|
7
7
|
import { validDirectory } from "./automation-provenance-contract.mjs";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_TARGET,
|
|
10
|
+
validBranchName,
|
|
11
|
+
} from "./github-attestation-verifier.mjs";
|
|
8
12
|
|
|
9
13
|
export const NAME = /^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*$/;
|
|
10
14
|
export const VERSION =
|
|
@@ -49,13 +53,44 @@ function trackerScope(value, config) {
|
|
|
49
53
|
);
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
export { DEFAULT_TARGET, validBranchName };
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The branch every updater step reads, compares and opens its pull request
|
|
60
|
+
* against. An omitted target keeps main, so an existing policy's digest never moves.
|
|
61
|
+
*/
|
|
62
|
+
export function policyTarget(policy) {
|
|
63
|
+
return Object.hasOwn(policy ?? {}, "target") ? policy.target : DEFAULT_TARGET;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A non-main target must be a configured deploy branch: without that mapping the
|
|
68
|
+
* leaf's Target Backend Environment and Branch Plan cannot be derived. main keeps
|
|
69
|
+
* its historical check, which the leaf contract applies when it derives the env.
|
|
70
|
+
*/
|
|
71
|
+
function validateTarget(value, config) {
|
|
72
|
+
const target = policyTarget(value);
|
|
73
|
+
if (target === DEFAULT_TARGET) return;
|
|
74
|
+
required(validBranchName(target), "invalid npm updater target branch");
|
|
75
|
+
const allowed = [
|
|
76
|
+
...new Set(
|
|
77
|
+
Object.values(config.deploy?.branches ?? {}).filter(validBranchName)
|
|
78
|
+
),
|
|
79
|
+
];
|
|
80
|
+
if (!allowed.includes(target))
|
|
81
|
+
throw operatorRefusal(
|
|
82
|
+
"npm updater target is not a configured deploy branch",
|
|
83
|
+
`npmUpdater target "${target}" is not a .lisa.config.json deploy.branches value; allowed branches: ${allowed.join(", ") || "(none configured)"}.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
52
87
|
/** Configured tracking and an explicit owner are prerequisites, never inferred. */
|
|
53
88
|
export function validatePolicy(value, config) {
|
|
54
89
|
keys(value, [
|
|
55
90
|
"version",
|
|
56
91
|
"repository",
|
|
57
92
|
"directory",
|
|
58
|
-
"target",
|
|
93
|
+
...(Object.hasOwn(value ?? {}, "target") ? ["target"] : []),
|
|
59
94
|
"maintainer",
|
|
60
95
|
"packages",
|
|
61
96
|
"lisaOwner",
|
|
@@ -65,9 +100,10 @@ export function validatePolicy(value, config) {
|
|
|
65
100
|
required(
|
|
66
101
|
value.version === 1 &&
|
|
67
102
|
validDirectory(value.directory) &&
|
|
68
|
-
value
|
|
69
|
-
"only a committed npm directory on
|
|
103
|
+
typeof policyTarget(value) === "string",
|
|
104
|
+
"only a committed npm directory on a configured target branch is supported"
|
|
70
105
|
);
|
|
106
|
+
validateTarget(value, config);
|
|
71
107
|
required(
|
|
72
108
|
value.directory === "." ||
|
|
73
109
|
(value.lisaOwner === "absent" && !Object.hasOwn(value, "runtime")),
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/** Current-head checks and human approval retain their real integration and reviewer identities. @module npm-updater */
|
|
5
5
|
import { workItemLines } from "../lisa-work-item.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
required,
|
|
8
|
+
DEFAULT_TARGET,
|
|
9
|
+
policyTarget,
|
|
10
|
+
} from "./npm-update-contract.mjs";
|
|
7
11
|
import {
|
|
8
12
|
sha256,
|
|
9
13
|
verifyDescriptorAttestation,
|
|
@@ -154,7 +158,7 @@ export async function destinationSnapshot(api, proposal, allocation, commit) {
|
|
|
154
158
|
pr.head?.sha === commit &&
|
|
155
159
|
pr.head?.ref === branch &&
|
|
156
160
|
pr.head?.repo?.full_name === proposal.repository &&
|
|
157
|
-
pr.base?.ref ===
|
|
161
|
+
pr.base?.ref === policyTarget(proposal) &&
|
|
158
162
|
pr.base?.repo?.full_name === proposal.repository &&
|
|
159
163
|
pr.body === publicationBody(allocation),
|
|
160
164
|
"foreign/closed/changed proposal PR is preserved"
|
|
@@ -204,9 +208,16 @@ export function assertPublicationPolicy(value) {
|
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
/** Current-head success and real human approval cannot be supplied by stale/skip records. */
|
|
207
|
-
export function assertPublication(
|
|
211
|
+
export function assertPublication(
|
|
212
|
+
pr,
|
|
213
|
+
checks,
|
|
214
|
+
reviews,
|
|
215
|
+
sha,
|
|
216
|
+
requirements = [],
|
|
217
|
+
target = DEFAULT_TARGET
|
|
218
|
+
) {
|
|
208
219
|
required(
|
|
209
|
-
pr.state === "open" && pr.head?.sha === sha && pr.base?.ref ===
|
|
220
|
+
pr.state === "open" && pr.head?.sha === sha && pr.base?.ref === target,
|
|
210
221
|
"current-head PR differs"
|
|
211
222
|
);
|
|
212
223
|
required(
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
required,
|
|
8
8
|
validateProposal,
|
|
9
9
|
validateRawCommit,
|
|
10
|
+
policyTarget,
|
|
10
11
|
} from "./npm-update-contract.mjs";
|
|
11
12
|
import {
|
|
12
13
|
authorizeAllocation,
|
|
@@ -96,7 +97,7 @@ export async function publishDestination({
|
|
|
96
97
|
pr = await api.request(`${path}/pulls`, "POST", {
|
|
97
98
|
title: allocation.draft.title,
|
|
98
99
|
head: snapshot.branch,
|
|
99
|
-
base:
|
|
100
|
+
base: policyTarget(proposal),
|
|
100
101
|
body: publicationBody(allocation),
|
|
101
102
|
});
|
|
102
103
|
} else pr = await api.request(`${path}/pulls/${snapshot.prNumber}`);
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
// Do not edit directly — durable changes belong upstream in Lisa.
|
|
3
3
|
|
|
4
4
|
/** Twenty-five fixed writer checks retain semantic quality independently of storage. */
|
|
5
|
-
import { required } from "./npm-update-contract.mjs";
|
|
6
|
-
import {
|
|
5
|
+
import { required, policyTarget } from "./npm-update-contract.mjs";
|
|
6
|
+
import {
|
|
7
|
+
environment,
|
|
8
|
+
environmentDeclaration,
|
|
9
|
+
buildDraft,
|
|
10
|
+
} from "./npm-update-leaf-contract.mjs";
|
|
7
11
|
|
|
8
12
|
/** Core Task fields are validated independently of provider storage. */
|
|
9
13
|
function coreChecks(draft, body, policy) {
|
|
@@ -44,7 +48,10 @@ function runtimeChecks(body, config, policy, evidence) {
|
|
|
44
48
|
[
|
|
45
49
|
"S8",
|
|
46
50
|
body.includes(
|
|
47
|
-
|
|
51
|
+
environmentDeclaration(
|
|
52
|
+
environment(config, policyTarget(policy)),
|
|
53
|
+
policyTarget(policy)
|
|
54
|
+
)
|
|
48
55
|
),
|
|
49
56
|
"runtime target derived",
|
|
50
57
|
],
|
|
@@ -80,7 +87,15 @@ function runtimeChecks(body, config, policy, evidence) {
|
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
/** Declared evidence and fixed proposal fields must match actual prerequisite reads. */
|
|
83
|
-
function evidenceChecks(
|
|
90
|
+
function evidenceChecks(
|
|
91
|
+
draft,
|
|
92
|
+
body,
|
|
93
|
+
proposal,
|
|
94
|
+
expected,
|
|
95
|
+
config,
|
|
96
|
+
evidence,
|
|
97
|
+
policy
|
|
98
|
+
) {
|
|
84
99
|
return [
|
|
85
100
|
[
|
|
86
101
|
"S14",
|
|
@@ -97,7 +112,7 @@ function evidenceChecks(draft, body, proposal, expected, config, evidence) {
|
|
|
97
112
|
[
|
|
98
113
|
"S19",
|
|
99
114
|
body.includes(
|
|
100
|
-
`Derived from: Target Backend Environment ${environment(config)} via .lisa.config.json deploy.branches`
|
|
115
|
+
`Derived from: Target Backend Environment ${environment(config, policyTarget(policy))} via .lisa.config.json deploy.branches`
|
|
101
116
|
),
|
|
102
117
|
"actual main mapping",
|
|
103
118
|
],
|
|
@@ -127,7 +142,15 @@ export function qualityGates(draft, proposal, policy, config, evidence) {
|
|
|
127
142
|
const checks = [
|
|
128
143
|
...coreChecks(draft, body, policy),
|
|
129
144
|
...runtimeChecks(body, config, policy, evidence),
|
|
130
|
-
...evidenceChecks(
|
|
145
|
+
...evidenceChecks(
|
|
146
|
+
draft,
|
|
147
|
+
body,
|
|
148
|
+
proposal,
|
|
149
|
+
expected,
|
|
150
|
+
config,
|
|
151
|
+
evidence,
|
|
152
|
+
policy
|
|
153
|
+
),
|
|
131
154
|
];
|
|
132
155
|
required(
|
|
133
156
|
checks.every(([, passed]) => passed),
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
predictedCommit,
|
|
21
21
|
} from "./github-attestation-recovery.mjs";
|
|
22
22
|
import { persistCheckpoint } from "./npm-update-checkpoint.mjs";
|
|
23
|
+
import { targetField } from "./automation-provenance-contract.mjs";
|
|
23
24
|
import { required, validateProposal } from "./npm-update-contract.mjs";
|
|
24
25
|
import {
|
|
25
26
|
trackerFor,
|
|
@@ -69,6 +70,8 @@ export function recoveryRecord(
|
|
|
69
70
|
...snapshot,
|
|
70
71
|
runId: process.env.GITHUB_RUN_ID,
|
|
71
72
|
runAttempt: process.env.GITHUB_RUN_ATTEMPT,
|
|
73
|
+
// Only a non-main origin target is carried; the recovery certificate names that ref.
|
|
74
|
+
...targetField(d),
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -215,7 +215,7 @@ export async function recordedCancellation({
|
|
|
215
215
|
"cancellation subject digest differs"
|
|
216
216
|
);
|
|
217
217
|
await verifyRecordedBundle(api, authority, checkpoint, record, issue);
|
|
218
|
-
await api.main(proposal.parent);
|
|
218
|
+
await api.main(proposal.parent, proposal.target);
|
|
219
219
|
await cancellationDestinationAbsent(api, record.oldProposalKey);
|
|
220
220
|
if (issue.state === "closed")
|
|
221
221
|
required(
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
sha256,
|
|
18
18
|
verifyCurrentProvider,
|
|
19
19
|
verifyDescriptorAttestation,
|
|
20
|
+
targetBranch,
|
|
20
21
|
} from "./lib/github-attestation-verifier.mjs";
|
|
21
22
|
import {
|
|
22
23
|
canonicalJson,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
signedProposalFields,
|
|
26
27
|
directoryOf,
|
|
27
28
|
policyEntry,
|
|
29
|
+
assertCommittedTarget,
|
|
28
30
|
} from "./lib/automation-provenance-contract.mjs";
|
|
29
31
|
import {
|
|
30
32
|
git,
|
|
@@ -80,7 +82,8 @@ function recoveryPermission(
|
|
|
80
82
|
proposalKey: sha256(
|
|
81
83
|
canonicalJson({
|
|
82
84
|
repository: policy.repository,
|
|
83
|
-
target
|
|
85
|
+
// assertCommittedTarget already bound the descriptor to the committed target.
|
|
86
|
+
target: targetBranch(descriptor),
|
|
84
87
|
ecosystem: "npm",
|
|
85
88
|
directory,
|
|
86
89
|
parent: descriptor.parent,
|
|
@@ -163,6 +166,9 @@ export function verifyAutomationProvenance(messageFile) {
|
|
|
163
166
|
withProvenancePhase(LOCAL_PROOF, () =>
|
|
164
167
|
verifyLocalProposal(descriptor, messageBytes, reference, policy)
|
|
165
168
|
);
|
|
169
|
+
withProvenancePhase(LOCAL_PROOF, () =>
|
|
170
|
+
assertCommittedTarget(config, descriptor)
|
|
171
|
+
);
|
|
166
172
|
withProvenancePhase("verifier", () => assertPinnedVerifier(policy));
|
|
167
173
|
const context = withProvenancePhase("canonical-context", () =>
|
|
168
174
|
canonicalContext(message, config, policy, descriptor)
|
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
keys,
|
|
15
15
|
selectPolicy,
|
|
16
16
|
validateProposal,
|
|
17
|
+
policyTarget,
|
|
18
|
+
validBranchName,
|
|
19
|
+
DEFAULT_TARGET,
|
|
17
20
|
} from "./lib/npm-update-contract.mjs";
|
|
18
21
|
import { publicFailure, withStage } from "./lib/npm-update-invariants.mjs";
|
|
19
22
|
import {
|
|
@@ -23,7 +26,7 @@ import {
|
|
|
23
26
|
phaseDirectory,
|
|
24
27
|
} from "./lib/npm-update-process.mjs";
|
|
25
28
|
import { prepareUpdate } from "./lib/npm-update-prepare.mjs";
|
|
26
|
-
import { GitHub } from "./lib/npm-update-github.mjs";
|
|
29
|
+
import { GitHub, missingTarget } from "./lib/npm-update-github.mjs";
|
|
27
30
|
import {
|
|
28
31
|
createTracker,
|
|
29
32
|
refuseUnlessGithub,
|
|
@@ -94,6 +97,46 @@ async function cancellationPhase(cwd, output, proposal, config, phase) {
|
|
|
94
97
|
);
|
|
95
98
|
}
|
|
96
99
|
|
|
100
|
+
/**
|
|
101
|
+
* The workflow's target_branch input gates which ref the jobs run on; it must
|
|
102
|
+
* name the committed policy's target, so neither side can redirect the other.
|
|
103
|
+
* An absent input is main, matching callers seeded before the input existed.
|
|
104
|
+
*/
|
|
105
|
+
export function assertWorkflowTarget(policy, input) {
|
|
106
|
+
const requested =
|
|
107
|
+
input === undefined || input === "" ? DEFAULT_TARGET : input;
|
|
108
|
+
required(
|
|
109
|
+
validBranchName(requested) && requested === policyTarget(policy),
|
|
110
|
+
"workflow target_branch differs from the committed npmUpdater target"
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A non-main target must exist on the remote before anything is prepared. The
|
|
116
|
+
* checkout fetches every branch, so its remote-tracking ref is the evidence;
|
|
117
|
+
* main keeps its historical path, where the provider read proves the base.
|
|
118
|
+
*/
|
|
119
|
+
export async function assertTargetBranchExists(cwd, policy) {
|
|
120
|
+
const target = policyTarget(policy);
|
|
121
|
+
if (target === DEFAULT_TARGET) return;
|
|
122
|
+
const result = await runProcess(
|
|
123
|
+
"git",
|
|
124
|
+
[
|
|
125
|
+
"rev-parse",
|
|
126
|
+
"--verify",
|
|
127
|
+
"--quiet",
|
|
128
|
+
`refs/remotes/origin/${target}^{commit}`,
|
|
129
|
+
],
|
|
130
|
+
{
|
|
131
|
+
cwd,
|
|
132
|
+
env: { PATH: process.env.PATH, HOME: "/nonexistent" },
|
|
133
|
+
allowed: [0, 1],
|
|
134
|
+
maximum: 4096,
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
if (result.code !== 0) throw missingTarget(target);
|
|
138
|
+
}
|
|
139
|
+
|
|
97
140
|
/**
|
|
98
141
|
* Only committed policy grants authority; ignored/local config cannot activate Actions.
|
|
99
142
|
* LISA_NPM_DIRECTORY only selects among committed entries ("." by default); it never adds one.
|
|
@@ -110,6 +153,7 @@ async function configuration(cwd, directory = process.env.LISA_NPM_DIRECTORY) {
|
|
|
110
153
|
"automation provenance must be explicitly configured on committed main"
|
|
111
154
|
);
|
|
112
155
|
const policy = selectPolicy(config, directory ?? ".");
|
|
156
|
+
assertWorkflowTarget(policy, process.env.LISA_NPM_TARGET_BRANCH);
|
|
113
157
|
required(
|
|
114
158
|
config.automationProvenance.repository === policy.repository,
|
|
115
159
|
"committed authority repository differs"
|
|
@@ -232,6 +276,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
232
276
|
refuseUnlessGithub(config, phase);
|
|
233
277
|
phaseDirectory(output);
|
|
234
278
|
if (phase === "prepare") {
|
|
279
|
+
await assertTargetBranchExists(cwd, policy);
|
|
235
280
|
const result = await prepareUpdate({ cwd, policy, config });
|
|
236
281
|
writeJson(join(output, "prepare.json"), result);
|
|
237
282
|
if (result.status === "prepared")
|