Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/m3-source-pin-20261021.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .m3/m3ast-20261021/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- SPDX-License-Identifier: Apache-2.0 -->
# 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.
9 changes: 9 additions & 0 deletions .m3/m3ast-20261021/RECEIVER.tsv
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions .m3/m3ast-20261021/verify.py
Original file line number Diff line number Diff line change
@@ -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())
27 changes: 27 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,33 @@
</repository>
</repositories>
</profile>

<!-- M3JDK21 canonical source-pinned recipe: opt-in original-AST audit. -->
<profile>
<id>m3-ast-source-audit-20261021</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>m3-original-source-proof</id>
<phase>validate</phase>
<goals><goal>exec</goal></goals>
<configuration>
<executable>python3</executable>
<arguments>
<argument>${project.basedir}/.m3/m3ast-20261021/verify.py</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<modules>
Expand Down
Loading