docs(prompt): document Json::number vs Json(x) for non-finite doubles - #1197
Open
bobzhang wants to merge 1 commit into
Open
docs(prompt): document Json::number vs Json(x) for non-finite doubles#1197bobzhang wants to merge 1 commit into
bobzhang wants to merge 1 commit into
Conversation
A moongrep scan of the Json::$_($_) pattern finds only Json::number(x) calls on unguarded Doubles in the current tree (plus Json::stringify, which is not a constructor). Json(x) for a Double routes through Double::to_json, which encodes NaN/Infinity as the strings "NaN"/"Infinity" instead of numeric tokens, so those call sites must keep Json::number. Record the caveat in the prompt guidance so the exception is explicit; the generated prompt is regenerated by the md_to_mbt_string dev rule. Co-Authored-By: SeekMoon <noreply@moonbitlang.cn>
bobzhang
force-pushed
the
refactor/json-number-guidance
branch
from
September 2, 2026 05:10
857a881 to
01b283b
Compare
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.
Document the
Json::number(x)vsJson(x)distinction for non-finitedoubles in the built-in prompt's JSON guidance.
Json(x)for aDoubleroutes throughDouble::to_json, which encodesNaN/Infinityas the strings"NaN"/"Infinity"instead of numerictokens, so call sites with unguarded
Doubles must keepJson::number.The guidance now records that exception explicitly; the generated prompt
(
prompt/generated_default_prompt.mbt) is regenerated fromprompt/default_prompt.mbt.mdby themd_to_mbt_stringdev rule.The
OPENSEEK_ENGINE/OPENSEEK_ENGINE_MODEremoval that previously rodealong on this branch is now its own PR: #1209.
Generated with SeekMoon