From 1accac27c36d98fb432e32a4a45fe75c78480773 Mon Sep 17 00:00:00 2001 From: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Date: Sun, 18 Oct 2026 09:20:43 +0800 Subject: [PATCH] fix(ci): restore plist, verifier, and TOML capacity checks (#4930) Correct stale plist and prerequisite fixtures, and replace the TOML serializer's repeated terminal-LF regex scans with a backward scan. Keep capacity, timeout, source-preservation, backup, and idempotence coverage intact. Fixes #4931 --- src/application/ClientConfigurationDocument.ts | 15 +++++++++++---- src/domain/propertyListXml.test.ts | 4 +++- .../filesystem/keyedArchiveSelection.test.ts | 8 +++++--- .../process/verifierFileResources.test.ts | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/application/ClientConfigurationDocument.ts b/src/application/ClientConfigurationDocument.ts index 48724bf1c7..087d5a6f1a 100644 --- a/src/application/ClientConfigurationDocument.ts +++ b/src/application/ClientConfigurationDocument.ts @@ -931,6 +931,13 @@ const disabledServerListLines = ( } }; +/** Strip terminal LF without rescanning internal blank-line runs. */ +const withoutTrailingLineFeeds = (text: string): string => { + let end = text.length; + while (end > 0 && text.charCodeAt(end - 1) === 10) end -= 1; + return text.slice(0, end); +}; + /** * Replace REA's TOML server tables and assignments. Comments that introduce a * following table stay. Codex also retains comments around REA's own table. @@ -1108,13 +1115,13 @@ const upsertTomlServerSection = ( // The last kept CRLF line has no following LF from the join. if (body.endsWith("\r")) body += "\n"; if (entry !== undefined && !inlineServerTable) { - let fragment = stringifyToml({ - mcp_servers: { [serverKey]: entry }, - }).replace(/\n+$/u, ""); + let fragment = withoutTrailingLineFeeds( + stringifyToml({ mcp_servers: { [serverKey]: entry } }), + ); if (crlf) fragment = fragment.replaceAll("\n", "\r\n"); const nl = crlf ? "\r\n" : "\n"; const endedWithNewline = body.endsWith("\n"); - const base = body.replace(/\n+$/u, ""); + const base = withoutTrailingLineFeeds(body); const trimmed = endedWithNewline && base.endsWith("\r") ? base.slice(0, -1) : base; body = diff --git a/src/domain/propertyListXml.test.ts b/src/domain/propertyListXml.test.ts index 586510b2c8..5fb361563f 100644 --- a/src/domain/propertyListXml.test.ts +++ b/src/domain/propertyListXml.test.ts @@ -114,7 +114,9 @@ it("keeps XML numeric overflow and unreadable text explicitly unknown", () => { const parsed = parseXmlPropertyList( "1e999-1e999 nan -naninfinite", ); - expect(parsed.value).toEqual(Array.from({ length: 5 }, () => new UnknownPlistReal())); + expect(parsed.value).toEqual( + Array.from({ length: 5 }, () => new UnknownPlistReal()), + ); expect(parsed.numberLiterals.incomplete).toBe(false); }); diff --git a/tests/boundary/filesystem/keyedArchiveSelection.test.ts b/tests/boundary/filesystem/keyedArchiveSelection.test.ts index 710f04e9e1..37195e4ea5 100644 --- a/tests/boundary/filesystem/keyedArchiveSelection.test.ts +++ b/tests/boundary/filesystem/keyedArchiveSelection.test.ts @@ -318,7 +318,7 @@ it.skipIf(process.platform === "darwin" || process.platform === "win32")( }, ); -it("keeps an archive readable when a non-finite real is an explicit unknown", async () => { +it("keeps an archive readable while preserving a known non-finite real", async () => { const root = await bundle(); const bytes = Buffer.from( build({ @@ -340,11 +340,13 @@ it("keeps an archive readable when a non-finite real is an explicit unknown", as expect(result.objects).toContainEqual( expect.objectContaining({ id: 1, - value: { $plist_type: "real", value: null }, + kind: "scalar", + status: "observed", + value: { $plist_type: "real", value: "nan" }, }), ); expect(result.limitations).toContain( - '1 non-finite real value(s) are reported as { "$plist_type": "real", "value": null } because JSON evidence cannot preserve NaN vs infinity.', + '1 non-finite real value(s) are reported as { "$plist_type": "real", "value": "" } using canonical numeric labels nan, +infinity or -infinity because a JSON number cannot carry them.', ); }); diff --git a/tests/boundary/process/verifierFileResources.test.ts b/tests/boundary/process/verifierFileResources.test.ts index f6d45f1abf..4c8bfbf289 100644 --- a/tests/boundary/process/verifierFileResources.test.ts +++ b/tests/boundary/process/verifierFileResources.test.ts @@ -265,7 +265,8 @@ it("Ghidra verifier awaits native prerequisite rejection before creating target encoding: "utf8", timeout: 10_000, env: { - PATH: root, + // Keep native process inspectors available; the selected JDK and Ghidra are absent. + PATH: process.env.PATH ?? "", HOME: root, USERPROFILE: root, GHIDRA_INSTALL_DIR: join(root, "absent-installation"),