fix(native): keep integral plist reals beyond the JSON range as reals (#860)

plutil's JSON spells an integral <real> such as 9007199254740992 like an
<integer>, so the JSON path labeled it an exact integer. When the JSON
holds an unsafe integral number, read element types from plutil's XML
conversion; numbers whose origin stays ambiguous are reported as decoded
with an explicit limitation.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 13:01:26 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 8b9940a7b5
commit 3b92a2bced
4 changed files with 199 additions and 65 deletions
+5 -1
View File
@@ -135,7 +135,7 @@ describe.skipIf(process.platform !== "darwin")(
"native plist CLI integers",
() => {
cliTest.for([false, true])(
"reports exact plist integers beyond the JSON number range (data: %s)",
"reports exact plist integers and integral reals beyond the JSON number range (data: %s)",
async (withData, { cli }) => {
const directory = await createTestTempDirectory("rea-plist-integers-");
const app = join(directory, "Example.app");
@@ -153,6 +153,8 @@ describe.skipIf(process.platform !== "darwin")(
"<key>Max</key><integer>18446744073709551615</integer>",
"<key>Min</key><integer>-9223372036854775808</integer>",
"<key>Count</key><integer>42</integer>",
"<key>Real</key><real>9007199254740992</real>",
"<key>Large</key><real>1e20</real>",
...(withData ? ["<key>Blob</key><data>AAEC</data>"] : []),
"</dict></plist>",
].join(""),
@@ -171,6 +173,8 @@ describe.skipIf(process.platform !== "darwin")(
Max: { $plist_type: "integer", decimal: "18446744073709551615" },
Min: { $plist_type: "integer", decimal: "-9223372036854775808" },
Count: 42,
Real: 9007199254740992,
Large: 1e20,
},
limitations: [
...(withData ? [expect.stringContaining("XML conversion")] : []),