ReviewOS

also looking at this

craft-native/craft

fix(native): preserve workspace sources and native overlay lifecycle

#384
Merged chris wants to merge codex/windows-zig-cache-diagnostics into main
20 files +500 -227

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

packages/ios/fixtures/native-screen/NativeRenderUITests.swiftmodified+10-4
Changes to packages/ios/fixtures/native-screen/NativeRenderUITests.swift
@@ -39,14 +39,20 @@ final class NativeRenderUITests: XCTestCase {
3939 notes.tap()
4040 XCTAssertTrue(keyboardIsVisible(app))
4141 notes.typeText("Easy run")
42 // Read the original acknowledgement first: inspecting other UIKit
43 // elements must not hide a delayed bridge update from this assertion.
44 let acknowledgement = app.staticTexts["notes"].label
42 // The native value and the script acknowledgement cross different threads.
43 let firstAcknowledgement = app.staticTexts["notes"].label
4544 let typedValue = notes.value as? String
4645 let keyboardVisible = app.keyboards.firstMatch.exists
4746 XCTAssertEqual(typedValue, "Easy run", "the native text view lost typed characters")
4847 XCTAssertTrue(keyboardVisible, "typing dismissed the native keyboard")
49 XCTAssertEqual(acknowledgement, "Notes: Easy run", "native value: \(typedValue ?? "nil"), keyboard visible: \(keyboardVisible)")
48 let acknowledgement = XCTNSPredicateExpectation(
49 predicate: NSPredicate(format: "label == %@", "Notes: Easy run"),
50 object: app.staticTexts["notes"]
51 )
52 XCTAssertEqual(XCTWaiter.wait(for: [acknowledgement], timeout: 5), .completed, "first acknowledgement: \(firstAcknowledgement)")
53 XCTAssertEqual(app.staticTexts["notes"].label, "Notes: Easy run")
54 XCTAssertEqual(notes.value as? String, "Easy run", "the script acknowledgement overwrote native typing")
55 XCTAssertTrue(app.keyboards.firstMatch.exists, "the script acknowledgement dismissed the keyboard")
5056 }
5157
5258 func testSwitchTapChangesUIKitStateAndDeliversValueChange() throws {
packages/ios/fixtures/native-screen/NativeRenderUnitTests.swiftmodified+7-0
Changes to packages/ios/fixtures/native-screen/NativeRenderUnitTests.swift
@@ -2612,13 +2612,20 @@ final class NativeRenderUnitTests: XCTestCase {
26122612
26132613 func testSwitchReceivesNativeTouchesWhenMountedInAFlowView() throws {
26142614 let controller = CraftNativeScreenController(config: CraftConfig())
2615 let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 390, height: 844))
2616 window.rootViewController = controller
26152617 controller.loadViewIfNeeded()
26162618 controller.render(document([[
26172619 "type": "View",
26182620 "props": ["key": "root"],
26192621 "children": [["type": "Switch", "props": ["testID": "native-switch"]]],
26202622 ]]))
2623 window.isHidden = false
2624 defer { window.isHidden = true }
2625 controller.view.layoutIfNeeded()
26212626 let toggle = try XCTUnwrap(find(UISwitch.self, key: "native-switch", below: controller.view))
2627 XCTAssertGreaterThan(toggle.bounds.width, 0)
2628 XCTAssertGreaterThan(toggle.bounds.height, 0)
26222629 XCTAssertTrue(toggle.isUserInteractionEnabled)
26232630 XCTAssertTrue(toggle.isEnabled)
26242631 let point = toggle.convert(CGPoint(x: toggle.bounds.midX, y: toggle.bounds.midY), to: controller.view)