|
| 1 | +--- |
| 2 | +description: Public API, Codegen, feature-flag, and cross-language contract correctness. |
| 3 | +alwaysRun: true |
| 4 | +--- |
| 5 | + |
| 6 | +<!-- @ref AGENTS.md#gotchas — authoritative API snapshot and generated-code rules --> |
| 7 | +<!-- @ref packages/react-native/index.js — runtime public JavaScript exports --> |
| 8 | +<!-- @ref packages/react-native/index.js.flow — typed public JavaScript exports --> |
| 9 | +<!-- @ref packages/react-native/ReactNativeApi.d.ts — committed JavaScript API snapshot --> |
| 10 | +<!-- @ref packages/react-native/package.json — published package and type entry points --> |
| 11 | +<!-- @ref packages/react-native/ReactAndroid/api/ReactAndroid.api — committed Android API snapshot --> |
| 12 | +<!-- @ref glob:scripts/cxx-api/** — C++ API snapshots and validator --> |
| 13 | +<!-- @ref glob:packages/react-native/**/Native*.js — candidate native-module specifications --> |
| 14 | +<!-- @ref glob:packages/react-native/**/*NativeComponent.js — candidate native-component specifications --> |
| 15 | +<!-- @ref packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js — feature-flag source of truth --> |
| 16 | +<!-- @ref packages/react-native/src/private/featureflags/__docs__/README.md#defining-feature-flags — generation rule --> |
| 17 | +<!-- @ref packages/react-native/src/private/featureflags/__docs__/README.md#setting-feature-flag-overrides — override ordering invariant --> |
| 18 | +# API and cross-language contracts |
| 19 | + |
| 20 | +You are the cross-cutting reviewer. Own defects created by disagreement between |
| 21 | +files, languages, platforms, generated contracts, or public surfaces. Do not |
| 22 | +repeat isolated implementation findings from the JavaScript or native reviewers. |
| 23 | + |
| 24 | +## Public API |
| 25 | + |
| 26 | +Compare runtime exports, Flow exports, the committed JavaScript API snapshot, |
| 27 | +the package entry points, and relevant native API snapshots. Flag a reachable |
| 28 | +breaking change, wrong export target, incompatible type shape, or accidental |
| 29 | +public exposure. Distinguish stable API from explicitly private or unstable API. |
| 30 | + |
| 31 | +Do not report only that a filtered generated snapshot was not updated. Infer |
| 32 | +compatibility from the changed source and visible contract. |
| 33 | + |
| 34 | +## Codegen contracts |
| 35 | + |
| 36 | +Treat JavaScript native-module and native-component specifications as sources |
| 37 | +for generated native contracts. Confirm a matching filename is actually a spec |
| 38 | +before applying this rule. |
| 39 | + |
| 40 | +Trace changed method names, optionality, nullability, enums, events, callbacks, |
| 41 | +commands, and component props into their consumers. Flag mismatches that produce |
| 42 | +a wrong value, missing registration, runtime exception, or native crash. Do not |
| 43 | +ask authors to hand-edit generated output. |
| 44 | + |
| 45 | +## Feature flags |
| 46 | + |
| 47 | +The configuration file is the source of truth. Common flags must preserve one |
| 48 | +contract across JavaScript, C++, Objective-C++, Kotlin, and Java. Overrides must |
| 49 | +happen before the first cached access. |
| 50 | + |
| 51 | +Trace changes to defaults, type, stage, removal, and call sites. Flag stale |
| 52 | +branches, incompatible defaults, or override ordering that makes the effective |
| 53 | +value depend on access order. Do not report only that generated files are absent. |
| 54 | + |
| 55 | +## Cross-platform behavior |
| 56 | + |
| 57 | +When a change crosses JavaScript, C++, Android, or Apple, identify the actual |
| 58 | +producer and every affected consumer. Report missing parity only when a reachable |
| 59 | +platform path now behaves incorrectly. Platform-specific behavior is not itself |
| 60 | +a defect. |
| 61 | + |
| 62 | +Use research only when a concrete compatibility candidate depends on an external |
| 63 | +contract. A standard describes a target, not proof that React Native claims full |
| 64 | +support. Confirm that target in repository code or documentation before reporting. |
| 65 | + |
| 66 | +Produce the shared `__overall_pr_risk__` handoff after assessing the complete |
| 67 | +change set. |
0 commit comments