Skip to content

feat(swift): add SBP-2 connector API - #7

Draft
gly11 wants to merge 1 commit into
pr/controller-bringup-recoveryfrom
pr/swift-sbp2-connector
Draft

gly11 wants to merge 1 commit into
pr/controller-bringup-recoveryfrom
pr/swift-sbp2-connector

Conversation

@gly11

@gly11 gly11 commented May 27, 2026

Copy link
Copy Markdown
Owner

Summary

This PR is stacked on pr/controller-bringup-recovery and adds the Swift-side SBP-2 connector API used by the app to call the driver user client.

Swift Connector

  • Add typed SBP-2 selectors and request/response helpers
  • Decode device discovery wire data into Swift-facing metadata
  • Add parsing coverage for the updated device discovery payloads

Why this PR

The Swift connector is the app-side bridge for the lower-level SBP-2 session work, but it remains reviewable without the later UI slices. Separating it keeps the review centered on wire-format parsing and user-client API shape.

This PR intentionally does not include debug UI, diagnostic handlers, local scripts, install helpers, or documentation-only planning notes.

Verification

Local verification completed for this slice:

git diff --check pr/controller-bringup-recovery..HEAD
xcodebuild -project ASFW.xcodeproj -scheme ASFW -configuration Debug -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO test

@gly11
gly11 force-pushed the pr/controller-bringup-recovery branch from 9959fde to b5eaa71 Compare May 27, 2026 14:06
@gly11
gly11 force-pushed the pr/swift-sbp2-connector branch from ab900ba to 62fa6d6 Compare May 27, 2026 14:06
@gly11
gly11 force-pushed the pr/controller-bringup-recovery branch from b5eaa71 to c122677 Compare May 27, 2026 14:28
@gly11
gly11 force-pushed the pr/swift-sbp2-connector branch 2 times, most recently from 7e2a8e1 to b8899e8 Compare May 27, 2026 14:44
@gly11
gly11 force-pushed the pr/swift-sbp2-connector branch from b8899e8 to 4c2d153 Compare May 27, 2026 14:58
@gly11
gly11 force-pushed the pr/controller-bringup-recovery branch from 478117c to 9453b4c Compare May 27, 2026 14:59
gly11 pushed a commit that referenced this pull request Jun 24, 2026
fix: advertise cPhyEnhance only when 1394a enhancements are enabled
gly11 pushed a commit that referenced this pull request Oct 2, 2026
…eardown

FCPTransportTests.RejectsResponseForInvalidatedRouteAfterRebind and
RejectsWriteCompletionFromInvalidatedRoute crashed with SEGFAULT.

Diagnosed with AddressSanitizer as stack-use-after-return, not the stack
overflow the fault address and unwind failure first suggested:

  ERROR: AddressSanitizer: stack-use-after-return
    #0 ...TestBody()::$_0::operator()   FCPTransportTests.cpp:129
    #7 FCPTransport::Shutdown()          FCPTransport.cpp:301
    #8 FCPTransportTests::TearDown()     FCPTransportTests.cpp:74

Both tests invalidate the route on purpose, so their command never completes and
is still pending when TearDown() runs Shutdown(). Shutdown() then completes
every pending and queued command with kTransportError -- correct behaviour, it
must not leak outstanding work -- which invokes a completion that captured
`&completionCount`, a TestBody() local whose frame is already gone.

The driver is not at fault and is unchanged. The other tests in this file are
safe only incidentally: their commands complete inside the test body, so
Shutdown() finds nothing pending.

Fix: own the counter on the fixture, so its lifetime spans TearDown.

Verified: both tests pass under ASan with no sanitizer findings, and the full
host suite is 1653/1653 (previously 1651/1653 with these two failing on
unmodified origin/main).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 171e4afe510114d4b8e152fc5687513f042969c2)
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