// engine/execution-plan/mobile-dist/rn-steps.ts — SPEC-013
// Distribution steps for React Native (bare workflow) release specs.
function buildRnReleaseBuildStep(order) {
    return {
        order,
        title: 'React Native release build (iOS + Android)',
        description: 'Build signed release artifacts:\n' +
            '- iOS: `fastlane gym --workspace ios/App.xcworkspace --scheme App`\n' +
            '- Android: `cd android && ./gradlew bundleRelease`\n' +
            'Ensure Metro bundler is not used in production (`__DEV__ === false`).',
        files: ['ios/Podfile', 'android/app/build.gradle', 'Fastfile'],
        dependsOn: [],
        verification: 'IPA and AAB artifacts created. `codesign -dv` passes for iOS. `jarsigner -verify` passes for Android.',
        estimatedMinutes: 25,
        canRollback: false,
    };
}
function buildRnIOSUploadStep(order) {
    return {
        order,
        title: 'Upload iOS to TestFlight',
        description: 'Upload IPA to App Store Connect:\n' +
            '`fastlane pilot upload --ipa build/App.ipa`\n' +
            'Assign internal testers. Verify no Metro bundler warnings.',
        files: ['Fastfile'],
        dependsOn: [],
        verification: 'Build appears in TestFlight. No development-only code visible.',
        estimatedMinutes: 15,
        canRollback: false,
    };
}
function buildRnAndroidUploadStep(order) {
    return {
        order,
        title: 'Upload Android AAB to Google Play (internal track)',
        description: 'Upload AAB to Play Console internal testing:\n' +
            '`fastlane supply --aab android/app/build/outputs/bundle/release/app-release.aab --track internal`\n' +
            'Invite testers. Verify ProGuard/R8 did not strip required code.',
        files: ['Fastfile', 'android/app/proguard-rules.pro'],
        dependsOn: [],
        verification: 'AAB visible in Play Console. Testers can install. App does not crash on launch.',
        estimatedMinutes: 15,
        canRollback: false,
    };
}
function buildRnSmokeTestStep(order) {
    return {
        order,
        title: 'Smoke test on real devices',
        description: 'Install and test on physical devices:\n' +
            '- iOS: install via TestFlight app on iPhone/iPad\n' +
            '- Android: install via Play Console opt-in link\n' +
            'Verify: launch time, auth, core features, no JS bridge errors.',
        files: [],
        dependsOn: [],
        verification: 'App launches in < 3s. Core flows work. No yellow-box warnings in release build.',
        estimatedMinutes: 45,
        canRollback: false,
    };
}
function buildRnStoreSubmitStep(order) {
    return {
        order,
        title: 'Submit for store review (production)',
        description: 'Submit for production review:\n' +
            '- iOS: `fastlane deliver` or manual submission in App Store Connect\n' +
            '- Android: promote internal → production in Play Console\n' +
            'Complete: screenshots, privacy manifest, age rating, export compliance.',
        files: ['fastlane/metadata/', 'PrivacyInfo.xcprivacy', 'fastlane/metadata/android/'],
        dependsOn: [],
        verification: 'App Store Connect shows "In Review". Play Console production track activated.',
        estimatedMinutes: 30,
        canRollback: false,
    };
}
function buildRnPhasedRolloutStep(order) {
    return {
        order,
        title: 'Phased rollout',
        description: '- iOS: enable Phased Release in App Store Connect (automatic 7-day rollout)\n' +
            '- Android: configure rollout percentage in Play Console (1% → 100% over 7 days)\n' +
            'Monitor React Native-specific metrics: JS thread frame drops, bridge errors.',
        files: [],
        dependsOn: [],
        verification: 'Phased release active. Crash-free > 99.5%. JS bridge errors < 0.1%.',
        estimatedMinutes: 15,
        canRollback: true,
    };
}
function buildRnMonitorStep(order) {
    return {
        order,
        title: 'Post-release crash monitoring',
        description: 'Monitor 24h post-release:\n' +
            '- Crashlytics/Sentry: crash-free sessions > 99.5%\n' +
            '- Android Vitals: ANR < 0.47%, crash < 1.09%\n' +
            '- Perf metrics: app start < 3s, JS load < 1s\n' +
            'Rollback: halt phased release in stores if thresholds exceeded.',
        files: [],
        dependsOn: [],
        verification: 'No P0 crashes. Performance metrics stable. Rollback plan documented and ready.',
        estimatedMinutes: 60,
        canRollback: true,
    };
}
export function generateReactNativeDistributionPhase(startOrder) {
    let order = startOrder;
    return [
        buildRnReleaseBuildStep(order++),
        buildRnIOSUploadStep(order++),
        buildRnAndroidUploadStep(order++),
        buildRnSmokeTestStep(order++),
        buildRnStoreSubmitStep(order++),
        buildRnPhasedRolloutStep(order++),
        buildRnMonitorStep(order),
    ];
}
//# sourceMappingURL=rn-steps.js.map