Skip to content

Commit d50c3e7

Browse files
authored
feat: restore startup stall recovery for app launches (#78)
Restore startup stall recovery for RN-ready app launches, including restart-between-files. Startup retries now pause on Metro bundling activity, resume afterward, and still fail immediately on confirmed native crashes.
1 parent c0fabe9 commit d50c3e7

9 files changed

Lines changed: 678 additions & 111 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
__default__: patch
3+
---
4+
5+
Harness now restores app startup stall recovery for RN-ready launches, including restart-between-files. Apps are retried when startup stalls without a crash, while confirmed native crashes still fail immediately with crash diagnostics.

actions/shared/index.cjs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4225,10 +4225,8 @@ var ConfigSchema = external_exports.object({
42254225
metroPort: external_exports.number().int("Metro port must be an integer").min(1, "Metro port must be at least 1").max(65535, "Metro port must be at most 65535").optional().default(DEFAULT_METRO_PORT),
42264226
webSocketPort: external_exports.number().optional().default(3001),
42274227
bridgeTimeout: external_exports.number().min(1e3, "Bridge timeout must be at least 1 second").default(6e4),
4228-
/** @deprecated Removed in favor of crash supervisor. Accepted for backwards compatibility. */
4229-
bundleStartTimeout: external_exports.number().optional(),
4230-
/** @deprecated Removed in favor of crash supervisor. Accepted for backwards compatibility. */
4231-
maxAppRestarts: external_exports.number().optional(),
4228+
bundleStartTimeout: external_exports.number().min(1e3, "Bundle start timeout must be at least 1 second").default(15e3),
4229+
maxAppRestarts: external_exports.number().min(0, "Max app restarts must be at least 0").default(2),
42324230
resetEnvironmentBetweenTestFiles: external_exports.boolean().optional().default(true),
42334231
unstable__skipAlreadyIncludedModules: external_exports.boolean().optional().default(false),
42344232
unstable__enableMetroCache: external_exports.boolean().optional().default(false),
@@ -4415,20 +4413,6 @@ var import_node_path5 = __toESM(require("path"), 1);
44154413
var import_node_fs5 = __toESM(require("fs"), 1);
44164414
var import_node_module2 = require("module");
44174415
var import_meta = {};
4418-
var DEPRECATED_PROPERTIES = {
4419-
bundleStartTimeout: '"bundleStartTimeout" is no longer used and can be removed from your config. Startup crash detection is now handled automatically by the crash supervisor.',
4420-
maxAppRestarts: '"maxAppRestarts" is no longer used and can be removed from your config. Startup crash detection is now handled automatically by the crash supervisor.'
4421-
};
4422-
var warnDeprecatedProperties = (rawConfig) => {
4423-
if (typeof rawConfig !== "object" || rawConfig === null) {
4424-
return;
4425-
}
4426-
for (const [key, message] of Object.entries(DEPRECATED_PROPERTIES)) {
4427-
if (key in rawConfig) {
4428-
console.warn(`[react-native-harness] Deprecation warning: ${message}`);
4429-
}
4430-
}
4431-
};
44324416
var extensions = [".js", ".mjs", ".cjs", ".json"];
44334417
var importUp = async (dir, name) => {
44344418
const filePath = import_node_path5.default.join(dir, name);
@@ -4447,7 +4431,6 @@ var importUp = async (dir, name) => {
44474431
throw new ConfigLoadError(filePathWithExt, error instanceof Error ? error : void 0);
44484432
}
44494433
try {
4450-
warnDeprecatedProperties(rawConfig);
44514434
const config = ConfigSchema.parse(rawConfig);
44524435
return { config, filePathWithExt, configDir: dir };
44534436
} catch (error) {

packages/config/src/reader.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,6 @@ import fs from 'node:fs';
99
import { createRequire } from 'node:module';
1010
import { ZodError } from 'zod';
1111

12-
const DEPRECATED_PROPERTIES: Record<string, string> = {
13-
bundleStartTimeout:
14-
'"bundleStartTimeout" is no longer used and can be removed from your config. Startup crash detection is now handled automatically by the crash supervisor.',
15-
maxAppRestarts:
16-
'"maxAppRestarts" is no longer used and can be removed from your config. Startup crash detection is now handled automatically by the crash supervisor.',
17-
};
18-
19-
const warnDeprecatedProperties = (rawConfig: unknown) => {
20-
if (typeof rawConfig !== 'object' || rawConfig === null) {
21-
return;
22-
}
23-
24-
for (const [key, message] of Object.entries(DEPRECATED_PROPERTIES)) {
25-
if (key in rawConfig) {
26-
console.warn(`[react-native-harness] Deprecation warning: ${message}`);
27-
}
28-
}
29-
};
30-
3112
const extensions = ['.js', '.mjs', '.cjs', '.json'];
3213

3314
const importUp = async (
@@ -62,7 +43,6 @@ const importUp = async (
6243
}
6344

6445
try {
65-
warnDeprecatedProperties(rawConfig);
6646
const config = ConfigSchema.parse(rawConfig);
6747
return { config, filePathWithExt, configDir: dir };
6848
} catch (error) {

packages/config/src/types.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ export const ConfigSchema = z
3737
.min(1000, 'Bridge timeout must be at least 1 second')
3838
.default(60000),
3939

40-
/** @deprecated Removed in favor of crash supervisor. Accepted for backwards compatibility. */
41-
bundleStartTimeout: z.number().optional(),
42-
/** @deprecated Removed in favor of crash supervisor. Accepted for backwards compatibility. */
43-
maxAppRestarts: z.number().optional(),
40+
bundleStartTimeout: z
41+
.number()
42+
.min(1000, 'Bundle start timeout must be at least 1 second')
43+
.default(15000),
44+
maxAppRestarts: z
45+
.number()
46+
.min(0, 'Max app restarts must be at least 0')
47+
.default(2),
4448

4549
resetEnvironmentBetweenTestFiles: z.boolean().optional().default(true),
4650
unstable__skipAlreadyIncludedModules: z.boolean().optional().default(false),

0 commit comments

Comments
 (0)