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
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Generated / vendored surface inputs — exclude from language stats and collapse diffs.
tools/baseline/streaming-relevance-baseline.json linguist-generated=true -diff
flink-processor/jar/JMEOS.jar binary linguist-generated=true
# Generated output — exclude from language stats.
flink-processor/target/** linguist-generated=true
63 changes: 47 additions & 16 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,57 @@ jobs:
java-version: "21"
cache: maven

- name: Resolve the MEOS source commit
id: meos
# The bundled JMEOS jar and the generated MeosOps* facades are produced from one
# upstream MobilityDB commit, recorded once in tools/meos-source-commit.txt. CI reads
# it so the libmeos the smoke tests load stays in lockstep with the vendored surface —
# bumping the surface is a single edit there, with no SHA duplicated in this workflow.
run: echo "sha=$(tr -d '[:space:]' < tools/meos-source-commit.txt)" >> "$GITHUB_OUTPUT"

# Build and install the all-families libmeos through the shared
# provision-meos action so the MEOS build recipe (PG purge, apt.postgresql.org
# PG17, deps, cmake --build/--install under /usr/local) lives in one place.
- name: Build and install libmeos
# Derive the MEOS catalog (meos-idl.json via run.py) and build+install the
# all-families libmeos.so from upstream MobilityDB master, through the shared
# composite action (PG purge, apt.postgresql.org PG17, deps, cmake, install under
# /usr/local). Tracking master (not a pinned commit) keeps the source, the catalog,
# the JMEOS jar and the libmeos the smoke tests load all moving together, so the
# generated facades can never drift from the surface they are built against.
- name: Provision MEOS catalog + libmeos
id: provision
uses: MobilityDB/MEOS-API/.github/actions/provision-meos@master
with:
mobilitydb-ref: ${{ steps.meos.outputs.sha }}
mobilitydb-ref: master
build-libmeos: "true"

- name: Derive the streaming-relevance baseline from the catalog
# The facade generator reads tools/baseline/streaming-relevance-baseline.json; derive
# it from the master catalog with the deterministic classifier so the generator input
# tracks master too. The baseline is gitignored — it only ever exists as a build artifact.
run: |
tools/regen_baseline.sh "${{ steps.provision.outputs.catalog-path }}"
echo "LD_LIBRARY_PATH=/usr/local/lib" >> "$GITHUB_ENV"

- name: Check out JMEOS at master
# Build the JMEOS jar (org.jmeos:meos:1.0) from JMEOS main against the SAME
# master-derived catalog and libmeos, so the jar's FFI surface can never drift from the
# surface the facade generator reads or the libmeos the smoke tests load.
uses: actions/checkout@v4
with:
repository: MobilityDB/JMEOS
ref: main
path: jmeos

- name: Build + install the JMEOS jar as org.jmeos:meos:1.0
# Mirror JMEOS's own CI: stage the already-derived catalog + libmeos into the JMEOS
# checkout and build it (jmeos-core's generate-sources emits GeneratedFunctions from the
# catalog). The jar plugin writes the plain jar/JMEOS.jar (finalName JMEOS) — jnr-ffi is
# supplied by this project's own pom, so the plain jar is what the removed committed
# jar/JMEOS.jar was; libmeos is loaded from LD_LIBRARY_PATH, never from the jar. It is
# installed under the org.jmeos:meos:1.0 coordinates the facade generator and the
# processor consume. Tests are skipped — only the jar is needed; JMEOS's own CI exercises
# its FFI suite.
run: |
mkdir -p jmeos/codegen/input
cp "${{ steps.provision.outputs.catalog-path }}" jmeos/codegen/input/meos-idl.json
cp /usr/local/lib/libmeos.so jmeos/jmeos-core/src/
mvn -B -f jmeos/pom.xml clean install -Dmaven.test.skip=true
mvn -B install:install-file \
-Dfile=jmeos/jar/JMEOS.jar \
-DgroupId=org.jmeos -DartifactId=meos -Dversion=1.0 -Dpackaging=jar

- name: Build + generate + smoke tests
# The generated MeosOps* facades forward to the bundled JMEOS jar (system-scoped); the
# smoke tests exercise them against the freshly built libmeos, resolved from
# /usr/local/lib rather than the committed lib/ copy.
# generate-sources runs the facade generator over the installed jar's surface ∩ baseline;
# the smoke tests exercise the facades against the freshly built libmeos from /usr/local/lib.
working-directory: flink-processor
run: mvn -B -Dmeos.lib.dir=/usr/local/lib -Dmeos.enabled=true clean test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ __pycache__/

# Maven build output
flink-processor/target/

# Derived generator input — the streaming-relevance baseline is regenerated in CI
# from the master MEOS catalog (tools/regen_baseline.sh), never committed.
tools/baseline/streaming-relevance-baseline.json
39 changes: 17 additions & 22 deletions GENERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,19 @@ classifier: the tier of a function is decided purely by its name, its object-mod
and its number of temporal parameters (zero per-function judgement), so the same MEOS
catalog always yields the same baseline.

The full input chain, from the tracked MobilityDB commit:
The full input chain, from upstream MobilityDB master:

```
MobilityDB @ tools/meos-source-commit.txt
→ MEOS-API/run.py over the MEOS headers → meos-idl.json (the catalog)
→ tools/classify_streaming_relevance.py → tools/baseline/streaming-relevance-baseline.json
→ tools/codegen_facades.py (jar-surface ∩ baseline) → org.mobilitydb.meos.MeosOps* facades
MobilityDB @ master
provision-meos (MEOS-API/run.py over the MEOS headers) → meos-idl.json (the catalog)
→ tools/classify_streaming_relevance.py → tools/baseline/streaming-relevance-baseline.json
→ tools/codegen_facades.py (jar-surface ∩ baseline) → org.mobilitydb.meos.MeosOps* facades
```

To refresh the baseline (e.g. after bumping `tools/meos-source-commit.txt`): rebuild the
catalog at the tracked commit with MEOS-API, then

```
tools/regen_baseline.sh <path-to-meos-idl.json>
```

and commit the diff. Because the classifier is deterministic, an unchanged catalog
regenerates the baseline byte-for-byte.
CI derives the baseline from the master catalog with `tools/regen_baseline.sh
<path-to-meos-idl.json>` before the build; the baseline is gitignored, not committed.
Because the classifier is deterministic, the same catalog regenerates it byte-for-byte, so
a local refresh is: build the catalog from master with MEOS-API, then run the same script.

## Generate-then-retire — the green-CI version is the probe

Expand All @@ -62,14 +57,14 @@ green-CI version** (the test suite + the streaming benchmark), then retire the h

The `MeosOps*` facades are emitted at build time and are **not committed**: Maven
`generate-sources` runs `tools/codegen_facades.py` into `target/generated-facades`, and
`build-helper` adds it as a source root. Only the generator, its `tools/baseline/`, and the
bundled jar are tracked; the sole hand-written class under `org.mobilitydb.meos` is
`MeosSetSetJoin`.
`build-helper` adds it as a source root. Only the generator and its `tools/` classifier are
tracked; the catalog, the baseline and the JMEOS jar are all derived in CI, and the sole
hand-written class under `org.mobilitydb.meos` is `MeosSetSetJoin`.

## Surface match

The bundled JMEOS jar (`flink-processor/jar/JMEOS.jar`) is committed and consumed
system-scoped; the generator reads its raw-FFI surface. The `libmeos.so` it links must be
built from the **same MobilityDB commit** the JMEOS surface was generated against —
surface-match, else runtime symbol faults. That commit is the *catalog/surface* input for
the whole binding.
The JMEOS jar is built from **JMEOS `main`** in CI against the master-derived catalog and
installed as `org.jmeos:meos:1.0`; the generator reads its raw-FFI surface. The `libmeos.so`
the smoke tests load is built from the **same** master catalog, so the jar surface, the
facades and the native library all track master together — surface-match by construction,
with no committed jar or pinned commit to drift.
Binary file removed flink-processor/jar/JMEOS.jar
Binary file not shown.
17 changes: 8 additions & 9 deletions flink-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,12 @@
<version>1.18.1</version>
</dependency>

<!-- JMEOS dependency -->
<!-- JMEOS dependency — built from JMEOS main in CI and installed under these
coordinates (org.jmeos:meos:1.0), so the FFI surface tracks master. -->
<dependency>
<groupId>com.mobilitydb</groupId>
<artifactId>jmeos</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/jar/JMEOS.jar</systemPath>
<groupId>org.jmeos</groupId>
<artifactId>meos</artifactId>
<version>1.0</version>
</dependency>

<!-- JUnit dependency -->
Expand Down Expand Up @@ -208,8 +207,8 @@
</resource>
</resources>
<plugins>
<!-- Generate the org.mobilitydb.meos.MeosOps* streaming facades from the bundled
JMEOS jar at build time (into target/, never committed). -->
<!-- Generate the org.mobilitydb.meos.MeosOps* streaming facades from the installed
JMEOS jar's surface at build time (into target/, never committed). -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand All @@ -224,7 +223,7 @@
<arguments>
<argument>${project.basedir}/../tools/codegen_facades.py</argument>
<argument>--jar</argument>
<argument>${project.basedir}/jar/JMEOS.jar</argument>
<argument>${settings.localRepository}/org/jmeos/meos/1.0/meos-1.0.jar</argument>
<argument>--out</argument>
<argument>${project.build.directory}/generated-facades</argument>
<argument>--engine</argument>
Expand Down
Loading
Loading