Add native bridge APIs for JASP replay#7
Conversation
… more easily test an artefact
Compile the downloaded jsoncpp sources, install the built package and helper DLLs into the package library, and copy compatible MinGW runtime DLLs from a local JASP installation when available. Validated locally with a clean temp-library install and library load on Windows.
Treat missing runtime DLLs as optional under set -e and populate src/json from JASP_SOURCE_DIR so the review-identified configure paths build correctly.
Populate json sources in the non-Windows JASP_SOURCE_DIR path and simplify install.libs.R so the copied library set is clearer without changing behavior.
Add readDatasetFromJaspFile() as a public jaspSyntax entry point for materializing the first dataset in a saved .jasp file as an R data.frame. The implementation validates inputs, reuses the existing jaspSyntax bridge load/read path, decodes column names, and normalizes bridge-returned factor columns so numeric-like categorical data comes back as numeric/integer while text-labeled categorical data comes back as character. The public function runs the native dataset load/read path in a short-lived Rscript subprocess instead of in the caller session. This keeps the API stable on the current branch because repeated in-process reads were triggering native transaction unwind spam and stack-imbalance behavior after loading datasets from .jasp files. This commit also adds Rd documentation for the new function and documents the current limitation that only dataSetIndex = 1L is supported by the bridge-backed implementation.
Wrap bridge-facing calls in syntaxfunctions.cpp so native exceptions and malformed bridge responses are turned into explicit R errors instead of being silently parsed or assumed valid. This adds a small helper for exception-safe bridge calls and a JSON parsing helper that rejects null pointers and invalid JSON. The affected entry points are parseDescription(), loadDataSetFromJaspFile(), analysisOptionsFromJaspFile(), and getVariableNames(). The change does not alter the public API shape. It makes failures in the current bridge-backed implementation easier to diagnose and safer to surface in R.
|
Reproduced the Root cause was in the bridge layer, not in
The fix keeps the source of truth in
Verification on the local Windows checkout:
One unrelated note: |
|
Senior follow-up pass pushed in What changed here:
Verification run locally:
Related PRs for the full bridge:
|
|
Follow-up on the focused-test warning investigation:
That stale-DLL overwrite was important: it could mix a fresh Validation with a fresh temporary-library install:
No |
On macOS, objdump -T exits with code 0 for Mach-O files but emits only
a warning ("this operation is not currently supported for this file
format") with no actual symbol data. The fallback to -t never fires,
so the export check reports all symbols as missing.
Add an explicit *.dylib case that calls nm -g directly, which works
correctly on macOS for reading exported symbols.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When no Qt dirs are in PATH, lapply returns an empty list and unlist(list()) returns NULL (not character(0)). normalizePath(NULL) then calls path.expand(NULL) which fails with "invalid 'path' argument". Wrap all three unlist(lapply(...)) calls in as.character() so the result is always a character vector, even when lapply produces an empty list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
.jasparchive helpers for saved options and dataset extraction, including status-returning native calls and isolated subprocess reads.jaspfixtures plus tests for saved/runtime option contracts, dataset extraction, module metadata, and native export coverageWhy
This moves QML parsing, dataset loading, column encoding/decoding, and
.jasparchive semantics out ofjaspToolsand into the lower native bridge package.jaspToolscan then stay focused on developer-facing orchestration instead of duplicating Desktop/native behavior.Related PRs
jaspTools..jaspoption handling to this package.Verification
Rscript -e ".libPaths(c('C:/Users/fbartos/AppData/Local/Temp/jaspBridgeLib_codex_20260514_mergepass', .libPaths())); library(testthat); test_file('tests/testthat/test-dataset-helpers.R'); test_file('tests/testthat/test-jasp-file-options.R'); test_file('tests/testthat/test-desktop-jasp-contract.R'); test_file('tests/testthat/test-module-options.R')"withJASP_DESCRIPTIVES_MODULE=C:/JASP-Packages/jaspDescriptivesgit diff --check HEAD~1..HEAD