Phase C1: temporary-connection RPC, stream-part data keys, real C1 unit tests#79
Merged
Conversation
…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>
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.
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:
ContentDeliveryRpcLocalandContentDeliveryRpcRemotewere 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-eraItCanBeInstantiatedstub tests with ports of the real TS tests.What's new
TemporaryConnectionRpcLocal/TemporaryConnectionRpcRemote(ported fromsrc/content-delivery-layer/temporary-connection/at the pin): temporary content-delivery connections — the server side tracks requesters in aNodeList(limit 10) and weak-locks the underlying connection (system/content-delivery/temporary-connection/<streamPartId>lock id); the client side reports open failure asfalseand closes fire-and-forget, exactly like TS.streamPartIdToDataKey(ported fromContentDeliveryManager.ts): SHA1(streamPartId) as the DHT data key, via OpenSSL EVP (openssladded to the package manifest with the standalone-configfind_packageline). 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 returnedstd::optionalbut looked up withmap::at, so asking for an unknown id threwmap::at: key not foundinstead of returning empty (TSgetNode()returnsundefined). First caller with a missing id was the new TemporaryConnection test.Tests (all ported from the pin)
unit/ContentDeliveryRpcLocal.test.tsContentDeliveryRpcLocalTest(stub → real: callback counts for send/leave paths)integration/ContentDeliveryRpcRemote.test.tsContentDeliveryRpcRemoteTest(stub → real; house two-communicator pattern instead of simulator transports, per the DhtNodeRpcRemoteTest precedent)unit/TemporaryConnectionRpcLocal.test.tsTemporaryConnectionRpcLocalTest(new)unit/StreamPartIDDataKey.test.tsStreamPartIdToDataKeyTest(new, + pinned digest)unit/NumberPair.test.tsNumberPairTest(new;NumberPairalready lived in DuplicateMessageDetector)Also:
TestUtilsgainscreateMockPeerDescriptor; 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 inlint.shwith 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