Skip to content

feat: PR4b — binary decoder, fallback migration, logical clear#9

Open
mrmidi wants to merge 1 commit into
pr3a/signpostsfrom
pr4b/binary-decoder
Open

feat: PR4b — binary decoder, fallback migration, logical clear#9
mrmidi wants to merge 1 commit into
pr3a/signpostsfrom
pr4b/binary-decoder

Conversation

@mrmidi

@mrmidi mrmidi commented Jul 21, 2026

Copy link
Copy Markdown
Owner

PR4b — Binary Decoder, Fallback Migration, Logical Clear

Base: pr3a/signposts · Head: dbb683d · 8 files, +511/-65

TunnelDiagnosticsDecoder

Injectable, unknown-safe app-side decoder:

  • mach_timebase_info tick→seconds conversion (no hardcoded 1ns assumption)
  • Per-process wall-time anchors from processStarted events
  • timestamp == nil when no matching process anchor
  • FptnReadStatus: OK / FileNotFound / InvalidHeader / Empty / IoError
  • Full ring header validation: magic, schema, geometry, header CRC, file size
  • errno-based classification (ENOENT vs IoError)
  • Null-safe output_count check
  • Failure report filtered by processToken + sessionToken
  • Logical clear watermark (hides events at/below watermark, no file deletion)

VPNService migration

  • evaluateFallbackDecision → binary lifecycle snapshot
  • Controlled-stop checked first (45s trust window), then freshness recheck
  • Failure report uses makeFailureReport() (session-filtered)

LogsViewModel migration

  • Export uses binary decoder
  • Clear writes logical watermark instead of deleting binary files

Event value payloads

Event value0 value1 value2 flags
transportDisconnected disconnectCode stopOrigin activeOps [0]=wasConnected
reconnectScheduled attempt delaySeconds [0]=pathSatisfied
memoryWarning/Critical footprint resident peak

Memory recording separated from OSLog throttle (level-change tracking). Peak captured under diagnosticsLock.

Schema ABI

fptn_diagnostics_schema_version, fptn_flight_recorder_capacity, fptn_flight_recorder_record_size, fptn_flight_ring_file_size

Remaining

  • FptnShared 0.3.0 integration (after PR4a merge/tag)
  • Remove private IPC duplicates from VPNService

Verification

  • Xcode Debug build: succeeded
  • Tests: 27/27 passed

Stack

PR3A  Instruments signposts       (base)
PR4a  FptnShared IPC contracts    (FptnShared #1, pending merge)
PR4b  Binary decoder + migration  ← this PR
PR5   Packet-copy reduction

@mrmidi
mrmidi force-pushed the pr4b/binary-decoder branch 4 times, most recently from 488aec3 to dbb683d Compare July 22, 2026 04:28
@mrmidi mrmidi changed the title feat: PR4b — populate event value payloads + value parameters feat: PR4b — binary decoder, fallback migration, logical clear Jul 22, 2026
TunnelDiagnosticsDecoder (FptnVPN/Services/):
- Injectable paths, clocks, ticksToSeconds (mach_timebase_info)
- Per-process wall-time anchors from processStarted events
- Unknown-safe: preserves raw event codes, timestamp nil without anchor
- FptnReadStatus: OK/FileNotFound/InvalidHeader/Empty/IoError
- Full ring header validation: magic, schema, geometry, CRC, file size
- errno-based status (ENOENT vs IoError)
- Null-safe output_count check
- Failure report filtered by processToken + sessionToken
- Logical clear watermark (hide events at/below watermark)

VPNService migration:
- evaluateFallbackDecision uses binary snapshot
- Controlled-stop check first (trust window), then freshness recheck
- Failure report uses makeFailureReport (session-filtered)

LogsViewModel migration:
- Export uses binary decoder
- Clear writes logical watermark instead of deleting binary files

Event value payloads:
- transportDisconnected: value0=disconnectCode, value1=stopOrigin,
  value2=activeOps, flags[0]=wasConnected
- reconnectScheduled: value0=attempt, value1=delaySeconds, flags[0]=pathSatisfied
- memoryWarning/Critical: value0=footprint, value1=resident, value2=peak
- Memory recording separated from OSLog throttle (level-change tracking)
- physicalFootprintPeakBytes captured under diagnosticsLock

Schema ABI:
- fptn_diagnostics_schema_version, capacity, record_size, ring_file_size
- FptnReadStatus enum in public C header

Remaining: FptnShared 0.3.0 integration (after PR4a merge/tag)

Tests: 27/27 passed. 8 files, +500/-65.
@mrmidi
mrmidi force-pushed the pr4b/binary-decoder branch from dbb683d to ef9d270 Compare July 22, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant