proof-of-change 1.2.1 → 1.2.3
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/docs/STATUS.md +1 -0
- package/package.json +1 -1
- package/src/engine/verify.js +6 -1
- package/src/init.js +1 -1
- package/src/mutants.js +5 -0
- package/src/status-report.js +12 -1
package/docs/STATUS.md
CHANGED
|
@@ -27,6 +27,7 @@ Each label covers one thing, only on the head it was added to. Every push remove
|
|
|
27
27
|
- the label was last added by someone with write access, after the approved head's first run for this pull request;
|
|
28
28
|
- the merge changed no file the pull request changes, and no file under `.proof/`;
|
|
29
29
|
- after the merge, the pull request changes only files the approved head already changed (so a merge that keeps an old version of a file the base changed doesn't carry);
|
|
30
|
+
- since the approved head branched off, the base branch changed nothing under `.proof/` and none of the files the approval covers;
|
|
30
31
|
- GitHub's file lists for the merge are complete.
|
|
31
32
|
|
|
32
33
|
Otherwise the status says to approve again: remove the label and add it back. The approval is kept, never the result: the merged head is verified again on the new base and turns green only from its own run. It carries over one merge only: a second update before the label is added again needs a new approval. Inconclusive and workflow approvals never carry over, and any other push still removes every label.
|
package/package.json
CHANGED
package/src/engine/verify.js
CHANGED
|
@@ -337,7 +337,12 @@ export function createVerify({ opts, root, emit, hostName, hostRequirements, hos
|
|
|
337
337
|
// The packet claimed a mechanical pass and it doesn't hold here.
|
|
338
338
|
if (!res.passed && job.proof?.passed && !job.attestation && entry) {
|
|
339
339
|
const problem = `test guard re-run failed: ${res.summary}`;
|
|
340
|
-
|
|
340
|
+
// In block mode the re-run's own verdict decides (test_change or test_inconclusive
|
|
341
|
+
// below, each with its own approval): this disagreement with the packet's recorded
|
|
342
|
+
// pass stays visible as a warning, not a second block no approval could clear. In
|
|
343
|
+
// attest mode it still blocks until attested. Required checks are re-run separately
|
|
344
|
+
// and still block when they fail.
|
|
345
|
+
const blocking = commitGuard.mode !== 'block' && blocks('rerun_failed');
|
|
341
346
|
out.findings.push({ code: 'rerun_failed', detail: problem, blocking, packet: entry.id, unfinished: Boolean(res.unfinished) });
|
|
342
347
|
if (blocking) {
|
|
343
348
|
entry.ok = false;
|
package/src/init.js
CHANGED
|
@@ -404,7 +404,7 @@ const PKG_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'
|
|
|
404
404
|
// The newest POCP release that has a tag on GitHub. A development or pre-release build (a
|
|
405
405
|
// version like 1.1.0-dev.0, as on main between releases) has no tag of its own, so the
|
|
406
406
|
// workflows it writes pin this instead of a ref that doesn't exist. Update it with each release.
|
|
407
|
-
export const RELEASED_ACTION_REF = 'v1.2.
|
|
407
|
+
export const RELEASED_ACTION_REF = 'v1.2.3';
|
|
408
408
|
|
|
409
409
|
/** The release tag the workflows pin by default: "v<version>" for a release, else RELEASED_ACTION_REF. */
|
|
410
410
|
export function releaseRef() {
|
package/src/mutants.js
CHANGED
|
@@ -18,6 +18,11 @@ export const DEFAULT_EVAL_EXCLUDE = Object.freeze([
|
|
|
18
18
|
'**/test-utils/**', '**/test_utils/**', '**/testutils/**', '**/test-helpers/**', '**/test_helpers/**', '**/test-support/**', '**/test_support/**',
|
|
19
19
|
// JavaScript / TypeScript (and anything else named this way): a.test.js, a.spec.ts, a_spec.js, a_test.js.
|
|
20
20
|
'**/*.test.*', '**/*.spec.*', '**/*_spec.*', '**/*_test.*', '**/*.snap',
|
|
21
|
+
// Standalone Node/AVA tests, also inside packages. Share these with the guard so an
|
|
22
|
+
// unrecognised test cannot both escape restoration and enter the mutation sample.
|
|
23
|
+
...['js', 'mjs', 'cjs', 'ts', 'mts', 'cts', 'jsx', 'tsx'].flatMap((ext) => [
|
|
24
|
+
`**/test.${ext}`, `**/test-*.${ext}`,
|
|
25
|
+
]),
|
|
21
26
|
// Python: test_a.py, a_test.py (above), Django's tests.py.
|
|
22
27
|
'**/test_*.py', '**/tests.py',
|
|
23
28
|
// Ruby: a_spec.rb, a_test.rb (above), test_a.rb.
|
package/src/status-report.js
CHANGED
|
@@ -330,6 +330,15 @@ export function carriedOver(facts, label) {
|
|
|
330
330
|
if (added.length) return no(`the merge adds changes the approval didn't cover: ${added.slice(0, 3).join(', ')}`);
|
|
331
331
|
const policy = [...merged].filter((f) => f.startsWith(POLICY_PREFIX));
|
|
332
332
|
if (policy.length) return no(`the merge changed policy files: ${policy.slice(0, 3).join(', ')}`);
|
|
333
|
+
// What the base branch changed since the approved head branched off. A merge can keep the
|
|
334
|
+
// pull request's own version of a file, so the merge's file list never shows that the base
|
|
335
|
+
// changed it: the base must not have changed the policy (the authority the approval was judged
|
|
336
|
+
// by) or any file the approval covers (the side the person compared against).
|
|
337
|
+
if (!Array.isArray(c.base_files)) return no("GitHub's data for the base branch's changes was missing");
|
|
338
|
+
const basePolicy = c.base_files.filter((f) => f.startsWith(POLICY_PREFIX));
|
|
339
|
+
if (basePolicy.length) return no(`the base branch changed policy files since the approval: ${basePolicy.slice(0, 3).join(', ')}`);
|
|
340
|
+
const baseTouched = c.base_files.filter((f) => approved.has(f));
|
|
341
|
+
if (baseTouched.length) return no(`the base branch changed files the approval covers: ${baseTouched.slice(0, 3).join(', ')}`);
|
|
333
342
|
return { ok: true };
|
|
334
343
|
}
|
|
335
344
|
|
|
@@ -466,7 +475,7 @@ async function gatherCarry(gh, repo, head, workflow) {
|
|
|
466
475
|
const parents = (commit.parents || []).map((p) => p.sha);
|
|
467
476
|
if (parents.length !== 2) return null;
|
|
468
477
|
const [from, merged] = parents;
|
|
469
|
-
const carry = { from_sha: from, merged_sha: merged, complete: true, reason: null, merge_files: [], pr_files: [], approved_files: [], runs: [] };
|
|
478
|
+
const carry = { from_sha: from, merged_sha: merged, complete: true, reason: null, merge_files: [], pr_files: [], approved_files: [], base_files: [], runs: [] };
|
|
470
479
|
const filesOf = async (a, b) => {
|
|
471
480
|
const cmp = await gh.get(`${repo}/compare/${a}...${b}`);
|
|
472
481
|
const files = (cmp.files || []).flatMap((f) => [f.filename, f.previous_filename].filter(Boolean));
|
|
@@ -477,6 +486,8 @@ async function gatherCarry(gh, repo, head, workflow) {
|
|
|
477
486
|
carry.pr_files = await filesOf(merged, head);
|
|
478
487
|
// What the approved head changed against its merge base with the base branch (three dots).
|
|
479
488
|
carry.approved_files = await filesOf(merged, from);
|
|
489
|
+
// What the base changed since the approved head branched off (three dots: from their merge base).
|
|
490
|
+
carry.base_files = await filesOf(from, merged);
|
|
480
491
|
const runs = await listAll(gh, `${repo}/actions/workflows/${workflow.id}/runs?head_sha=${from}&per_page=100`, 'workflow_runs', 5);
|
|
481
492
|
if (!runs.complete) { carry.complete = false; carry.reason = runs.reason || 'a list was cut short'; }
|
|
482
493
|
for (const r of runs.items.filter((x) => x.event === 'pull_request' && x.path === workflow.path)) {
|