Skip to content

Validate Protobuf releases and editable AST fidelity - #268

Open
lm-sousa wants to merge 301 commits into
masterfrom
ast-protobuf
Open

lm-sousa wants to merge 301 commits into
masterfrom
ast-protobuf

Conversation

@lm-sousa

@lm-sousa lm-sousa commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Clava generated Protobuf bindings from a sibling schema checkout that could disagree with the selected dumper. Generation now uses the verified canonical schema and descriptor from clang-dumper-release.tag, validates release toolchain compatibility before compilation, and checks consumer binding drift in check and CI. Native Protobuf/protoc 28.3 and Java Protobuf 4.28.3 remain pinned.

Compiled DataKeys, inheritance and checked conventions govern generated bindings. Unsupported emitted nodes fail with their class, ID and available location regardless of reachability; payload compatibility is checked against the actual class. Structured metadata and printers support the affected assembly, lambda, template, type and declaration edits. Unsupported dependent-friend forms reject explicitly. Bounded incremental framing/decompression, presence/reference checks, direct getters, the reader cache and external Zstd policy are preserved.

Cleanup covers syntax-only, rejection, cross-TU processing and repeated parsing. Resource selection, meaningful libc probes, framework search and bounded metadata caches use the selected schema, toolchain and verified executable. CUDA tests query support only when executed, and platform clock fixtures retain the setter transformation assertions. Packed Node 24 local/global CLI and API checks pass; npm 11 java-addon script approval is documented.

Validation:

  • Published testing RC v18.1.8_6-rc8 passed all native platform jobs. Clean release-backed parser check: 253 tests, 249 passed, zero failures, four local-binary-only skips. All three release-specific checks, 10 resolver tests, binding drift, coverage and installDist passed.
  • Clava CI at 360a41c5e passed Java and all six Node 24/25 Linux/macOS/Windows jobs. The Windows Node 24 runner connection loss and successful retry are retained as evidence.
  • Corpus: 1,062 valid native streams; 773 strict stable consumer roundtrips, independently syntax-checked with LLVM 18; 289 failures remain explicitly recorded. Malformed-input, unsupported-node, transformation and cross-TU tests are included.
  • Updated RC8 Protobuf-only runtime: 48 valid App/wall observations using the original workloads, cache states, repetitions and workers. Memory: six fresh JVMs and 120 parse/release cycles passed App/resource cleanup. Frozen Text/FlatBuffers controls remain unchanged; no cross-session paired statistics. Evidence is in experiments/protobuf/validation/evidence/benchmark-20261008-rc8/.
  • Shared SpecsUtils and local Lara checks passed. jOptions retains 17 legacy XML failures reproduced against its unchanged base, with the XStream warning preserved. Lara's independent CI dependency resolver and separate analysis gates still have failures; this does not claim every PR check is green.

The local developer selector override is deliberately uncommitted. This PR is for review and RC testing, with no stable publication or master merge requested.

Without the files field, npm falls back to .gitignore, which ignores
java-binaries, so the published package shipped without the weaver JARs
required by code/WeaverConfiguration.ts. Restore the allowlist, updated
for the vitest/oxlint migration.
Load clang-dumper assets from the v16.0.5_3 release manifest and remove the legacy archive resource map.

Update Clang 18 enum values, parser tolerance, bundled include/CUDA handling, and JS expectations needed by the new dumper.
Use entrypoints.txt from extracted clang-dumper include archives as the ordered system include roots.

