Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(test): keep mobile native boundary contract in guard

MagicLizi59dbdb9cbe67
diff --git a/apps/mobile/src/__tests__/composerPullThroughAttach.test.ts b/apps/mobile/src/__tests__/composerPullThroughAttach.test.ts
index 9a16494322..c07247fbdd 100644
--- a/apps/mobile/src/__tests__/composerPullThroughAttach.test.ts
+++ b/apps/mobile/src/__tests__/composerPullThroughAttach.test.ts
@@ -1,6 +1,4 @@
import { describe, expect, it, vi } from 'vitest';
-import { readFileSync } from 'node:fs';
-import { resolve } from 'node:path';
vi.mock('react-native', () => ({
Animated: { ScrollView: {} },
@@ -20,16 +18,6 @@ vi.mock('@/platform/gestureHandler', () => ({
import { resolvePullThroughAttach } from '@/session/composerPullThrough';
-// 回归锁:runOnJS 的返回值若被保存进变量再在 worklet 里调用,会序列化成不可直接
-// 调用的 RemoteFunction 代理,UI 线程一调就报 Tried to synchronously call a Remote
-// Function(Greptile P1)。必须保持 reaction 内联调用写法。
-const composerPullThroughSource = readFileSync(
- resolve(process.cwd(), 'src/session/composerPullThrough.tsx'), 'utf8',
-).replace(/\r\n/g, '\n');
-
-expect(composerPullThroughSource).toContain('runOnJS(setAttach)(');
-expect(composerPullThroughSource).not.toMatch(/=\s*runOnJS\(setAttach\)/);
-
describe('composer pull-through gesture attach gate', () => {
it('android keeps RNGH off the message list while the composer is idle', () => {
// RNGH 编排器接管触摸流会让 Android selectable 正文一拖就进选区、列表不滚。
diff --git a/apps/mobile/src/__tests__/mobileNativeBoundaryContracts.test.ts b/apps/mobile/src/__tests__/mobileNativeBoundaryContracts.test.ts
index e9e4fa7a22..ee213231af 100644
--- a/apps/mobile/src/__tests__/mobileNativeBoundaryContracts.test.ts
+++ b/apps/mobile/src/__tests__/mobileNativeBoundaryContracts.test.ts
@@ -3,6 +3,17 @@ import { resolve } from 'node:path';
import ts from 'typescript';
import { describe, expect, it } from 'vitest';
+// guard: Reanimated serializes worklet captures across UI/JS native runtimes.
+// A Node mock cannot reproduce a captured runOnJS wrapper becoming a non-callable
+// RemoteFunction; retain the original cross-runtime regression in required guard.
+it('invokes the composer attach bridge inline inside the worklet', () => {
+ const source = readFileSync(
+ resolve(process.cwd(), 'src/session/composerPullThrough.tsx'), 'utf8',
+ ).replace(/\r\n/g, '\n');
+ expect(source).toContain('runOnJS(setAttach)(');
+ expect(source).not.toMatch(/=\s*runOnJS\(setAttach\)/);
+});
+
// guard: export spans Swift rendering, a hidden WebView, and the system share
// extension's deferred file read. These contracts cannot run in the JS unit host.
it('bounds native export and preserves the hidden document and system share boundaries', () => {