test: add PartialApplyFmt unit tests for ASCII-safe handling#856
Merged
stephenamar-db merged 1 commit intoMay 20, 2026
Merged
Conversation
He-Pin
added a commit
to He-Pin/sjsonnet
that referenced
this pull request
May 13, 2026
Motivation: A follow-up probe reused parser ASCII-safe metadata to skip static format literal safety scanning after PR databricks#856, but internal debug counter gains did not translate into Native whole-process speed. Modification: Record the rejected parser `_asciiSafe` format hint experiment in the gap ledger and sync-points file so it is not repeated without materially new evidence. Result: The accepted simple-format ASCII-safe optimization remains unchanged, and the rejected hint path is documented with forward/reverse Native benchmark evidence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
He-Pin
added a commit
to He-Pin/sjsonnet
that referenced
this pull request
May 13, 2026
Motivation: A Native-only ASCII-safe byte-copy probe tested whether a manual low-byte loop could improve large formatted string rendering after PR databricks#856. Modification: Record the rejected manual copy-loop experiment in the gap ledger and sync-points file with forward/reverse Native benchmark evidence. Result: The optimized implementation remains on the faster platform `String.getBytes(0, len, dst, dstPos)` path, and the slower manual copy route is documented to avoid repeated work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Motivation: PR databricks#860 propagates ASCII-safety through Format outputs by tracking the ASCII-safety of compiled format literals and each interpolated value, then setting Val.Str._asciiSafe on the result. Add direct unit coverage for PartialApplyFmt so future refactors of format-string parsing or ASCII-safety detection cannot regress the optimization without a visible test failure. Modification: * New FormatTests.scala exercising PartialApplyFmt.evalRhs through a minimal in-memory EvalScope. Four cases: safe numeric value, unsafe string value, unsafe static literal in the format, and ASCII-safety combined across multiple keys (one safe + one unsafe). Result: * ./mill 'sjsonnet.jvm[3.3.7]'.test.testOnly sjsonnet.FormatTests -- 4/4 PASS. * ./mill __.checkFormat green. References: Follow-up unit coverage for databricks#860
f2a2e3b to
cd29839
Compare
stephenamar-db
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up unit coverage for #860 (which propagates ASCII-safety through Format outputs).
The original branch held the production implementation, but #860 covers the same optimization with a slightly different approach and was merged first. Reduce this PR to the regression tests that were developed for the original implementation — they pass unchanged against the current
Format.scala.Changes
sjsonnet/test/src/sjsonnet/FormatTests.scala— 4 new tests directly exercisingFormat.PartialApplyFmt.evalRhsvia a minimal in-memoryEvalScope:Verification
References