adds the ability to run example app tests against d14n testnet staging#774
Conversation
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
| const afterPlugins = contents.indexOf('apply plugin: "com.facebook.react"') | ||
| if (afterPlugins === -1) { | ||
| return config | ||
| } | ||
| const insertAt = contents.indexOf('\n', afterPlugins) + 1 |
There was a problem hiding this comment.
🟢 Low plugins/withReactNativeConfigEnv.js:21
If apply plugin: "com.facebook.react" is the last line without a trailing newline, indexOf('\n', afterPlugins) returns -1, so insertAt becomes 0. This prepends the comment and dotenv.gradle to the start of the file instead of after the plugin line, corrupting the gradle structure. Consider handling the -1 case to append at the end of the file when no newline is found.
- const insertAt = contents.indexOf('\n', afterPlugins) + 1
+ const nextNewline = contents.indexOf('\n', afterPlugins)
+ const insertAt = nextNewline === -1 ? contents.length : nextNewline + 1🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file example/plugins/withReactNativeConfigEnv.js around lines 21-25:
If `apply plugin: "com.facebook.react"` is the last line without a trailing newline, `indexOf('\n', afterPlugins)` returns `-1`, so `insertAt` becomes `0`. This prepends the comment and `dotenv.gradle` to the start of the file instead of after the plugin line, corrupting the gradle structure. Consider handling the `-1` case to append at the end of the file when no newline is found.
Evidence trail:
example/plugins/withReactNativeConfigEnv.js lines 21-29 at REVIEWED_COMMIT. Line 25 shows `const insertAt = contents.indexOf('\n', afterPlugins) + 1` which returns 0 when indexOf returns -1 (no newline found). Lines 26-29 show the slicing logic that would prepend content to the start of the file when insertAt is 0.
b2cec4d to
ce540e7
Compare
e0d9d66 to
3d8c892
Compare
3d8c892 to
1725e55
Compare
ce540e7 to
dc9a8dd
Compare
| `Expected 1 preference update, got ${types.length}` | ||
| ) | ||
|
|
||
| alix.preferences.cancelStreamConsent() |
There was a problem hiding this comment.
🟡 Medium tests/historySyncTests.ts:247
alix.preferences.cancelStreamConsent() cancels the wrong stream — the test started streamPreferenceUpdates at line 225, not streamConsent. This leaves the preference updates stream uncancelled, causing resource leaks and potential interference with subsequent tests.
| alix.preferences.cancelStreamConsent() | |
| alix.preferences.cancelStreamPreferenceUpdates() |
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file example/src/tests/historySyncTests.ts around line 247:
`alix.preferences.cancelStreamConsent()` cancels the wrong stream — the test started `streamPreferenceUpdates` at line 225, not `streamConsent`. This leaves the preference updates stream uncancelled, causing resource leaks and potential interference with subsequent tests.
Evidence trail:
example/src/tests/historySyncTests.ts lines 220-250 (REVIEWED_COMMIT): Line 225 calls `await alix.preferences.streamPreferenceUpdates(...)`, Line 247 calls `alix.preferences.cancelStreamConsent()`
src/lib/PrivatePreferences.ts lines 145-180 (REVIEWED_COMMIT): Shows `cancelStreamConsent()` at line 154 cancels consent-related subscriptions (EventTypes.Consent) and `cancelStreamPreferenceUpdates()` at line 169 cancels preference update subscriptions (EventTypes.PreferenceUpdates) - these are separate methods for separate streams
| // Create a default metadata object when null | ||
| mapOf( | ||
| "archiveVersion" to 0u, | ||
| "elements" to listOf("messages", "consent"), |
There was a problem hiding this comment.
🟡 Medium wrappers/ArchiveMetadataWrapper.kt:42
encodeToMap returns "messages" (plural) for the null-metadata default, but getArchiveElementString returns "message" (singular) for ArchiveElement.MESSAGES and the catch block fallback also uses "message". Downstream consumers expecting consistent element names receive "messages" when metadata is null but "message" when encoding succeeds or fails.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ArchiveMetadataWrapper.kt around line 42:
`encodeToMap` returns `"messages"` (plural) for the null-metadata default, but `getArchiveElementString` returns `"message"` (singular) for `ArchiveElement.MESSAGES` and the catch block fallback also uses `"message"`. Downstream consumers expecting consistent element names receive `"messages"` when metadata is null but `"message"` when encoding succeeds or fails.
Evidence trail:
android/src/main/java/expo/modules/xmtpreactnativesdk/wrappers/ArchiveMetadataWrapper.kt at REVIEWED_COMMIT:
- Line 42: `"elements" to listOf("messages", "consent")` (plural "messages")
- Line 28: `ArchiveElement.MESSAGES -> "message"` (singular "message")
- Lines 18-20: catch block returns `listOf("message", "consent")` (singular "message")

Add d14n testnet staging environment support to example app tests
TestEnvOptiontype andgetTestEnv/setTestEnvutilities in testEnv.ts to track a global test environment selection (local,dev, ord14n).createClientsin test-utils.ts to default to the globally selected environment; whend14nis selected, it routes todevwith a requiredGATEWAY_HOSTenv variable and throws if absent.react-native-config'sdotenv.gradleintoapp/build.gradleduring Android prebuild, enabling.envvariables (includingGATEWAY_HOST) inBuildConfig.createClientsnow throws at runtime ifd14nis selected butGATEWAY_HOSTis not set in the environment.📊 Macroscope summarized dc9a8dd. 7 files reviewed, 2 issues evaluated, 0 issues filtered, 1 comment posted
(Automatic summaries will resume when PR exits draft mode or review begins).🗂️ Filtered Issues