Skip to content

Phase C1: temporary-connection RPC, stream-part data keys, real C1 unit tests#79

Merged
ptesavol merged 1 commit into
mainfrom
claude/phase-c1
Jul 11, 2026
Merged

Phase C1: temporary-connection RPC, stream-part data keys, real C1 unit tests#79
ptesavol merged 1 commit into
mainfrom
claude/phase-c1

Conversation

@ptesavol

Copy link
Copy Markdown
Collaborator

Summary

Starts milestone C (trackerless network full node) with phase C1 — the remaining leaf utilities and RPC-local units of the content-delivery layer.

Survey finding: ContentDeliveryRpcLocal and ContentDeliveryRpcRemote were already at full TS parity from the proxy phase (both duplex paths — leaveStreamPartNotice, inspection-marking hooks — included; the plumtree branch is milestone-E scope per plan decision 3.3). The phase's real substance was the two missing classes, the data-key derivation, and replacing the proxy-era ItCanBeInstantiated stub tests with ports of the real TS tests.

What's new

  • TemporaryConnectionRpcLocal / TemporaryConnectionRpcRemote (ported from src/content-delivery-layer/temporary-connection/ at the pin): temporary content-delivery connections — the server side tracks requesters in a NodeList (limit 10) and weak-locks the underlying connection (system/content-delivery/temporary-connection/<streamPartId> lock id); the client side reports open failure as false and closes fire-and-forget, exactly like TS.
  • streamPartIdToDataKey (ported from ContentDeliveryManager.ts): SHA1(streamPartId) as the DHT data key, via OpenSSL EVP (openssl added to the package manifest with the standalone-config find_package line). The test pins the exact digest of "stream#0" beyond the TS length-only assertion: the key must match the TS derivation byte for byte or C++ and TS nodes would store the same stream part's entry points under different DHT keys.
  • NodeList::get() bug fix, found by the ported test: it returned std::optional but looked up with map::at, so asking for an unknown id threw map::at: key not found instead of returning empty (TS getNode() returns undefined). First caller with a missing id was the new TemporaryConnection test.

Tests (all ported from the pin)

TS test C++
unit/ContentDeliveryRpcLocal.test.ts ContentDeliveryRpcLocalTest (stub → real: callback counts for send/leave paths)
integration/ContentDeliveryRpcRemote.test.ts ContentDeliveryRpcRemoteTest (stub → real; house two-communicator pattern instead of simulator transports, per the DhtNodeRpcRemoteTest precedent)
unit/TemporaryConnectionRpcLocal.test.ts TemporaryConnectionRpcLocalTest (new)
unit/StreamPartIDDataKey.test.ts StreamPartIdToDataKeyTest (new, + pinned digest)
unit/NumberPair.test.ts NumberPairTest (new; NumberPair already lived in DuplicateMessageDetector)

Also: TestUtils gains createMockPeerDescriptor; the two new test files that trip the documented clangd-22 false positives (protobuf duplicate-declaration ambiguity, std-type unification) are excluded from clangd-tidy in lint.sh with comments — the compiler builds and runs them, clang-format still checks them.

Results (local, arm64 mac)

trackerless-network unit 22/22, full-tree build green, package lint rc=0.

🤖 Generated with Claude Code

…it tests

Starts milestone C (trackerless network full node). ContentDeliveryRpcLocal
and ContentDeliveryRpcRemote were already at full TS parity from the proxy
phase, so this phase's substance is the two missing leaf classes, the DHT
data-key derivation, and replacing the proxy-era stub tests with the real
ported TS tests:

- TemporaryConnectionRpcLocal/Remote (new modules): temporary
  content-delivery connections with weak connection locking, tracked in a
  NodeList of 10.
- streamPartIdToDataKey (new module): SHA1(streamPartId) as the DHT data
  key (OpenSSL EVP; openssl added to the package manifest). The unit test
  pins the exact digest of "stream#0" — the key must match the TS
  derivation byte for byte or C++ and TS nodes would store the same stream
  part's entry points under different keys.
- NodeList::get() bug fix, found by the ported TemporaryConnectionRpcLocal
  test: it returned std::optional but looked up with map::at, so a missing
  id threw "map::at: key not found" instead of returning nullopt (TS
  getNode() returns undefined).
- ContentDeliveryRpcLocalTest and ContentDeliveryRpcRemoteTest upgraded
  from "ItCanBeInstantiated" stubs to ports of the real TS tests
  (unit/ContentDeliveryRpcLocal.test.ts, integration/
  ContentDeliveryRpcRemote.test.ts — the latter using the house
  two-communicator pattern instead of simulator transports).
- NumberPairTest ported (unit/NumberPair.test.ts); NumberPair itself
  already existed inside DuplicateMessageDetector.
- TestUtils gains createMockPeerDescriptor (ported from the TS test utils).
- lint.sh: the two new test files that trip the documented clangd-22
  false positives are excluded from clangd-tidy (compiler builds and runs
  them; clang-format still checks them); stdin redirected per house rule.

Local: trackerless-network unit 22/22, full-tree build green,
package lint rc=0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ptesavol ptesavol merged commit 5ed4d08 into main Jul 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant