fix: harden mac browser proxy regression test openclaw#43069 thanks @Effet

This commit is contained in:
Frank Yang
2026-03-11 18:25:24 +08:00
parent aebcff8ce5
commit 04c33fa061
2 changed files with 17 additions and 4 deletions

View File

@@ -165,6 +165,7 @@ Docs: https://docs.openclaw.ai
- Auth/profile resolution: log debug details when auto-discovered auth profiles fail during provider API-key resolution, so `--debug` output surfaces the real refresh/keychain/credential-store failure instead of only the generic missing-key message. (#41271) thanks @he-yufeng.
- ACP/cancel scoping: scope `chat.abort` and shared-session ACP event routing by `runId` so one session cannot cancel or consume another session's run when they share the same gateway session key. (#41331) Thanks @pejmanjohn.
- SecretRef/models: harden custom/provider secret persistence and reuse across models.json snapshots, merge behavior, runtime headers, and secret audits. (#42554) Thanks @joshavant.
- macOS/browser proxy: serialize non-GET browser proxy request bodies through `AnyCodable.foundationValue` so nested JSON bodies no longer crash the macOS app with `Invalid type in JSON write (__SwiftValue)`. (#43069) Thanks @Effet.
## 2026.3.7

View File

@@ -39,9 +39,21 @@ struct MacNodeBrowserProxyTests {
#expect(tabs[0]["id"] as? String == "tab-1")
}
// Regression test: POST body with nested AnyCodable must not crash with __SwiftValue
// Regression test: nested POST bodies must serialize without __SwiftValue crashes.
@Test func postRequestSerializesNestedBodyWithoutCrash() async throws {
var capturedBody: Data?
actor BodyCapture {
private var body: Data?
func set(_ body: Data?) {
self.body = body
}
func get() -> Data? {
self.body
}
}
let capturedBody = BodyCapture()
let proxy = MacNodeBrowserProxy(
endpointProvider: {
MacNodeBrowserProxy.Endpoint(
@@ -50,7 +62,7 @@ struct MacNodeBrowserProxyTests {
password: nil)
},
performRequest: { request in
capturedBody = request.httpBody
await capturedBody.set(request.httpBody)
let url = try #require(request.url)
let response = try #require(
HTTPURLResponse(
@@ -64,7 +76,7 @@ struct MacNodeBrowserProxyTests {
_ = try await proxy.request(
paramsJSON: #"{"method":"POST","path":"/action","body":{"nested":{"key":"val"},"arr":[1,2]}}"#)
let bodyData = try #require(capturedBody)
let bodyData = try #require(await capturedBody.get())
let parsed = try #require(JSONSerialization.jsonObject(with: bodyData) as? [String: Any])
let nested = try #require(parsed["nested"] as? [String: Any])
#expect(nested["key"] as? String == "val")