Skip to content

test(sender): add unit-test target covering wire protocol and automation parsing#127

Open
jasontitus wants to merge 2 commits into
swellweb:3.1-maintfrom
jasontitus:test/sender-unit-suite
Open

test(sender): add unit-test target covering wire protocol and automation parsing#127
jasontitus wants to merge 2 commits into
swellweb:3.1-maintfrom
jasontitus:test/sender-unit-suite

Conversation

@jasontitus

Copy link
Copy Markdown

Motivation

The repo currently has no test infrastructure at all, and CI is build-only — and only triggers on main, while PRs are being merged into 3.1-maint. This PR lays the foundation: a unit-test target over the pure logic that needs no Thunderbolt hardware, wired into CI on the branches that actually receive work.

What's in it

  • New TBDisplaySenderTests unit bundle (hosted by the app for @testable access) with 49 tests:
    • TBMonitorProtocol — BE32 primitives, packet layout, drainPacket across fragmented/contiguous/byte-by-byte feeds, JSON payload round-trips, and parity of the hand-rolled input-event encoder with JSONDecoder — this pins the invariant documented on makeInputEventPacket in perf(input): hand-roll input-event encoding to drop per-event JSONEncoder #123.
    • TBDiscoveredReceiver — per-transport ip(for:) selection (which IP the sender dials for Thunderbolt vs Network Link), id, shortHostName, displayText.
    • TBSenderAutomationparseTransport/parseMode/parsePreset aliases, receiver matching, and the resolveSessionIndex tri-state (nil / all-sessions / index).
  • The pure parsing helpers move from private to internal so the test bundle can reach them — no behavior change.
  • project.pbxproj and the shared scheme are regenerated via xcodegen (they're tracked), so a fresh checkout can run xcodebuild test directly.
  • CI: runs the suite after the sender build, and triggers on 3.1-maint/3.2-dev in addition to main.

How tested

  • xcodebuild test -scheme TBDisplaySender -destination 'platform=macOS' — 49/49 green locally (M2, macOS 15).
  • ./scripts/build_targetbridge_sender_app.sh still succeeds unchanged.

Two follow-up PRs are stacked on this one (protocol-drain hardening, and an interface-scoping connect fix diagnosed on real hardware).

🤖 Generated with Claude Code

jasontitus and others added 2 commits July 1, 2026 23:11
…ion parsing

Adds a TBDisplaySenderTests unit bundle (hosted by the app for @testable
access) with 49 tests over the pure logic that has no hardware dependency:

- TBMonitorProtocol: BE32 primitives, packet layout, drainPacket handling of
  fragmented/contiguous/split feeds, JSON payload round-trips, and parity of
  the hand-rolled input-event encoder with JSONDecoder — guarding the
  invariant documented on makeInputEventPacket (PR swellweb#123).
- TBDiscoveredReceiver: per-transport ip(for:) selection (which IP the sender
  dials for Thunderbolt vs Network Link), id, shortHostName, displayText.
- TBSenderAutomation: parseTransport/parseMode/parsePreset aliases,
  receiver matching, and the resolveSessionIndex tri-state.

The automation parsing helpers move from private to internal so the test
bundle can exercise them; behavior is unchanged. project.pbxproj and the
shared TBDisplaySender scheme are regenerated via xcodegen so a fresh
checkout can run `xcodebuild test` directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Executes the new TBDisplaySenderTests suite after the sender build.
- Triggers CI on 3.1-maint and 3.2-dev in addition to main, so the
  branches that actually receive PRs get build/test coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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