Skip to content

Cover oscompat with Stable API guards - #57960

Open
j-piasecki wants to merge 2 commits into
react:mainfrom
j-piasecki:export-D116012538
Open

Cover oscompat with Stable API guards#57960
j-piasecki wants to merge 2 commits into
react:mainfrom
j-piasecki:export-D116012538

Conversation

@j-piasecki

Copy link
Copy Markdown
Contributor

Summary:
oscompat is an implementation detail with no stability guarantee, so OSCompat.h now includes <react/cxxstableapi/PrivateGuard.h>, making it a hard error to include from outside React Native's own build under RN_STRICT_API. The guard is inert without that macro, so nothing changes for existing consumers. Buck, CMake and podspec wiring is added for the new dependency.

That surfaced a leak: jsinspector-modern/tracing/TraceRecordingState.h included <oscompat/OSCompat.h> without using it, exposing the now-private header through HostTarget.h, InstanceTarget.h, RuntimeTarget.h, RuntimeAgent.h and HostTargetTraceRecording.h. The unused include is removed, NetworkReporterTest.cpp relied on that transitive path and now includes the header directly, and oscompat moves to deps on the tracing target to match.

Changelog: [Internal]

Differential Revision: D116012538

Dawid Małecki and others added 2 commits August 13, 2026 04:32
Differential Revision: D109847184
Summary:
`oscompat` is an implementation detail with no stability guarantee, so `OSCompat.h` now includes `<react/cxxstableapi/PrivateGuard.h>`, making it a hard error to include from outside React Native's own build under `RN_STRICT_API`. The guard is inert without that macro, so nothing changes for existing consumers. Buck, CMake and podspec wiring is added for the new dependency.

That surfaced a leak: `jsinspector-modern/tracing/TraceRecordingState.h` included `<oscompat/OSCompat.h>` without using it, exposing the now-private header through `HostTarget.h`, `InstanceTarget.h`, `RuntimeTarget.h`, `RuntimeAgent.h` and `HostTargetTraceRecording.h`. The unused include is removed, `NetworkReporterTest.cpp` relied on that transitive path and now includes the header directly, and `oscompat` moves to `deps` on the tracing target to match.

Changelog: [Internal]

Differential Revision: D116012538
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 14, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Aug 14, 2026
@meta-codesync

meta-codesync Bot commented Aug 14, 2026

Copy link
Copy Markdown

@j-piasecki has exported this pull request. If you are a Meta employee, you can view the originating Diff in D116012538.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant