Expose Desktop encoder context for result decoding#8
Conversation
loadQmlAndParseOptions now calls syntaxBridgeLoadQmlAndParseOptionsStatus, which returns a JSON status object following the same pattern as other bridge functions. Errors from the QML form (e.g. unresolved formula terms) are surfaced via Rcpp::stop instead of being silently swallowed as an empty return value. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add serializable column decoder snapshots and decodeColumnText() so embedded JASP column tokens are replaced by SyntaxInterface's ColumnEncoder rules. Prefer the native decoder for dataset helpers and result decoding, while keeping a shallow mapping fallback for explicit snapshots/tests. Harden bridge subprocess result handoff and cover empty snapshots plus the public contract in focused tests.
|
@vandenman I pushed the follow-up implementation for the decoder ownership change. The current shape is now: desktop/SyntaxInterface owns token replacement via captured ColumnEncoder snapshots (jasp-desktop#6249), jaspSyntax exposes that through columnDecoderSnapshot() / decodeColumnText(), and jaspBase decides which JASP-owned result surfaces are decoded (jaspBase#204). A few details that address the earlier concerns:
Validation on Windows/R 4.6: rebuilt SyntaxInterface.dll, verified 16 declarations/exports, reran the focused jaspSyntax tests, reran the focused jaspBase tests, and reran the MixedModelsLMM |
| if (.hasColumnDecoderFallback(decoderSnapshot)) { | ||
| return(.decodeColumnTextFallback(text, decoderSnapshot)) | ||
| } | ||
| stop(e) |
There was a problem hiding this comment.
Good: decodeColumnTextNative genuinely call the C++ decoding functionality!
Bad: .decodeColumnTextFallback. This reimplements the functionality in R. Do we even want this function to exist?
@FBartos & @boutinb what do you think? If we always create the snapshotJson on the fly, then I think we should be able to guarantee this? IF we can guarantee this then I think the whole fallback idea is somewhat overengineered and also as a liability. If the fallback is triggered, it means we have "broken" the guarantee which should just error. If the fallback is triggered, it does the decoding differently from how JASP does it. That can result in silently incorrect decoding of results, which I find far worse than showing e.g., encoded results as a fallback with a warning or so.
There was a problem hiding this comment.
Yes I agree, better an error than a wrong result.
There was a problem hiding this comment.
Agreed with this direction. The fallback is gone now: decodeColumnText() always dispatches encoded-token decoding to native SyntaxInterface, and native failures are treated as bugs instead of triggering an R replacement path. The old snapshot/mapping contract was replaced with an opaque Desktop ColumnEncoder context, so jaspSyntax carries provenance but does not implement token replacement itself.
|
Addressed the silent fallback concern in 2b2d73f. What changed:
This keeps the architecture aligned with jasp-desktop #6249: token replacement lives in native Focused checks passed locally with the source DLL path on
|
|
@vandenman I pushed the architecture-level follow-up from the decoding review. The old snapshot/mapping contract is gone. jaspSyntax now carries an opaque Desktop Related PRs: jasp-desktop jasp-stats/jasp-desktop#6249, jaspBase jasp-stats/jaspBase#204, jaspTools jasp-stats/jaspTools#79. |
Summary
This PR updates jaspSyntax to expose the Desktop-native encoder context instead of implementing or preserving R-side column-token replacement:
columnDecoderSnapshot()/columnMapping()withcolumnEncoderContext()decodeColumnText()as the R-facing decoder, but token decoding always goes through the native SyntaxInterface bridgedecodeAnalysisResults()to use the context for column-name tokens and transient requested-dataset factor maps for factor-level decodingcallrdoes not preload an installed jaspSyntax/SyntaxInterface before the requested source checkout is loadedJASP_BUILD_DIRDLLs over copied source DLLs when testing against a live Desktop buildWhy
The encoding rules belong to Desktop/SyntaxInterface. jaspSyntax now only transports the source-state context and calls the native decoder. This keeps replay deterministic for old
.jaspfiles and prevents the R layer from inventing partial mappings that can drift from Desktop behavior.Related PRs
Validation
SyntaxInterfaceand ran jaspSyntax focused tests against that buildtest-desktop-jasp-contract.Rpassed, with the expected gated Descriptives replay skiptest-dataset-helpers.RpassedR/andtests/testthat/files passedgit diff --check