Throw when entrypoints.txt is missing instead of inferring roots from archive folder names.
Allow parser tests to select a local dumper without disturbing release cache assets. Restore strict resolution of referenced nodes so incomplete dumper output fails at its source.
Share the system-header threshold spelling between Clava's tool and plugin invocation paths.
Treat absolute tag-file values as build directories, use their local tool or plugin without release downloads or checksum validation, and force system-provided headers. Remove the superseded executable override and cover source parsing and local tool selection.
Add support for Clang's CXXParenListInitExpr node and preserve the original parenthesized argument list during code generation. Add an integration test covering aggregate initialization under C++20.
Key the in-process lock by the shared release cache lock file so concurrent libc and CUDA configurations cannot acquire different JVM locks for the same cache folder.
Store per-version cache locks beside the version directory so cleanup can delete the directory while holding the lock on Windows, Linux, and macOS. Update the cache cleanup test to use the shared lock-path helper.
Discover a system CUDA toolkit from portable environment, PATH, and platform-specific locations when bundled headers are unavailable. Continue with a single warning when no toolkit is found instead of rejecting local builds.
Coordinate cache initialization and stale cleanup with a temporary directory claim that is removed on release. Keep the claim outside version folders for Windows deletion and recover claims left by terminated processes.
Write the shared CUDA compatibility resource to a unique temporary file and install it with an atomic move, preventing concurrent Clava instances from reading a partial header.
Restore callinit and listinit as explicit enum values because the generated TypeScript API exposes raw strings without an enum conversion.
Add same-JVM, cross-JVM, multi-version, crash-recovery, stale-cleanup, and real release initialization coverage for the clang-dumper cache. Keep red diagnostic tests for reclaimed-lock release and cached last-used updates bypassing the cache lock.
Add a cross-JVM diagnostic proving stale cleanup can remove an executable still referenced by the in-process ClangFiles cache.
Use the immutable testing release with canonical macOS framework and subframework include paths. Preserve the local developer selector override unstaged.
Use the immutable testing release with portable resource-package fixtures and canonical framework includes. Preserve the developer selector override unstaged.
Skip built-in CUDA fixtures only when the Java resource installer reports no compatible host platform, and allow bounded cold resource setup. Record the RC8 nightly failures and the focused local CUDA/typecheck results without treating the prior CI run as green.
The setter integration uses high_resolution_clock, which the Windows standard library reports as steady_clock. Reuse the existing matching macOS output under a platform-neutral fixture name; all other expected output remains identical. Record the pre-fix CI result and leave fresh Windows verification pending.
Archive the validated 48-row Protobuf-only runtime cohort, separate 120-cycle memory diagnostics, exact drivers, RC8 asset provenance, raw sidecars, and the zero-observation preflight attempt. Point the report instructions at the final capture.
Archive resource-only timing and process traces comparing released RC8 consumer setup with the reviewed permission fix. Preserve historical suite measurements and document remaining release/toolchain differences without claiming full-suite runtime recovery.
Add isolated snapshot preparation, pinned runtime and memory collectors, strict saved-evidence validation, and private DraftLink retry support. Include cohort fixtures, CLI documentation, and fixture-based workflow and report tests. Preserve the frozen non-Protobuf controls.
Preserve the zero-observation JavaScript cohort preflight failure with its full logs and provenance. Archive separate 120-cycle RC8 memory diagnostics with source and executable hashes plus raw repeats. Keep the private report unchanged because runtime evidence did not validate.
Keep the accepted JavaScript test bytes in consumer-owned fixtures and verify every current source hash before staging them into the isolated Clava snapshot. Record current and staged per-file hashes alongside the two source revisions, validate them in capture and report paths, and show the overlay in the generated report.
Disable Python bytecode writes before the refresh workflow imports report helpers from the canonical Clava checkout. This prevents preparation from creating untracked cache files that trigger the checkout cleanliness gate.
Stage pinned JavaScript tests only inside a detached snapshot worktree and reject symlink paths, unknown source bytes, and post-stage changes. Require workload provenance in standalone reports and validate it against runtime evidence. Use Vitest's runner config loader for both phases, record the selected loader, and keep collectors from writing bytecode into canonical or snapshot source trees.
Prevent frozen JavaScript workload staging from changing files through hard links, and require standalone reports to carry every pinned test-source hash. Add regressions for canonical file preservation and missing or contradictory source manifests.
The protobuf path paid three costs the text path did not:

- Every JVM re-hashed the cached 77 MB clang-dumper executable (~200 ms on
  the first App call), although CacheFiles.installFile already verifies the
  SHA-256 at download and publishes atomically. ccache's own compiler check
  covers the executable identity, so the ccache namespace now keys only on
  schema and toolchain.
- ProtoAstReader kept several per-node HashSets to re-check producer
  invariants (dense-id exactness, NodeClass/Children coverage, End counters
  and raw bytes). Duplicates are still rejected through the existing maps;
  Header, End presence, payload contracts and top-level references are kept.
- Opt-in wire metrics (PROTOBUF_METRIC, four ClangAstData timing keys) were
  threaded through the hot path. JFR covers this need.

nas_bt.c steady-state App time drops ~6% (1117 -> 1049 ms) and the first
App call in a JVM ~200 ms (835 -> 636 ms) in an in-JVM microbenchmark.
refresh_benchmark.py gains 'run' (prepare, collect, render and optional
private publish in one call) and 'quick' (App phase only, direct and warm,
one repeat, printed beside the frozen control medians). Workspace, release
asset and resource cache paths now default to this machine's verified RC8
inputs. quick removes its snapshot worktrees and multi-gigabyte cache trees
when done.
The parser no longer adds the dumper executable digest to its ccache
namespace, so the warm-cache gate looked in a folder that is never written.
Write dumps uncompressed and set CCACHE_COMPRESS, the same cache policy as
the FlatBuffers consumer, instead of streaming a Zstandard frame from
clang-dumper and decoding it with zstd-jni. An in-JVM A/B on boolean.c,
includes.cpp and NAS BT showed no difference between the two policies in
cold or warm mode (within 1%), so the simpler one wins: it drops the
zstd-jni dependency and the .zst dump path, and makes the two wire
prototypes' cache paths identical for comparison.
three_way.py snapshots each transport's committed Clava ref, builds all of
them against one shared specs-java-libs and lara-framework revision, and
runs the rotated App and wall matrix in a single session with identical
pinned JavaScript tests and per-call workload checks. render_comparison
reuses the existing report charts with every transport from the same
session and Before cache kept as the labelled historical baseline.
Every 'gradle test' re-ran the release resolver, its Python unit tests and
the binding drift check (~2 s per Java suite command). Like the
FlatBuffers build, run the drift and resolver tests under 'check' only, and
let resolveProtoRelease be up to date when its tag, script and outputs are
unchanged.
The FlatBuffers branch now targets Java 21; the overlay already compiles
for the parser's own class version.
Record the validated RC8 runtime capture, separate fresh memory diagnostics, source provenance, corrected report history, and compressed raw sidecars.
Check pinned test counts for App and wall observations before rendering comparison rows. Add a regression test for failed App tests and clarify that differing revisions, native releases, header sources, and cache settings prevent isolating AST transport.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.5% Duplication on New Code (required ≤ 3%)
E Security Rating on New Code (required ≥ A)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants