diff --git a/.github/scripts/npm_package.py b/.github/scripts/npm_package.py index 567d10823..f3ed7074d 100644 --- a/.github/scripts/npm_package.py +++ b/.github/scripts/npm_package.py @@ -357,6 +357,7 @@ def validate_consumer_proof(files, node, npm, tar_hash, native_hash): require(len(actual.get("findings", [])) == row["findings"], "retained finding count mismatch") require(isinstance(row.get("follow_up_finding"), str) and row["follow_up_finding"].startswith("probe:") and row["follow_up_finding"] in {finding.get("id") for finding in actual.get("findings", [])}, "follow-up finding absent from retained output") require(files[route + "-explain.txt"].strip(), "empty retained explanation") + require(row["follow_up_finding"].encode("utf-8") in files[route + "-explain.txt"], "follow-up finding absent from retained explanation") require(proof.get("negative_controls") == list(CONSUMER_CONTROLS), "missing consumer negative controls") return proof diff --git a/.github/scripts/test_npm_package.py b/.github/scripts/test_npm_package.py index 68e732d7c..e6816c5a2 100644 --- a/.github/scripts/test_npm_package.py +++ b/.github/scripts/test_npm_package.py @@ -535,9 +535,19 @@ def proof(self): files = {"consumer.json": PACKAGE.canonical(proof), "lsp-stderr.txt": b""} for row in rows + [proof["reinstall_journey"]]: files[row["route"] + "-check.json"] = PACKAGE.canonical({"summary": {"probes": 1, "findings": 1}, "findings": [{"id": "probe:fixture"}]}) - files[row["route"] + "-explain.txt"] = b"Useful explanation of the selected finding" + files[row["route"] + "-explain.txt"] = b"Useful explanation of probe:fixture" return proof, files + def test_retained_explanations_require_the_selected_follow_up_finding(self): + _, files = self.proof() + for route in (*PACKAGE.ROUTES, "fresh-reinstall"): + for explanation in (b"Useful explanation without a finding identity", + b"ERROR: unrelated finding probe:wrong was not found"): + changed = dict(files, **{route + "-explain.txt": explanation}) + with self.subTest(route=route, explanation=explanation): + with self.assertRaisesRegex(ValueError, "follow-up finding absent from retained explanation"): + PACKAGE.validate_consumer_proof(changed, "20.20.1", "10.8.2", "c" * 64, "e" * 64) + def test_consumer_receipts_require_executed_distinct_routes_and_retained_journeys(self): proof, files = self.proof() PACKAGE.validate_consumer_proof(files, "20.20.1", "10.8.2", "c" * 64, "e" * 64) diff --git a/docs/specs/RIPR-SPEC-0180-npm-native-bootstrap.md b/docs/specs/RIPR-SPEC-0180-npm-native-bootstrap.md index 87c17d4fe..efa1a44c4 100644 --- a/docs/specs/RIPR-SPEC-0180-npm-native-bootstrap.md +++ b/docs/specs/RIPR-SPEC-0180-npm-native-bootstrap.md @@ -32,7 +32,10 @@ suffixes cannot be normalized into an otherwise expected artifact or wheel membe This refusal applies on both Unix and Windows readers before member bytes are read. Native execution and qualification retain explicit denominators. Each selected -client must independently install the actual tarball project-locally, globally, +route, including fresh reinstall, retains an explanation naming its selected +follow-up finding from the retained check output. Unrelated nonempty explanation +bytes cannot satisfy that journey. +Each selected client must independently install the actual tarball project-locally, globally, through npm exec and the actual public npx executable, then produce nonempty findings and a follow-up action. A missing or broken npx wrapper fails qualification. Reinstallation requires observed package/bin-link absence before