feat: PR3 — native binary diagnostics core (C ABI + C++23)#7
Open
mrmidi wants to merge 1 commit into
Open
Conversation
mrmidi
force-pushed
the
pr3/binary-diagnostics
branch
5 times, most recently
from
July 21, 2026 12:10
6191d73 to
f478402
Compare
TunnelDiagnosticsCore static library: - C++23 implementation with RAII (PosixFile, FlightRecorder, LifecycleStore) - C-compatible public ABI (void* opaque handles, extern "C") - Explicit little-endian byte serialization (no struct dumps) - CRC32 checksums on all records and snapshots - 72-byte flight events, 120-record ring (8,704 bytes fixed) - Double-buffered lifecycle snapshot (2 × 512 bytes) - Thread-safe recorder (internal mutex) - Reopen recovery: scans existing records, resumes from max sequence - No exceptions, no RTTI, no heap allocation on record path Swift wrappers: - TunnelFlightRecorder: RAII over C handle, allocation-free record() - TunnelLifecycleSnapshotStore: RAII over C handle - ProviderProcessIdentity: process-lifetime token + mach timestamp - TunnelFlightEventCode: 24 numeric event codes Build integration: - DiagnosticsCoreBase XcodeGen template (library.static) - Platform targets: iOS, macOS, tvOS - Bridging headers include FptnTunnelDiagnostics.h - HEADER_SEARCH_PATHS for app + tunnel targets Provider integration (initial): - Flight recorder + snapshot store initialized in startTunnel - process_started + start_tunnel events recorded with fsync - Per-tunnel session token generated Remaining: full call-site migration, app-side decoder, fallback migration, legacy JSON gate — follow-up commits. Tests: 27/27 passed. Debug build succeeded.
mrmidi
force-pushed
the
pr3/binary-diagnostics
branch
from
July 21, 2026 14:52
f478402 to
76ac6e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR3 — Native Binary Diagnostics Core
Base:
pr2/provider-integration· Head:76ac6e4· 17 files, +1739/-98C++ core (TunnelDiagnosticsCore static library)
void*handles)PosixFile,FlightRecorder,LifecycleStoreProvider integration — complete
flightEvent:codes (mandatory parameter, no fallback mapping)recordProviderEvent→flightRecorder.record()(numeric,@autoclosuremessage never evaluated)updateDiagnosticsHeartbeat→writeLifecycleSnapshot()(binary snapshot, no JSON)TunnelDiagnosticsStorecalls from the providerdiagnosticsLockprotectslatestEventSequenceandphysicalFootprintPeakByteswsClientandlastNativeStatuscopied understateLock, status queried outside lockLocalStopInitiator.binaryCode(1/2/3) andTunnelRuntimeState.binaryCode(0-6) — nohashValueWhat was removed
flightEventCode(for:)category mapping (explicit codes are the contract)updateDiagnosticsHeartbeat(snapshot:lastEvent:)overload (no doublecurrentSnapshot())#if FPTN_MEASUREMENT_BUILDgates on diagnostics (no JSONL to gate)Kept (app-side, unrelated)
Verification
flightEvent:: compiler enforces — no call site can regress to unmapped eventsRemaining (follow-up PRs)
TunnelDiagnosticsDecoder)Stack