diff --git a/.github/workflows/m3-source-pin-20261021.yml b/.github/workflows/m3-source-pin-20261021.yml new file mode 100644 index 00000000000..7ad28f03c34 --- /dev/null +++ b/.github/workflows/m3-source-pin-20261021.yml @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: Apache-2.0 +name: M3 original AST source-pin receiver +on: + pull_request: + paths: + - 'pom.xml' + - '.m3/m3ast-20261021/**' + - '.github/workflows/m3-source-pin-20261021.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + source-identity: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Fail on root source drift; no runtime promotion + run: python3 .m3/m3ast-20261021/verify.py diff --git a/.m3/m3ast-20261021/README.md b/.m3/m3ast-20261021/README.md new file mode 100644 index 00000000000..1476981290b --- /dev/null +++ b/.m3/m3ast-20261021/README.md @@ -0,0 +1,17 @@ + +# M3JDK21 original-source recipe receiver + +Canonical transformation: `com.synexia.eclipse.EstateAstEclipsePlatform20261021`, frozen at +`hsoliwal/com.synexia@b77c892d7519c6aa037c2b5cebd8658867ea712b`. + +This is an **opt-in source-custody Maven profile**. The default root POM, +original Java/Maven/Tycho compiler, existing public APIs, UI and native +contracts are unchanged. To run the original-source gate without downloading +Maven plugins: `python3 .m3/m3ast-20261021/verify.py`. + +The profile can be invoked with +`mvn -B -ntp -Pm3-ast-source-audit-20261021 validate`, +subject to the original reactor/toolchain and Maven profile interactions. +This gate does **not** establish Java/JNI/HotSpot or Eclipse behavioral +equivalence. M3JDK21 remains one integrated JDK, not an external layer. +Existing JFace/JDT/SWT/Resources implementations retain original authority. diff --git a/.m3/m3ast-20261021/RECEIVER.tsv b/.m3/m3ast-20261021/RECEIVER.tsv new file mode 100644 index 00000000000..7a889b25185 --- /dev/null +++ b/.m3/m3ast-20261021/RECEIVER.tsv @@ -0,0 +1,9 @@ +schema M3_ECLIPSE_BUILD_SOURCE_GATE_V1 +repository hsoliwal/eclipse.platform +source_ref master +root_path pom.xml +root_sha256 b8d7beae551a65c51eca0748a4a1b6504ee8f95c844c69c0d9ff46b14370b0c1 +original_build ECLIPSE_RESOURCES_TYCHO +canonical_recipe com.synexia.eclipse.EstateAstEclipsePlatform20261021 +canonical_commit b77c892d7519c6aa037c2b5cebd8658867ea712b +status HOLD_NATIVE_AND_SEMANTIC_GATES diff --git a/.m3/m3ast-20261021/verify.py b/.m3/m3ast-20261021/verify.py new file mode 100644 index 00000000000..75fe4f4a969 --- /dev/null +++ b/.m3/m3ast-20261021/verify.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +# SPDX-FileCopyrightText: 2026 Hitesh Soliwal and contributors +# SPDX-License-Identifier: Apache-2.0 +"""Read-only source custody for an original Eclipse Maven/Tycho build. + +Never parses Java, changes source, activates a recipe or promotes M3AST. +The original Maven/Tycho/ECJ/SWT/EMF compiler remains authoritative. +""" +from __future__ import annotations + +import hashlib +import pathlib +import re +import sys +import xml.etree.ElementTree as ET + +PROFILE = "m3-ast-source-audit-20261021" +SCHEMA = "M3_ECLIPSE_BUILD_SOURCE_GATE_V1" +KEYS = ("schema", "repository", "source_ref", "root_path", "root_sha256", + "original_build", "canonical_recipe", "canonical_commit", "status") + + +def fingerprint(path: pathlib.Path) -> str: + if path.is_symlink() or not path.is_file(): + raise ValueError("missing or symbolic root source: " + str(path)) + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def main() -> int: + root = pathlib.Path(__file__).resolve().parents[2] + ledger = pathlib.Path(__file__).resolve().with_name("RECEIVER.tsv") + try: + rows = [line.split("\t", 1) for line in ledger.read_text(encoding="utf-8").splitlines()] + if len(rows) != len(KEYS) or any(len(row) != 2 for row in rows): + raise ValueError("incomplete source receiver metadata") + if tuple(row[0] for row in rows) != KEYS: + raise ValueError("source receiver key order/duplication") + facts = dict(rows) + if (facts["schema"] != SCHEMA or facts["root_path"] != "pom.xml" + or facts["source_ref"] != "master" + or not re.fullmatch(r"hsoliwal/[A-Za-z0-9._-]+", facts["repository"]) + or not re.fullmatch(r"[0-9a-f]{64}", facts["root_sha256"]) + or not re.fullmatch(r"[0-9a-f]{40}", facts["canonical_commit"]) + or not facts["canonical_recipe"].startswith("com.synexia.eclipse.EstateAst") + or facts["status"] != "HOLD_NATIVE_AND_SEMANTIC_GATES"): + raise ValueError("source receiver contract or owner changed") + source = root / facts["root_path"] + if fingerprint(source) != facts["root_sha256"]: + raise ValueError("original Maven POM is not the exact recipe postimage") + xml = ET.fromstring(source.read_bytes()) + profiles = [node for node in xml.iter() if node.tag.split("}")[-1] == "profile"] + selected = [node for node in profiles if any( + child.tag.split("}")[-1] == "id" and child.text == PROFILE for child in node)] + if len(selected) != 1: + raise ValueError("original Maven POM missing unique opt-in profile") + refs = [node.text or "" for node in selected[0].iter() + if node.tag.split("}")[-1] == "argument"] + if refs != ["$" + "{project.basedir}/.m3/m3ast-20261021/verify.py"]: + raise ValueError("build profile no longer points to exact source verifier") + print("M3_SOURCE_PIN_PASS " + facts["repository"] + " root=" + facts["root_sha256"]) + print("M3_AST_SEMANTICS=NOT_RUN JNI=NOT_RUN MAVEN_BUILD=NOT_RUN") + return 0 + except (OSError, UnicodeError, ValueError, ET.ParseError) as exc: + print("M3_SOURCE_PIN_REFUSED " + str(exc), file=sys.stderr) + return 2 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/pom.xml b/pom.xml index 17a3bda5876..9568832c522 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,33 @@ + + + + m3-ast-source-audit-20261021 + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.0 + + + m3-original-source-proof + validate + exec + + python3 + + ${project.basedir}/.m3/m3ast-20261021/verify.py + + + + + + + +