From 9e385b2ddf7428300f0333d4096da4c29feddaa1 Mon Sep 17 00:00:00 2001 From: ntsd Date: Sat, 21 Nov 2026 06:39:08 +0700 Subject: [PATCH] docs(openwiki): sync architecture documentation for hotcode-dev-zerohub-share Task: zf-z-d39dd9f0 --- openwiki/.claims/architecture/overview.json | 52 ++-- .../architecture/signaling-protocol.json | 56 +++-- .../operations/development-testing.json | 42 ++-- openwiki/.claims/quickstart.json | 44 ++-- openwiki/.claims/subsystems/client-sdk.json | 164 ++++++------ .../.claims/subsystems/server-signaling.json | 108 ++++---- openwiki/.last-update.json | 4 +- openwiki/.page-manifest.json | 48 ++-- openwiki/architecture/overview.md | 50 ++-- openwiki/architecture/signaling-protocol.md | 55 ++-- openwiki/operations/development-testing.md | 69 +++--- openwiki/quickstart.md | 50 ++-- openwiki/subsystems/client-sdk.md | 234 +++++++++++------- openwiki/subsystems/server-signaling.md | 173 +++++++------ 14 files changed, 646 insertions(+), 503 deletions(-) diff --git a/openwiki/.claims/architecture/overview.json b/openwiki/.claims/architecture/overview.json index 0c472c9..84f98a8 100644 --- a/openwiki/.claims/architecture/overview.json +++ b/openwiki/.claims/architecture/overview.json @@ -1,18 +1,22 @@ { "schemaVersion": 1, - "pageVersion": "sha256:0806d508634e9230e866fd53d01d49e2b1cc389c54f606cd68e9a88650a38ca7", + "pageVersion": "sha256:f0d65c13022833a8f46f4197184f611dd88ce2b02a273c8f5f28e2f29a43aa1e", "claims": [ { "id": "claim_937b0d08bd3849b4b3ddd56a5664ca43", - "statement": "The Go server entrypoint constructs four independent ZeroHub instances (static, random, IP, permanent hub types) via a shared newZeroHubOrPanic constructor and passes them to the handler, so each hub type is backed by its own hub registry.", + "statement": "The Go server entrypoint constructs three independent ZeroHub instances (static, random, IP hub modes) via a shared newZeroHubOrPanic constructor and passes them to the handler, so each hub mode is backed by its own hub registry; the never-expiring 'permanent' hubs live in the static instance (isPermanent=true) and are created out-of-band by an admin over plain HTTP (/v1/static-hubs/create) rather than as a fourth instance.", "evidence": [ { - "resource": "repo://server/cmd/server.go#L26-L30", - "version": "repo-lines-v1:sha256:7309af0b4408d0c5b67a36cc99f9b613ede7ab7775472a46fa5b07186bde0719:eyJzZWxlY3RlZExpbmVDb3VudCI6NSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMDFiYTQ3MTljODBiNmZlOTExYjA5MWE3YzA1MTI0YjY0ZWVlY2U5NjRlMDljMDU4ZWY4Zjk4MDVkYWNhNTQ2YiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiODQzYjQzOGRjMjEyZjdkZTE2NWFhOGZmZTZiODZiNWRiZDU3MzY4NjIxYTA5YjE1NjExNzRmY2MzNjk0NzhhMSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiYzE4NzEzZjU2MWI4NTYxOTEzMzBjNjg2OTc2ODY3YzUzMDZlOGI3NDMyNmM3YTI3ODkxMTUwNDhmODlhMDJmNiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWRkMjUwMTg5MTBjYjIzNTIwMWI3NGFiNGU0MTZlMjMzMmRkMDVkMDJhMTEzM2Q1NGE3OWIwYWQ0NzE3ODNlZCJ9" + "resource": "repo://server/cmd/server.go#L25-L29", + "version": "repo-lines-v1:sha256:318897bae9dcb784e43f0c6bdd4586199ab1323063572b90d44ad24283129f73:eyJzZWxlY3RlZExpbmVDb3VudCI6NSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNWIwMjJjNDcxZDZiZTQ4OTdiMWQ5NjI3N2RmNTQwYTRkMDIyZWE2MDI5MThjZTFhZmFhNWVjZTU4ZDJkMjU0MyIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiOTIwMWIyNDY0NjU5ZDQ3YmM3NDNlZjBjZmE3ZjE2MzkxMjgyOTNhNDk0ZDgwMjczMTQzNzMwYzI0OTdjZDEyOCIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiODYxMjkzNWQyZDllMzI0ZDBlZjU4NjUwYjFhMDk3ZDI2MTA3MjJlZmFkNjA5ZTk1NTJlODU0NzhkOGQ0NDM4YiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiN2EzZjc5YmE2MmYyZTg0NGIxOGM1ZWUzMTBkOGQwZmFkMTIwOGFjMDdiMzNlNjVkZDlkNDg3MzBmMWFjNjllNCJ9" }, { - "resource": "repo://server/cmd/server.go#L42-L50", + "resource": "repo://server/cmd/server.go#L39-L47", "version": "repo-lines-v1:sha256:de30767efb3115fe6498da80ed9a06712ef6a3e029bb7f939055017c649009fc:eyJzZWxlY3RlZExpbmVDb3VudCI6OSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYmZmNWRiMTQwMjQxYWVhY2Y5MGNiMmU4ZTM2NzhhZTQ1MTIwYWZmNmZiODM5NWUwYzNkMmVmY2MwNTdjNjE3ZCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNDEyY2EzNDVjY2Y3NWJmOWMwODA2YmNlNjk1YmU4ZGU4MDhiNzk5ODQyNTFhN2E1NGQyMDJjZjYxMDFkZDQ1MSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiZjI5NjQwNzljM2M1YzgxNTIwZWYzM2EyYjlkMmUxNWExYjg0ZDcyODBkYjg1OTBkY2Q2NTc0N2UzZTAxMmE0MCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjAsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9" + }, + { + "resource": "repo://server/pkg/handler/create_static_hub.go#L50-L51", + "version": "repo-lines-v1:sha256:0315abdf3af9c42826da5de0f47f92e3079d6c934828ac6ab734e3bdf723dba9:eyJzZWxlY3RlZExpbmVDb3VudCI6MiwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYzljNGY3MjJlMTE5MTJjMDExNjhiMjg5M2Y0NDY0OWY3MTZiYzY4NWQ4ZmJjM2M1Y2RmOGI2OTg4NTI4MGVjZiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNWQ3OWI5OGM5NTc4MThiODFiMzY4YmE1M2E3ZmNlZDJmYTc5NzllMTRiMDc0YzgyYTM5NjI3NGY2MTJiMDY4ZSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiOGU2YWYzZTliZmJmNDZiOWFhMTNhYzAxNjcwZjNkYTU4NDg1Nzg0ODczMmIwNDI4YjgwYjM2ZGUzZTU2NDEyYiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiOGM2OGFkZjc4ZGMyNmZkNDE4ZDA4ZmFlNDhlNjM5N2U5YWU4MjM5YzgyMmIzZWY3NmNjMzczMGExNDEzOTE5OSJ9" } ] }, @@ -31,8 +35,12 @@ "statement": "SDP offers and answers are exchanged as protobuf ClientMessage/ServerMessage frames over the signaling WebSocket, and ICE candidates are flushed to the wire after a waitIceCandidatesTimeout (default 2000 ms) instead of being held indefinitely.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L901-L956", - "version": "repo-lines-v1:sha256:3aa9667674eaa2dc2a2f7eb92e754b88d071fa93ba677f8a394e05691213924a:eyJzZWxlY3RlZExpbmVDb3VudCI6NTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0Y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jNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + }, + { + "resource": "repo://client/src/zeroHub.ts#L1656-L1765", + "version": "repo-lines-v1:sha256:f0e2f9da3f452348f0b44f25a6dba76ad9e5efb29a3d039212ca0ac76bb3ebd8:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEwLCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiI0ZjJhMmY5OTZmMDhlNjgwYmQyOTIxMzVhNmZhNDk3OGJkYTI2ZTYwMmQ4NGYzM2NiMWQ1OTQ3NzVkNDMwNGI1IiwibGFzdFNlbGVjdGVkTGluZUhhc2giOiJjNTJjYjNkZDMyNDU2YWQ5ODhkM2E0ZDZkZmM1NjA5Yzk5MjkyMTI0Zjk5MDMzY2UzZWQ5MWRmODU3NmRhZGI0IiwicHJlY2VkaW5nQ29udGV4dExpbmVDb3VudCI6MywicHJlY2VkaW5nQ29udGV4dEhhc2giOiIxZGIzZTdjZDBjM2E2MjMwNDc2NjgxNjFkMTA0ZTk5ZDg2MjA5Y2EzZTc3NTRhMjViMTE5YTQ5MDc4NzgwNDI2IiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MywiZm9sbG93aW5nQ29udGV4dEhhc2giOiJkZDM3ZjM3ZTAyZWJmN2VlOGU3OThkMjJjMzM1Nzk4NzI4YjgwOTBhYzA2ZmJlY2FjOWRlNDFkYzQzZTQyYTMwIn0" } ] }, @@ -41,8 +49,8 @@ "statement": "When a peer joins a hub, the hub assigns it a monotonically increasing numeric ID via an atomic counter, broadcasts a PeerJoinedMessage to existing peers, and sends the new peer a HubInfoMessage containing its own peer ID, hub metadata, and the existing peer roster; the join signal is marshaled before the peer is registered in storage, so a marshal failure is a no-op and never leaves a half-registered peer.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L70-L107", - "version": "repo-lines-v1:sha256:d33adcb3c4e73afa73f1bb759ba76426f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RpbmdDb250ZXh0SGFzaCI6IjM3NTQ5MjYyZjJiYjUyYTNhMmNhMTVlZWE5YzM0ZDk0MDVkMzUwOTBiOGI3NWZlODM1ZjlmMjZlNDkxZTliODkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImRhZmJlZTkxNzJmODJjMjg3MDI3Y2U3ZTcyMTc4YmNhOTU5ZjA4YWUwNDIwNTMyNDRkYjU5YmE1Y2Q0MDY1ODMifQ" } ] }, @@ -71,8 +79,8 @@ "statement": "After a peer is established, the server is not in the media/data path: it relays only signaling (hub/peer events and SDP), while data channels and media streams flow directly between peers over WebRTC.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L164-L192", - "version": "repo-lines-v1:sha256:1f97f3fe7522b8e723d8b2f1fe91ac970b385402738a278bb8f73f0a1433d2de:eyJzZWxlY3RlZExpbmVDb3VudCI6MjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ1MDFkN2I2Zjc0YzY2N2JiYmU0Zjg4Nzg0MzVkNWI1NzRjYzA5NGVjNjE3MGExYzc0YjVmYjJiMjBiMGQxZmUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImE3NTU0MjlkYjExZDAwOWFkYWRkOGU0YjcwYzRlNTcxMTBmNDBmYWRjMjRmNjU0NDM1MGQyYjEyZWU0MjI2ODEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjY4ZjYzYWZjMGY1MGQ5ZWIxNDUwZDE0ZmZiMTdjNjJlMTFkZDE2YTg1YjQ2NzNhMzgxMTA1NjNhYTJhOGYwZDYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFmODI1OGJlNDkzNGI3OWRjYjhhZWVkYmM1NDA5ZWFkYzMxMjZhNTA5MGMyMzI2NzBjYzBhZjc1ZGJiOTZjMzMifQ==" + "resource": "repo://server/pkg/hub/hub.go#L285-L301", + "version": "repo-lines-v1:sha256:21d1ffd6a1491fbb0c44a70cc0e4f4dd488543210eb8f86a65a994b871a2a87b:eyJzZWxlY3RlZExpbmVDb3VudCI6MTcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjM5MTE5M2JlMGU3NmVlNGE4MzZkNzFjZTAyMTM0Y2JlYjk5Y2Y2NDViNGQ0OWZmMmIyZDMyOWJlZDk2ZDZlMWMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImYyOTY0MDc5YzNjNWM4MTUyMGVmMzNhMmI5ZDJlMTVhMWI4NGQ3MjgwZGI4NTkwZGNkNjU3NDdlM2UwMTJhNDAiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImM2YzNjOGM5OGM0M2M3MjZiMzBhNTY3NmY3NWEyZDU0NzkxYmJkMzJiMjczYzY3NjcwNzY0ZDE3NzRlN2Y4ZDcifQ" } ] }, @@ -81,12 +89,12 @@ "statement": "Hub creation on the Go server is performed through the atomic CreateHubIfAbsent primitive on zerohub.ZeroHub, so concurrent create requests for the same hub ID collapse to a single hub: the race winner creates and the rest receive ErrHubAlreadyExists (surfaced as HTTP 409) instead of orphaning a hub.", "evidence": [ { - "resource": "repo://server/pkg/handler/create_hub_by_id.go#L40-L58", - "version": "repo-lines-v1:sha256:6bef75627f4c4e601cf3ad749de121383dd4b72b8ce07183f0b3e590c394b0c2:eyJzZWxlY3RlZExpbmVDb3VudCI6MTksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6I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4ODExOTA3ZWFhN2Q1YjNkNTNiNCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiN2Q0MDYxOTYwY2RjZDMzYjFkNzNlNWQwNGEzNDQzYjgwYWQwMjM1NTQ2MjY2NzA0YWM2NmJlNjEyMmI4YzVhOCJ9" }, { - "resource": "repo://server/pkg/zerohub/zerohub.go#L83-L98", - "version": "repo-lines-v1:sha256:02fd3ec40b9bbcd4ef64aafdd235afa2ee1bd3b27d30b78a21538a3b6aec51b1:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVmMjhhYTM5YTQwZDQxOTFhNWE2YjE4Y2Q3NzZiZmZmYmY3ZGY0MzYzZTRkN2VhMzIyM2EyYjJkZTRjOGY4OWUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjE1ODA0MmJlM2Q1OWZjYzlmMTg5ODg1Yzg4Yzc5MjZhMzU3ODUzYzMzYmNlOWZjMzQ3ZGYxOWNiMjFhMjk0YTQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjM4ZmQxYzE2OGIxMzM2YjEyYWQyMGQ0N2E3ZWM3OTEzMGY0NGIzMzhiMDAxYWVlOGM1OWUzZWNiYTY4NmJmMTIifQ" + "resource": "repo://server/pkg/zerohub/zerohub.go#L88-L104", + "version": "repo-lines-v1:sha256:99406c980dcb181ceb713be1ad274ca686a647e3ac2afb50d031495555e308ec:eyJzZWxlY3RlZExpbmVDb3VudCI6MTcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImI1MmQ5ZGM2NDQ3YmVjZTA1Y2ZmNTI2ZGM3NjY3OGZmODJhYThhNzRiZmU3Nzg2YTdmNmI4OGUzODJkZTJkZGQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNlNGU0MmY3MDQwMTdiZmYxMWViODYxODQ1ZDMyYTA0MjRhNjc4OGJhMWU3NDQyOGFiMTI2MDJjOGEzZmEyZjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6Ijc0ZjI1ZWI1ZmQ4YzVlYjg3MWE3MWFmMjZjNDk2NmNlYWYxM2EzZDkyYmY3NTY3N2YwNGJhYzhmNWE0YzRjOTUifQ" } ] }, @@ -95,22 +103,18 @@ "statement": "The Go signaling server validates hub-endpoint query parameters before the WebSocket handshake: a missing or empty id parameter and any non-JSON hubMetadata or peerMetadata are rejected with HTTP 400, so an empty-id request can no longer create a junk hub under the empty-string key and malformed metadata is not stored or re-broadcast.", "evidence": [ { - "resource": "repo://server/pkg/handler/create_hub_by_id.go#L18-L32", - "version": "repo-lines-v1:sha256:07b9820bdacd82b7ef08ed9c20f790436ee0520d62fbcf693e60614e2009d009:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgwYzM2N2Y3YTU3NTFiNWMwZDM4OThhZjJkNzM5MzljMDBlMTdiM2UwNzU5N2NkNDEzY2M5MDNkOWY1YjAzYmUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlOD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FiNzg1MmI4NTUifQ" + "resource": "repo://server/pkg/handler/validation.go#L103-L121", + "version": "repo-lines-v1:sha256:9d6d5c79590fe17f2807899b0f993182560b40e97a973c08856ffc306c12c402:eyJzZWxlY3RlZExpbmVDb3VudCI6MTksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZiNjM5YjI3OTg3YWM1OTViNzQxYzQ5MTM4MDY2MDI5ZGM2Y2I0ODg3ZjljOTlmMjM0ZDFlYjUyZDQzMmRhMmQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjgzMWM2MmVkZDNiMWQ1YzYyMWRkODNjYzczNjcxZTEwZGJkNWJkYjI5NGQyMGNlZWNjZTNkNzI3Y2Q4OTllOWMiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjE0ZDkwNjc1ZDlmM2ZiNjJjZTEyMzFmMTY3ODU5MmNlNDY5N2E3NjcxODYyNzEwMWMxY2ZiMWJjZjAxODgzYmYifQ" }, { - "resource": "repo://server/pkg/handler/websocket.go#L28-L38", - "version": "repo-lines-v1:sha256:b250aec51f863bb696974b43927755e1e26fefbaa453ae90bdc2445bbde2191b:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3YmVjMDg3ZDMwMzljNWRkOGVlYWI3ZGViYWFkZDgwYzc2NjI3Zjk3YTQzMjg2NzNhYTI1ZWYxYWZmYWFmZTEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOT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NGI4MjQyMmMwM2MifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T20:39:20.288Z" } } diff --git a/openwiki/.claims/architecture/signaling-protocol.json b/openwiki/.claims/architecture/signaling-protocol.json index 9341db0..ab1ff01 100644 --- a/openwiki/.claims/architecture/signaling-protocol.json +++ b/openwiki/.claims/architecture/signaling-protocol.json @@ -1,24 +1,24 @@ { "schemaVersion": 1, - "pageVersion": "sha256:fcebf6ee6c88427db464195a4f7993cbff73e8fd1b71f794f5cfff68621cd711", + "pageVersion": "sha256:b18b4dde086c39631b1ed698de089b3688882038998eff5ccb4adeb99b75387f", "claims": [ { "id": "claim_d5e17f0a4db84690bce7a57930a4a2e7", - "statement": "ClientMessage is a protobuf oneof envelope with four variants: send_offer_message (answer_peer_id, offer_sdp), send_answer_message (offer_peer_id, answer_sdp), send_ice_candidate_message (unused), and update_peer_metadata_message (unused in the server handler).", + "statement": "ClientMessage is a protobuf oneof envelope with three variants: send_offer_message (answer_peer_id, offer_sdp), send_answer_message (offer_peer_id, answer_sdp), and send_ice_candidate_message (peer_id, candidate, relayed to the target peer for trickle ICE). The former update_peer_metadata_message variant has been removed from the wire format.", "evidence": [ { - "resource": "repo://proto/zerohub/v1/client_message.proto#L43-L53", - "version": "repo-lines-v1:sha256:74a6fcd311d8574eb94320c2068756f51f2bd55da77f1ee131545a9f5cb550fe:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjEwMGE2ZjA4Mzk3YWVlZGE2MzJkODZiM2Q5ODI4OTJhODI0Yjk0ZmYxY2JjNWY1MTliNDlhOGRhN2I0NDc4OWYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjMyMzMzNDE2NTg0NjBkODYyMzQ3ZGI2YTdkNTA5NGJkZDFmYjU3ZWUxMjFiZGY4ZjEyM2Q3YTc4M2UzMTNlZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoyLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjkzOGRlNzRiZTk3YmYzYWJhNzg3MmE2MWJhMGU0MjA4NDAwOGM4MWU4YTIwMmE2MTIxMzRjNzU1YWFmN2ZhMDYifQ==" + "resource": "repo://proto/zerohub/v1/client_message.proto#L34-L44", + "version": "repo-lines-v1:sha256:aa838a66431fa9952335620aa64b1f2c66388e894ebc5fc1184e31debac0efc2:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgzYmI5MGI5MThmNzcxZGI2MWJiOGYxYzFmMTY4OWI4YjFkOGIwYWY1ODIwYmI4YmFjNmYyYzRjODkwZjNhMzgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImVlMjExZGI1OWNiMTVkNTgxYTZkZmIxYTY2ZjExMjE5OTA2OGU2MWRiNzRkNzk5MTM1YjZhOTA3MjIxZTdiNzEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, { "id": "claim_64deb4b4043c498d9ceed2e2532e332f", - "statement": "ServerMessage is a protobuf oneof envelope with six variants: hub_info_message, peer_joined_message, peer_disconnected_message, offer_message, answer_message, and ice_candidate_message (not used yet).", + "statement": "ServerMessage is a protobuf oneof envelope with six variants: hub_info_message, peer_joined_message, peer_disconnected_message, offer_message, answer_message, and ice_candidate_message (relays a trickled ICE candidate to the target peer).", "evidence": [ { - "resource": "repo://proto/zerohub/v1/server_message.proto#L73-L87", - "version": "repo-lines-v1:sha256:087fc6034926678e02da5757c97e77ce62672d778f16a90c9b2ca5461422def9:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ3MzY1MDk5MDljYzlkZmFiNTgzZmNiOWIwZjRjZDdiOGMxZTQ5ZWY1OTJlOWVmNTc0MTcyNTM3YTg1YzExOWEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImQ0Y2MzNTlhMTU2ZGRjNTZkZDBjNTdhYjNmMGE4Zjc5NjhmYzAzYzI0ZGYzZjY4ODFhMjdlODY5MmI5OGNiMjQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoyLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjkzOGRlNzRiZTk3YmYzYWJhNzg3MmE2MWJhMGU0MjA4NDAwOGM4MWU4YTIwMmE2MTIxMzRjNzU1YWFmN2ZhMDYifQ==" + "resource": "repo://proto/zerohub/v1/server_message.proto#L72-L88", + "version": "repo-lines-v1:sha256:4191833803392088ec1d9753e550546a7b703be50d419f2432bd6fc2a66b02d5:eyJzZWxlY3RlZExpbmVDb3VudCI6MTcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjFkNDZhNWJkN2U0ZjE0ZDUwZTMwNDI0NzdjM2I2M2VlZjE5YWIyNmIwNGFiMTY1NmQ0YjQ5ODE2Y2Y1YzI3N2YiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImVlMjExZGI1OWNiMTVkNTgxYTZkZmIxYTY2ZjExMjE5OTA2OGU2MWRiNzRkNzk5MTM1YjZhOTA3MjIxZTdiNzEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, @@ -27,32 +27,40 @@ "statement": "The server hub routes a client SendOfferMessage to the named answer peer and a SendAnswerMessage to the named offer peer; the server relays SDP verbatim without inspecting its content.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L197-L205", - "version": "repo-lines-v1:sha256:beb81b1fc7ef696140e333cc04fed6aac8768a9ce412f67cf914a6ae96578bc9:eyJzZWxlY3RlZExpbmVDb3VudCI6OSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZDEwZGM0OWUxNWJiYzJiNWQxOTc1NDMxYmRlNTNjOTUyZjVkNmRhZTY1MjdlNTVmZTk1ZWYwNzgxNzEyMDdjMyIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNTRiZmQ1MzlmMTVjZGVmNzdlNzE1YzAwOWE4NDMxNzZjNjdhODNlMzIyZjQ0NGM1YjIyZWFhY2JmNjM4Y2RhOCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNGNlNzhmZGI1ZTA4NGQ2ZjkxZDdiMWM1YTllNGJiMGVlNzFlOTM5MzU0MWZlMGEwMzkxZmY4NjdlMTM3MTI5ZiJ9" + "resource": "repo://server/pkg/hub/hub.go#L323-L347", + "version": "repo-lines-v1:sha256:20ebc00f25bbb81910b18347ec1d96251cafc293e34ec07fbc74991e00b94093:eyJzZWxlY3RlZExpbmVDb3VudCI6MjUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQxMGRjNDllMTViYmMyYjVkMTk3NTQzMWJkZTUzYzk1MmY1ZDZkYWU2NTI3ZTU1ZmU5NWVmMDc4MTcxMjA3YzMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY0ZWZjNDk0MThkMjZkY2YxMjliMjJhNmFhMjExMDhjZWVjMzc2NzdhMzJkMDhlOWQ1ZmVlMzVkZGE2NmJiOWQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjU0YmZkNTM5ZjE1Y2RlZjc3ZTcxNWMwMDlhODQzMTc2YzY3YTgzZTMyMmY0NDRjNWIyMmVhYWNiZjYzOGNkYTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFiZDdkYjA1ZDMzMTFkYTA2ZGVkOGNlNTU0NDUwOTczMDUzYmZjYzY0ZWRhYzgwZDQyMmZiZjU2YTBkNmFjMWUifQ" } ] }, { "id": "claim_fc485b5fc851457b9c9fc2f63bbdf7e9", - "statement": "ICE candidates are not individually signaled; instead sendOffer/sendAnswer call the shared armSendOnIceReady helper, which flushes the SDP to the server on the first onicecandidate event carrying no candidate (gathering complete) and, as a fallback, flushes after the per-peer waitIceCandidatesTimeout timer (default 2000 ms), guarded by a single isSent flag so the SDP is never sent twice.", + "statement": "The SDP offer/answer is sent exactly once: sendOffer/sendAnswer call the shared armSendOnIceReady helper, whose onicecandidate handler fires the send on the first candidate-less event (gathering complete) and a waitIceCandidatesTimeout (default 2000 ms) timer fires it as a fallback, guarded by a single isSent flag; in addition every individual ICE candidate (including those arriving after the SDP went out) is trickled to the remote peer via sendIceCandidateToWebsocket / SendIceCandidateMessage and applied with addIceCandidate on receipt.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L901-L956", - "version": "repo-lines-v1:sha256:3aa9667674eaa2dc2a2f7eb92e754b88d071fa93ba677f8a394e05691213924a:eyJzZWxlY3RlZExpbmVDb3VudCI6NTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVlMTJiNjExODk0M2UzMGMwMDY4MzNlNzgxNjMwYTUzYjMyZjQxN2VmNWY5Nzk1YzNmMTJmMzMwODAyNGM1ZDkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjMzMzYyNWQwMzMxMjJmODNhMzQwMTlhODIwMmE5N2Y1MTBmODY2ZWJjYzAwNWY3YzEyMDQyMGY2YzI1ZmZlMDYifQ" + "resource": "repo://client/src/const.ts#L39-L51", + "version": "repo-lines-v1:sha256:e72614d259fb4a38815534354c42033508ac162405fc723b4353d5ac23054b4f:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjYyNzg3ZGJiMjQzMGU3ZTg4OGZkNWZiMjgzODdkMDMxMzVkYTc2ODMzNmY5OTc5YTQ1MDQ0ZTg4ZTZhN2VhOGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFhMWQxYTYzMzkwMjI5Yzc5ODM0N2U4M2EwNDA1NDQxYzk0MDAwMzUyODRhZDE2OGMxYmY2Y2RmMWQ3MGEzNzAiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjFjN2NlNjA4MjhkZmY3NjhjYTIwMGQ1YjMyNTk5OGJlMGJjZTU1MjkxYjFkMWViOWE4MDk5ZmY5NTM0MWUwMzkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + }, + { + "resource": "repo://client/src/zeroHub.ts#L1715-L1745", + "version": "repo-lines-v1:sha256:304824ea4e640de6699e47301bf336af88ab01836a4e5d569b94cc8aa4b96087:eyJzZWxlY3RlZExpbmVDb3VudCI6MzEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjEzMmM2ZDZhMzYxMGFkOWRmMGVjODIyNmEzNTg0NThmN2UzYWMzMGQ0MTUzYzk1NzE5OWRlMzMxZDFhYTg0MTQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFkOWUxMjU0NjQyNTU3NmQzZGVhZThjOWI5ZGJmMTI4ZDVkNmRkYWY1ZDdmZTg1NzkzNDkyN2RlZmZhM2I5ZGQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImM5ZjI1ZmEwYmVkN2FjOWZhZWQxOWZjYTJmZGJhZTBjZTQzZjhhNTNlNmU4ZDY3Mjg4ZGNjMDdkMDNlZWI4YzYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImM4MzlkZjBlZGViMjI4Yjg0NjI1YTNjMWNkMTMxNTVhNjc0MzY0OWY5YmU0N2Y1MzVlNWZmM2EwMzI4OWRlY2QifQ" + }, + { + "resource": "repo://client/src/zeroHub.ts#L1753-L1761", + "version": "repo-lines-v1:sha256:2c510799089eadb682b417cb906fd4bd6e55b41772dbcbaf3664659caab02ab7:eyJzZWxlY3RlZExpbmVDb3VudCI6OSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYzU5ZjEwZDEyZDc4MzEzOWVmNjJmZDllM2VlZjI4NDc4NWRhNjAyN2VhYTNmYjQzMDNlNGEzZDVmYzY1ZTVhMCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiMmU3NjQzOTg0MDgyY2I1MTY3MWI2NWFlZDczY2RhNTkwNTc4MDI2ZTM2Mzc0OTkxYjk0ODIyNWNmMDgzYmIyMiIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiN2RmZjcwNmRkYTliY2MwOWFhMGMxMmRiNjQ0OWJhNTNmOTI1NWIzYmVjN2ZmMjk5ZjM2MzQ1Yzg4ZjU5ZTExZiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWE5MjkzZmQ4MDU0YjZlNDcyNDgzNzNmMzlmNGRkNzc4MDAxMDVlYjc1ODM0ODY4NzI1NDI4NWNkMTI4MmI3OCJ9" } ] }, { "id": "claim_fa365a6d78bb422f877ccfacdecfc391", - "statement": "When the server broadcasts a PeerDisconnectedMessage, the client fires the ZeroHubDisconnected status change and then tears the peer down through the shared removePeer helper, which closes the peer RTCPeerConnection, nulls its connection and ICE handlers, and removes the peer from the peers map.", + "statement": "When the server broadcasts a PeerDisconnectedMessage, the client fires the ZeroHubDisconnected status change and then tears the peer down through the shared removePeer helper, which clears the peer's pending ICE-candidate fallback timer and P2P-drop recovery timer, closes the peer RTCPeerConnection, nulls its connection and ICE handlers, and removes the peer from the peers map.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L513-L524", - "version": "repo-lines-v1:sha256:007686b9245236943ad0d32543efdf022d6b9d7f1a5cef6873e56f63463bfb1d:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ2ZDRiMzg3ZTU3ODZhNTRkYmIzN2IxZjA2NDYzNWJkN2I1MWIwMWVlN2ZjNmI0NTk2NDgxMzE1OGU3NmIyMjAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ4OTNmNDBlMzc4MWViODk2YzgyZDA0NmEwODA2N2ExMWUzNWNkZjJmMWRmYWYyNmZlYTkwYjhkYjY2NzY0MTMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImY5NmY5NDMwY2ZmMmZhYzc5YTk0ZDg2MzRkNjU2YzFiZmJhOGU1NWQ0MTdhNWIzM2U3NzdiOTk0OTlkYTllODAiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVhOTI5M2ZkODA1NGI2ZTQ3MjQ4MzczZjM5ZjRkZDc3ODAwMTA1ZWI3NTgzNDg2ODcyNTQyODVjZDEyODJiNzgifQ" + "resource": "repo://client/src/zeroHub.ts#L940-L950", + "version": "repo-lines-v1:sha256:bed3172997d913e9599bdf6b864074b229cf0f6a8787bcb4cff5371576602232:eyJzZWxlY3RlZExpb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iMjA1NDM3MmZjMTQzNmFmMWJmYjU4ODExMjcyMzUxMDFkODEwMzBiNGRiMmUyZTBjNGU5YzdkNjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVhYzc4YjEzZGFmZTY5ZTNhZDcxODk3NmU3OTUzNTAzODYwYzJmYThkM2I5NzE2YzRlMWVlYWM5OGRmYjg4NjcifQ" + "resource": "repo://client/src/zeroHub.ts#L973-L997", + "version": "repo-lines-v1:sha256:ae26bd61cee6dcf0fdbb8e1ef65640e86f6c3c77a3b5e9c41108806175848652:eyJzZWxlY3RlZExpbmVDb3VudCI6MjUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhjMzg5NGNkMTg2NDFlMDY3ODY3Mzk5YjRhMmQ1ZTNkNDgyZDNlNjgwZDMwN2QxMTkwNTk3MDkyM2NjNGE2MTQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImE2YWE3ZDZiMjA1NDM3MmZjMTQzNmFmMWJmYjU4ODExMjcyMzUxMDFkODEwMzBiNGRiMmUyZTBjNGU5YzdkNjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjliNTMwODY4ZTVjYWM3MDdlYjNmNTkxOGM3NGI3ODI0OTljYjdiZmEwOTFmMjZlOTlkMTY3OWE5YzJlZDM2ZDQifQ" } ] }, @@ -61,8 +69,8 @@ "statement": "hub.HandleMessage's read loop terminates on read errors, non-binary frames, or protobuf unmarshal failures, and exits with the peer torn down.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L167-L182", - "version": "repo-lines-v1:sha256:4bfb6a380f4176f34716968934a3a6c044e8f2a81e31f02feb6e6448e61e86ba:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImEzMjI0ZGNlMTc0YzZmMGMxNmE3ZjNhOGMzOTY0ZDZmYTY3ZWU2NWFjODUxYzIyMTkwYTNhMThhMTk3N2JiMjQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliMGIxNGM3ODczOWU3NzE2Y2YxNzNhMDdjNDJiMzg2N2FlMTYyMjViNTI2NDliN2Y3MWUyNDA0OWNhNDQxMmQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVkMTNlNmZkYTQyNzgxMjAyYWRhZmE5MjUyOTk4YTU2MzAxMzBhZWU3NWFmYTkwYmI1YjhiZjkzODUzODczNzMiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImM0N2FlNjZhNDhjMWQ0NDlhMjI2ZDFmMzAzZjBjYTlhZTYzYWYxOThkMDQxY2NmZjQ5NTVkNjEyZmVkZDQwMzQifQ==" + "resource": "repo://server/pkg/hub/hub.go#L303-L353", + "version": "repo-lines-v1:sha256:1d35b9bdb0e34b2193c1115006bbee902eb8aaa75ccfbaafbc9ce5081c574cb8:eyJzZWxlY3RlZExpbmVDb3VudCI6NTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImMwMGY5NDgxZGIwZTBlYmFkYzY5MDg3ZWQ3NjA4MTQ2N2I1ZGEyZjY0NDU5ZTc5NjFhMDIzYjQ5NTdkMmZhNDQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImYyYjBhZTk3Y2ZkNTI5YWQzMjIxYTYwYmEwMmIyM2EwZGU1Y2ViYTg5ZDkxMTJjNTg5NWVlNzdkNmMwODQ5YTUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, @@ -71,18 +79,18 @@ "statement": "When autoAnswer is false the incoming offerMessage is surfaced to the application through the onOffer callback (peer in AnswerPending) and the application completes the exchange by calling sendAnswer(peer.id, offerSdp); when autoAcceptAnswer is false the incoming answerMessage is surfaced through the onAnswer callback (peer in AcceptPending) and the application calls acceptAnswer(peer.id, answerSdp). Both callbacks are guarded on the peer still existing in the peer map, so a dangling offer/answer for a torn-down peer is not surfaced. Both sendOffer and sendAnswer delegate the ICE-candidate wait-and-send to the shared armSendOnIceReady(peerId, rtcConn, sendOnce) helper, whose single isSent guard makes the SDP send exactly once across the onicecandidate-completion and waitIceCandidatesTimeout fallback paths, with the per-peer timer handle tracked in iceTimeouts[peerId] and re-armed (prior handle cleared) on each call.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L148-L176", - "version": "repo-lines-v1:sha256:82232e5ec39333afcdfd0319b8d74fba25ca7b3a9a1af2b10b918426886576d9:eyJzZWxlY3RlZExpbmVDb3VudCI6MjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVlNzExMjdmN2Y1ZjE3MTdiOTZlN2U5NzY5MGE3ZDE4MWE1MDcyMzdmY2FkMTg4NDBiYmIwOTM0MDIyYTkyMGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImIzNDQ0OTEwOGY5MjQ2Mzc3NzU3YmM4M2JhYWNmYjI1YjM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2EwMzI4OWRlY2QifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L461-L496", - "version": "repo-lines-v1:sha256:2cc36f0842e9b1d26727eb3722c79728fe97413f900214041b683a2b65fb5c37:eyJzZWxlY3RlZExpbmVDb3VudCI6MzYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE3NWQwYjA0ZjkzOTBjMDM4ZDUzMzIyOTBiZjc3MTZlMDZhOWRmZDAyYzE5YjlhNmUxMGQyMjc0NjJlZmYyMGYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjJhMTk2ZGM4NWFlZWVkZThkOTY3N2IyYjkxZTljZDNlYTQyMWFiZWEzM2YwZjVjOWUzNTNiOWIyZTIyNzhlOGQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjI0YjcxMWNkZDA0ODA3ZjdkN2FjOWMxZWY4NGQ5MmExZGQ5YzAzYjIwYWE5NWMyZmUzMTU2YTYyMjlhODM0OWYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFmYzhkOGVlZTRhMzQ5OGZkYjU2MDNiZWI0NWU1Njg2NTRlNmMxYTlkNTE4MmI1MmMxOWE0ZDk1ZGJiMDA3OGQifQ" + "resource": "repo://client/src/zeroHub.ts#L840-L901", + "version": "repo-lines-v1:sha256:7cdf88a6b09e213116646c15766262bd6acfddd2a0d6babbe7fc1841e4a5608c:eyJzZWxlY3RlZExpbmVDb3VudCI6NjIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNlYjI4OTJlMDY2NDc5ZGFiODk2MDdjNWZhZWU4MmQ2YzczN2EzYzg2YzgzNDhlNzJkZjQ4NjJlZGExOWY5MmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmMmNjNzg1OGY1MjFkMzlmNDViNjg3MDQ4NDU4MGIzMjVhYzJjNDA5ZTIyNmQyMGFmYThmNzczMjM0OGUwZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFkNTlkYzgyNzhlMjU2NDgyZTVmNTIzNGViYzc2MGNhMmQ4OGUzNzI2ODg5Y2YxMDNlNmU2MjcyODBlNjRlZWMifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T20:39:20.288Z" } } diff --git a/openwiki/.claims/operations/development-testing.json b/openwiki/.claims/operations/development-testing.json index 18d8e5c..95dd473 100644 --- a/openwiki/.claims/operations/development-testing.json +++ b/openwiki/.claims/operations/development-testing.json @@ -1,14 +1,14 @@ { "schemaVersion": 1, - "pageVersion": "sha256:51c83b77aea8ca74345876cf4d42f42bf74828ffb21cc22879929437b5054f27", + "pageVersion": "sha256:5f6ea535317ac0bb92a307263a84708ba7b6e5a8924782f579731e740348ed8d", "claims": [ { "id": "claim_9b265d25c6ea46ffb5cbb15403e8cd85", - "statement": "The root Makefile orchestrates the monorepo: server-serve/server-serve-2 run the Go server on 8080/8081, e2e-test kills ports and spawns two servers before running the test suite, test-all runs server-test + e2e-test in parallel, and proto-gen runs api-linter then regenerates both TypeScript and Go protobuf.", + "statement": "The root Makefile orchestrates the monorepo (-j3): server-serve/server-serve-2 run the Go server on 8080/8081, e2e-test kills ports and spawns two servers before running the test suite, client-test typechecks the client and then runs its vitest suite, test-all runs server-test + e2e-test + client-test in parallel, and proto-gen runs api-linter then regenerates both TypeScript and Go protobuf.", "evidence": [ { "resource": "repo://Makefile", - "version": "repo-file-v1:sha256:88e925b14c788e4c2ea098abc8791c1ad186880027ba73f56c3c7d6ff0fcb8ab" + "version": "repo-file-v1:sha256:59c4a8253da448988d2a4ecc49f91f2b3567ed01b9a883757210b1f7f007b5ec" } ] }, @@ -24,21 +24,21 @@ }, { "id": "claim_2c2b053579db481d9a8df809eea0b057", - "statement": "The E2E test/ suite is driven via `cd test && npm test`, whose pretest step runs build:harness and build-unit-harness to produce test/dist/harness.js and test/dist/unit-harness.js via esbuild; invoking npx playwright test directly makes the specs fail with ENOENT on their missing harness bundles.", + "statement": "The E2E test/ suite is driven via `cd test && npm test`, whose pretest step type-checks the specs (tsc -p tsconfig.json), runs build:harness to produce test/dist/harness.js, and runs build-unit-harness (test/scripts/build-unit-harness.mjs) to produce test/dist/unit-harness.js, both bundles via esbuild; invoking npx playwright test directly makes the specs fail with ENOENT on their missing harness bundles.", "evidence": [ { "resource": "repo://test/package.json", - "version": "repo-file-v1:sha256:b0267776b479247664710982a114cd0550f260cbf429c8ffb2b6bf72e20e3ec4" + "version": "repo-file-v1:sha256:85683518c82c046f227b61a2a7a504eefe77c0f983ecf44a4e4f04e5d590deb3" } ] }, { "id": "claim_a58eb140059949838704f3282a0ef24b", - "statement": "The Playwright config runs serially (fullyParallel: false) with a 10s timeout on Google Chrome only, and under CI=1 sets workers to 1 and retries to 2.", + "statement": "The Playwright config runs serially (fullyParallel: false) with a 10s timeout on Google Chrome only, with workers: 1 pinned unconditionally (the specs share two live server processes and zz-migrate.spec.ts latches :8080 into migrate mode); under CI=1 it additionally sets retries to 2 and forbidOnly.", "evidence": [ { "resource": "repo://test/playwright.config.ts", - "version": "repo-file-v1:sha256:a0e5f4efc37af724af8cac7f4d0361ca73b7db18f0ea5844ce679e874d5d6758" + "version": "repo-file-v1:sha256:2971c4c0273d8dd02ce6772aedd5df79e828ee2b93a7fbded39e22447a4a633d" } ] }, @@ -58,55 +58,55 @@ "evidence": [ { "resource": "repo://Makefile", - "version": "repo-file-v1:sha256:88e925b14c788e4c2ea098abc8791c1ad186880027ba73f56c3c7d6ff0fcb8ab" + "version": "repo-file-v1:sha256:59c4a8253da448988d2a4ecc49f91f2b3567ed01b9a883757210b1f7f007b5ec" } ] }, { "id": "claim_f33facbd9da84a768fa22cfc3615c800", - "statement": "The client test suite includes regression unit specs run through the Playwright unit harness (which installs a mocked RTCPeerConnection and a globalThis MockWebSocket whose instances are tagged and record close() codes, and which records setRemoteDescription calls): unit-malformed-metadata.spec.ts pins that malformed hub or peer metadata is tolerated via the safeParseJson fallback; unit-reconnect-peer-prune.spec.ts pins that hubInfoMessage roster reconciliation prunes peers no longer in the server roster after a reconnect; unit-ice-candidate-send.spec.ts pins the shared ICE-candidate wait-and-send behavior; unit-manual-offer-handling.spec.ts / unit-manual-answer-handling.spec.ts pin the onOffer/onAnswer manual-SDP paths; unit-migration-redirect.spec.ts pins the 1001 close-reason host validation, the self-redirect stop, and the host/hostIndex update on a valid redirect; unit-permanent-hub-endpoints.spec.ts pins that the public createPermanentHub/joinPermanentHub entry points dial /v1/permanent-hubs/create and /v1/permanent-hubs/join with the hub id and metadata query params; and unit-ws-replacement.spec.ts pins that connectToZeroHub tears down a previously leaked socket instead of leaking it.", + "statement": "The client test suite includes regression unit specs run through the Playwright unit harness (which installs a mocked RTCPeerConnection and a globalThis MockWebSocket whose instances are tagged and record close() codes, and which records setRemoteDescription calls): unit-malformed-metadata.spec.ts pins that malformed hub or peer metadata is tolerated via the safeParseJson fallback; unit-reconnect-peer-prune.spec.ts pins that hubInfoMessage roster reconciliation prunes peers no longer in the server roster after a reconnect; unit-ice-candidate-send.spec.ts pins the shared ICE-candidate wait-and-send behavior; unit-manual-offer-handling.spec.ts / unit-manual-answer-handling.spec.ts pin the onOffer/onAnswer manual-SDP paths; unit-migration-redirect.spec.ts pins the 1001 close-reason host validation, the self-redirect stop, and the host/hostIndex update on a valid redirect; unit-static-hub-endpoints.spec.ts pins that the public joinStaticHub entry point dials /v1/static-hubs/join with the hub id and peerMetadata query params (static-hub creation is admin-gated plain HTTP and not exposed on the SDK); and unit-ws-replacement.spec.ts pins that connectToZeroHub tears down a previously leaked socket instead of leaking it.", "evidence": [ { "resource": "repo://test/tests/unit-ice-candidate-send.spec.ts", - "version": "repo-file-v1:sha256:ad350af6625f84c19fb58135e2d61974e4096ecd4af2262f8dd69f4f6ecbae1d" + "version": "repo-file-v1:sha256:4199b1fb63ba0f93a8153415c9e5df55e20d19b1fffecb93ab375a93f4b20667" }, { "resource": "repo://test/tests/unit-malformed-metadata.spec.ts", - "version": "repo-file-v1:sha256:86bbfe2e8b9f83341959aac8924f4e634c829d9cf659d390601b14e242c0fd22" + "version": "repo-file-v1:sha256:5bc37e91b4eb45769a3229821498d1b01d9c65cdd460863ec7d2c87fb7dfbbe5" }, { "resource": "repo://test/tests/unit-manual-answer-handling.spec.ts", - "version": "repo-file-v1:sha256:931d421db4180c99dd199d41eee1e5171edb619482fdcb2793c44dfcf8bdec60" + "version": "repo-file-v1:sha256:9955ddc41c194d6e8827e0349ab09bdb969258d1cb516ee7b1d032022bb90221" }, { "resource": "repo://test/tests/unit-manual-offer-handling.spec.ts", - "version": "repo-file-v1:sha256:901a4db9df11b581b64c6713b8ecfcd5dfd0e46f956baea0d0828075ee2eee3a" + "version": "repo-file-v1:sha256:e37fb6a1715130c3e6d97df968df881763fe3b2e8649aafa96c1c4aab7600c2b" }, { "resource": "repo://test/tests/unit-migration-redirect.spec.ts", - "version": "repo-file-v1:sha256:08a181e7e43909ec13a70b354790f06d3534c2e264e7594d950c9bd64bd3497c" + "version": "repo-file-v1:sha256:ed410e40eab309ade82fc9bdb789d3deb0a6c19180a79a7ac1a5ab78e7153f95" }, { - "resource": "repo://test/tests/unit-permanent-hub-endpoints.spec.ts", - "version": "repo-file-v1:sha256:8e325027ca62cb03910a40cecabca76791387e46d1670c0249a0e5798b838660" + "resource": "repo://test/tests/unit-reconnect-peer-prune.spec.ts", + "version": "repo-file-v1:sha256:458fb065e9f827f868e6a9dc4b643d7253fcfdf703b707b4704739942ebb309c" }, { - "resource": "repo://test/tests/unit-reconnect-peer-prune.spec.ts", - "version": "repo-file-v1:sha256:69ae50a238d2efa9c453979bbf103c5914b902f909cb9fbe96ce5abfe5ffea70" + "resource": "repo://test/tests/unit-static-hub-endpoints.spec.ts", + "version": "repo-file-v1:sha256:7608cb45e94adef12737b74736a937c969609a673b881204624c3402350887c8" }, { "resource": "repo://test/tests/unit-ws-replacement.spec.ts", - "version": "repo-file-v1:sha256:89e7b5b96524406185a6c2549d12ccb42c763587f4cdc9470ef08531dd7808aa" + "version": "repo-file-v1:sha256:af0152886a0543943735cae32627b2ca59076ba494598eb79f4c2cef5510c1f2" }, { "resource": "repo://test/unit-harness/index.ts", - "version": "repo-file-v1:sha256:43686dadf678577ec8bb43067d03885da044a8bc757b94f1ccfc596a3f96001d" + "version": "repo-file-v1:sha256:4b9bdf4c7d5bb0b131ccaf581fe630d66a2d4261476a96b45b58230a36424ef7" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T20:39:20.288Z" } } diff --git a/openwiki/.claims/quickstart.json b/openwiki/.claims/quickstart.json index df55196..a60e787 100644 --- a/openwiki/.claims/quickstart.json +++ b/openwiki/.claims/quickstart.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, - "pageVersion": "sha256:94bd773e020290bf3102e695603cbadb5482c9d2e9e8788017ac64e7c6a9a4b3", + "pageVersion": "sha256:6c7c9e03e68c17133c38b685237b8cd717ea4ef09c99c3b6b2fa13c1e23c3bde", "claims": [ { "id": "claim_29b96b61359846dd9149060c8b57d3a3", @@ -8,27 +8,31 @@ "evidence": [ { "resource": "repo://AGENTS.md", - "version": "repo-file-v1:sha256:3a5d338c9fe7c643d8b4ac966cacae92f1450c196628e112ec4d811ce71ecc1b" + "version": "repo-file-v1:sha256:a608ad960b8a1fda6d9249730d6f3d4a03d11644e5a025979935b6f69690b9ee" } ] }, { "id": "claim_819db68304f043128f8fb1d793ec51b4", - "statement": "The client SDK's public surface is re-exported from client/src/index.ts: Peer, ZeroHubClient, the config consts/types, and the topology module.", + "statement": "The client SDK's public surface is re-exported from client/src/index.ts: Peer, ZeroHubClient, the config consts/types, the topology module, and the logger module (Logger/ZeroHubLogger types).", "evidence": [ { "resource": "repo://client/src/index.ts", - "version": "repo-file-v1:sha256:77165a24ca4d3c9085e7d968f2f17ef096235f11831c6b203a2ae8506b756538" + "version": "repo-file-v1:sha256:9090ff649f0f1c35a17cff3066f4aaff115662ec3d820f05c58bd5506558a82b" } ] }, { "id": "claim_fb004955a1b2494c8c72577f4cc50f20", - "statement": "Instantiating a ZeroHubClient makes no network connection; a connection is only opened when a hub entrypoint such as createHub or joinHub is called.", + "statement": "Instantiating a ZeroHubClient makes no network connection; a connection is only opened when a hub entrypoint (createRandomHub, joinRandomHub, joinStaticHub, or joinOrCreateIPHub) is called, and those entrypoints return a Promise that resolves when the signaling WebSocket opens.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L190-L230", - "version": "repo-lines-v1:sha256:3bdfdae235cd09d10c28dad36beaee613850626f954884b0d9533e691f491f1a:eyJzZWxlY3RlZExpbmVDb3VudCI6NDEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZhNWRmODI2OGE5ZjcwMDM4OTQ1MTc5NTQ0N2RlYjUyZTRkMjBiNzUxMjMyNjJhYTcyNTA2MGRkZWZiMTk2ZmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNiNzIzN2E5YTI5ZTZjMGFkMjdjZmJjNGM2MmZmOGI2YjFhY2Q2NDVmNjFjZDcwMzk3M2UzY2U2YzQ2YmIzMjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6Ijk1ZDEwMGEzMjEyZmIyMTVmMTFiNjM1Zjc0MTQ0OThlZGZmZDMwYzQxMWJhYzM4NGI5ODdkMTJlZWRjMzIxODQifQ" + "resource": "repo://client/src/zeroHub.ts#L1886-L1900", + "version": "repo-lines-v1:sha256:1dfe4cecfc25ae159b12bf549ddddc0fefb61aca63e5e5b61069383486f9208f:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZmM2U1YTc4OGM2ZDg5YjNhOTA5ODM0YjUyZjNkZDdmNmFhYjljMGUyZmJmOWZiMGU5ZjBiZTdlMmU1MzQ5NDQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjMzNzNmZjc0NGNmYzlkNWYwMTkyYjMwYTM1ZjcwZWVhODI3NGQ3NTgwY2Y0MGI4NDQzMDI2MjNiZDllNjE1ZTYiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImU4NGYzODIwZDAyMjdkNTE0MDkyZDE1MjUxNTFkNjZkNTM3NGI0NTE1ZWJiZDQyZDM0NzFlZDk3ZWQ4MDMyN2MiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjlmNTkxZDExZTI3OGYyNWMyMmY4ODFkNDQ0YzJkNjI3OGY5M2JlMjRmOTgwMDc5NjFiOTNmZTA2NGE2Y2E5YmYifQ" + }, + { + "resource": "repo://client/src/zeroHub.ts#L278-L300", + "version": "repo-lines-v1:sha256:35a4454ec90550ce26fbcf32ce74e38ac653dac7859520bf1489cbb37a0e79a9:eyJzZWxlY3RlZExpbmVDb3VudCI6MjMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZhNWRmODI2OGE5ZjcwMDM4OTQ1MTc5NTQ0N2RlYjUyZTRkMjBiNzUxMjMyNjJhYTcyNTA2MGRkZWZiMTk2ZmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZhNGU2OTNmN2FkY2Q4YmUzZmM3ZDUwNGZhZDQ2NTFhYzVhODgyNWRhNTQxOWFiMzdhNjQ3Y2ZjZWZlODhjODIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNiNzIzN2E5YTI5ZTZjMGFkMjdjZmJjNGM2MmZmOGI2YjFhY2Q2NDVmNjFjZDcwMzk3M2UzY2U2YzQ2YmIzMjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjYyNTFmOWYyNDgwMzE4ZTI2ZDJjM2NkNTY3ZWI5MmNmYTM4NWFiMjNiNTBlNmYwMjA2ZDk2MTAzZWJkYjZmZjEifQ" } ] }, @@ -37,42 +41,50 @@ "statement": "The Go signaling server listens on 0.0.0.0:8080 by default and requires APP_CLIENT_SECRET to be set, refusing to start otherwise.", "evidence": [ { - "resource": "repo://server/pkg/handler/handler.go#L137-L149", - "version": "repo-lines-v1:sha256:37094b92ee24317319136016132242c0c360b6a015892cc3d5bc5ebdfd966dfc:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE5MmQ4ZmQ2NzA0ODBjYTA1MTE4YWFlYzM0YzM0OTg4NTNlY2E5YTY0OGY0NjMxZDUxMmYzNDRhYjNhOWQ1ZjUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjZiMDU3NTUxMDA4ZDUxNzI2NDYwMjQ1NWIwMGU5YmFlZGIwZjlkZjQ3ZGMwZWFkZGQwODg5OWM1NjNkNmU4N2IiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6Ijc2YjYzMWQ0NGRiYWUyODRjZmI5NTc5MzA5MGU4ZDM1MzVhY2Q5YzBlNDYwN2Y5NzZlNTQ0ODA0NzMxNzFlNDgifQ==" + "resource": "repo://server/pkg/config/config.go#L29-L30", + "version": "repo-lines-v1:sha256:139c04d8d8debb6c272a06242639af33ad2c6a232d85728b5d0a19030f429ca9:eyJzZWxlY3RlZExpbmVDb3VudCI6MiwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZjk4MGFlYzQzNmIxY2Y3ZjQzZjViZmQ1NDJiMmQ5YWI1YzIwOTFhZmMxYjliODJkOWEzYjkyMTlmZjgxOGE4NCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNzdjY2E0ZmRkYzNlOGI2YjBjZGVjMjc0M2Q4OThiN2VkMzhjMGJjNGI0YzM4ZjBkN2RiN2E1OWE0NTYwZjRhMSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiMTlhZWMwMTI4ZWYzNzMyNTYzZjMzZDI3MWVlNjkyOWUwYjk5MWE4MzZhMDExZmVlMmJiMTBhYTBlMTZhZTFjNyIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNjJhMTBlNGJkMDEyMTJkMjEzNjhhZDAxMDBmZGU2ZGJkZDAzNTJkYWMwYmE0M2QwMWE4MTE1Y2JkZWI1ZmI5NiJ9" + }, + { + "resource": "repo://server/pkg/handler/handler.go#L155-L158", + "version": "repo-lines-v1:sha256:af305a46a22922406441e71df3d52e994b951ce8cfed1396dd2c7377bbaa853f:eyJzZWxlY3RlZExpbmVDb3VudCI6NCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNmE5YTAwMjY5NWFjYmY2NWIxNTdkNjU3OWY2NDI3OTFhZDg0ODAxZTdkYTgyNjY5NTkzNzEyODk1MDUzMzMwMSIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNWY3YWY4NWE5OTVlZjViZjdlZDkyYjEwYmM5YzhjYjdlYmRiMGRmNDg3MTNjMzQ0ODkyMjllMGI2Nzg5OWIxOCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiMzQxM2MwZDNhOWYxNDA2NGFlZmNjMzM4OTFkNjIwODQ2MDBjZjhkZmY2MjA4NTA0MDZiODUwMDk5ZWNjODNkMSJ9" } ] }, { "id": "claim_3b5cf199dd3a4770bdf30af1406d7859", - "statement": "The root Makefile provides make proto-gen to regenerate the shared client/server protobuf definitions, make test-all to run the full server + E2E test cycle, and make server-test / server-serve for server workflows.", + "statement": "The root Makefile provides make proto-gen to regenerate the shared client/server protobuf definitions, make test-all to run the full test cycle (server unit tests, two-server E2E, and client type-check + vitest, in parallel), and make server-test / server-serve for server workflows.", "evidence": [ { "resource": "repo://Makefile", - "version": "repo-file-v1:sha256:88e925b14c788e4c2ea098abc8791c1ad186880027ba73f56c3c7d6ff0fcb8ab" + "version": "repo-file-v1:sha256:59c4a8253da448988d2a4ecc49f91f2b3567ed01b9a883757210b1f7f007b5ec" } ] }, { "id": "claim_2c42fe6960e84b24ab6cfe916a4374f6", - "statement": "The test directory contains both the Playwright E2E suite (Svelte harness components driving the real ZeroHubClient against two live servers) and a set of unit specs that exercise client internals in a Playwright page through a unit harness (test/unit-harness/index.ts) with a mocked RTCPeerConnection and a globalThis MockWebSocket, requiring no live server or real WebRTC stack; running the suite via cd test && npm test builds both the E2E Svelte harness and the unit-spec harness via esbuild before invoking Playwright.", + "statement": "The test directory contains both the Playwright E2E suite (a plain-TypeScript harness at test/harness/index.ts, bundled by esbuild to test/dist/harness.js and injected into a bare data: URL page, driving the real ZeroHubClient against two live servers) and a set of unit specs that exercise client internals in a Playwright page through a unit harness (test/unit-harness/index.ts) with a mocked RTCPeerConnection and a globalThis MockWebSocket, requiring no live server or real WebRTC stack; running the suite via cd test && npm test type-checks and bundles both harnesses in its pretest step, and Playwright runs serially (workers: 1) with the one-way migrate-latch spec named zz-migrate.spec.ts so it runs last.", "evidence": [ + { + "resource": "repo://test/harness/index.ts", + "version": "repo-file-v1:sha256:63e2c55f19f41220ccbad6e44aa61bc53a6f993f977811b5abac2573ac704178" + }, { "resource": "repo://test/package.json", - "version": "repo-file-v1:sha256:b0267776b479247664710982a114cd0550f260cbf429c8ffb2b6bf72e20e3ec4" + "version": "repo-file-v1:sha256:85683518c82c046f227b61a2a7a504eefe77c0f983ecf44a4e4f04e5d590deb3" }, { "resource": "repo://test/playwright.config.ts", - "version": "repo-file-v1:sha256:a0e5f4efc37af724af8cac7f4d0361ca73b7db18f0ea5844ce679e874d5d6758" + "version": "repo-file-v1:sha256:2971c4c0273d8dd02ce6772aedd5df79e828ee2b93a7fbded39e22447a4a633d" }, { "resource": "repo://test/unit-harness/index.ts", - "version": "repo-file-v1:sha256:43686dadf678577ec8bb43067d03885da044a8bc757b94f1ccfc596a3f96001d" + "version": "repo-file-v1:sha256:4b9bdf4c7d5bb0b131ccaf581fe630d66a2d4261476a96b45b58230a36424ef7" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T20:39:20.288Z" } } diff --git a/openwiki/.claims/subsystems/client-sdk.json b/openwiki/.claims/subsystems/client-sdk.json index b95caa0..9302362 100644 --- a/openwiki/.claims/subsystems/client-sdk.json +++ b/openwiki/.claims/subsystems/client-sdk.json @@ -1,158 +1,146 @@ { "schemaVersion": 1, - "pageVersion": "sha256:50521a05b8c690b969a2f6027245e965d4e08e0b8ca6c066819b62b892bc0ce8", + "pageVersion": "sha256:39557c8c0ef9c6c9e53ed943580a1cbcf09dc1ce71211da29d4cacb47a224de2", "claims": [ { "id": "claim_f8eee7b4d94d405e8ae1cd7638c1d8cf", - "statement": "ZeroHubClient.reconnect handles the 1001 going-away redirect case (newHost argument) before falling back to host failover: the close reason is validated as a well-formed host via isWellFormedHost (client/src/utils.ts, mirroring the server's validateBackupHost); a malformed reason logs a warning and falls through to the automatic host-failover path without touching host state; a redirect equal to this.host (self-redirect) surfaces onZeroHubError and stops; a valid redirect updates this.host and hostIndex (pointing at the redirected host when it is in the configured list) before calling connectToZeroHub. For the host-failover path (no newHost), reconnect re-checks the isDisconnected flag inside the async getZeroHubBackupHost().then callback (not just at entry) so a disconnect() called while the backup-host fetch is in flight does not resurrect the connection, and aborts if the backup host equals the current host.", + "statement": "ZeroHubClient.reconnect(currentURL, newHost?) is the single recovery entry point: aborts on isDisconnected or reconnectAbandoned; validates a 1001 redirect host via isWellFormedHost and updates host/hostIndex; on abnormal close runs same-host retry with exponential backoff (maxReconnectAttempts default 10, base 250ms × 2^n, ±20% jitter, capped 30s), then host failover (advance hostIndex), then wraparound to the first host bounded by maxReconnectRounds (default 2), and finally latches reconnectAbandoned and surfaces the terminal error via onZeroHubError.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L288-L380", - "version": "repo-lines-v1:sha256:e652757e5757dce0f9ffe558e27c3c8a2eff0f1c50e19cc1491d09c9bfa7a1b8:eyJzZWxlY3RlZExpbmVDb3VudCI6OTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliY2FlYTFkOGVkZTZhYTJkMmY4MmUyY2IwNDE4Y2UzNjVlMjE1Y2NhMDMxNDExNjg2ZjJhNzZjOGFlOTBkZDAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3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GFiMGJkOWYyM2U5NzllMzdjMWJhMzExN2QyY2I1ZmE2YjFiIn0" } ] }, { "id": "claim_4b0dc7e91368409180c96e9a923cf9e7", - "statement": "ZeroHubClient.disconnect() sets isDisconnected, clears pending ICE timeouts, calls the shared closeActiveSocket() helper (which detaches onclose/onerror/onmessage/onopen and closes the socket with code 1000 so onclose does not auto-reconnect), then transitions every peer to Disconnected and closes each RTCPeerConnection via removePeer, emptying the peers map; the client is reusable afterwards. connectToZeroHub also calls closeActiveSocket() at the top to tear down any socket left open by a previous entry-point call without going through disconnect(), nulling handlers first so the replaced socket does not fire reconnect() (which would advance hostIndex a second time for a single logical failure) or onZeroHubError.", + "statement": "ZeroHubClient.disconnect() sets isDisconnected, cancels the queued same-host retry timer, resets reconnectRound, clears all pending iceTimeouts and webRtcRecoveryTimeouts, calls the shared closeActiveSocket() helper (detaches handlers, closes with 1000), then transitions every peer to Disconnected via removePeer and empties the peers map; the client is reusable afterwards. connectToZeroHub also calls closeActiveSocket() and clears reconnectAbandoned before opening a new socket.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L618-L629", - "version": "repo-lines-v1:sha256:0f9b8246a41893c3af6043a7d7529ebfce115acbf7614b50da89621fe6b49b81:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQ4MzRkMTExYWIzMWRkYjU2YWQwNDMwYmQwODMzMDRlNGY2MjZmNTg3NDI3OWYzODAzZDc4NDExNTM4NWQxMmMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjcwODQ5NjBmNjk1MmM1NWUyZWNiMDU1NmE4ZjE1ZmU0NzFjNDQ3YmRjMDk2Zjc1ZDNjZDQ4ZmFiYzU0MWMyY2MiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImE5YzkxNzYyZDk2ZjRlMmUyMGM5NmNjZTI2MmE1NTIwOWYzMTUxNjc4NzJkNzlhMTMwNGJjNzVmNTZiNTcyZjYifQ" + "resource": "repo://client/src/zeroHub.ts#L1201-L1239", + "version": "repo-lines-v1:sha256:782684a7c50f3a7f80cdad7052c7d8a5537f2ddce3a523b07396ffba4bed15ed:eyJzZWxlY3RlZExpbmVDb3VudCI6MzksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjlmMzcwZTFkOGE3YjU2OTU3NGNkZjc2Y2I1NDY0OWQzNTcwM2YwNzY4ZjUwM2VlZGRlMGIyNmU1Yjg2MjA0MjIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjJjZWIwNTBmZGRlZWU2ODEyZDNiMDhiYjYwMzU0MGU1N2RhYThiZDE0OWQ4MjcwNzI5MDk0M2VjODA2M2JhNTIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImI3ZTY5Y2NmZDcwN2MzODY3YzQ2ZWYxYTZmODU5NGIwZGExMDk0YjFmMDE2YTk2MDZlMDViZjJmMGM2MDJiOGUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjYzNTBmNThjNmY5OWNkODRlZjFjODc2NGU1NzRhMjM4NzliMDBkYWY4NzdjYzBiYjA3M2MzNzhjMmFmNzMwMjcifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L721-L740", - "version": "repo-lines-v1:sha256:b469d9cd6cc3bd18caecd17bbbb318e6002a1d3d78134594b5b0ae953236b8b3:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFza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EzYWMyNThmNjhlMjAwYjkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ2MGQzZDg5Y2ZiN2UxYjU5M2FhNjdhMTEwZDlkODZkYzdkMWFjYWIxZDM0NjRjNTU4YTI2NDE3MDdiNTk0MmIifQ" } ] }, { "id": "claim_82a5551e89604d8aaaa4f2c8a8c72c42", - "statement": "The WebSocket onclose handler interprets close codes: 1000 does nothing, 1001 (going away) reconnects to the host named in the close reason (the migration redirect), and 1006/1011 reconnect, while other codes fire onZeroHubError.", + "statement": "The WebSocket onclose handler interprets close codes: 1000 does nothing; 1001 hands the close reason to reconnect(url, reason) as a migration redirect; 1006, 1011, 1012, and 1013 all feed the reconnect loop; any other code rejects the still-pending connect Promise and fires onZeroHubError.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L675-L706", - "version": "repo-lines-v1:sha256:cd5d82aa7499e609c1e00e9e4b912fbc672263974b32c44c1394f13388e8500a:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhiZjQ1OThmMmM3ZjNjOWRkZTljYzA3NDFjMDU2YmFiMmRhZmVkZmUyYzUzYTNmYzlhMWJmODhkNjQwMDRmZDgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFkOWUxMjU0NjQyNTU3NmQzZGVhZThjOWI5ZGJmMTI4ZDVkNmRkYWY1ZDdmZTg1NzkzNDkyN2RlZmZhM2I5ZGQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjE4M2M0YjJhYjY3YTdmZGU3ODY4NWUzMTUwODhkMDZhM2QxY2ZjMThlNjBmY2ZlMTVhMzhhZjAzMzk3ZDhkNzQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjI4ZTc1ZjJjNDVkYzYwNDRhNjRiOWY3Y2Y1ODNhZjJkZDNhZjQzODNhOWQxOTZkNDM3M2UwMmRjYWI2ODVkMTMifQ" + "resource": "repo://client/src/zeroHub.ts#L1319-L1368", + "version": "repo-lines-v1:sha256:d36000e1e9fe52d95945f74e83e13d52ef3f579d85b29b1786d35c83bc092c4f:eyJzZWxlY3RlZExpbmVDb3VudCI6NTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRiYzkzNDE1ZmJmYWQ1NjY2OWNkNGE5YmUzYmM1M2RlMTFiYzAzYzkxNGQ1MDMxOTk3ZWFkYmFjZTlhNTk0NDgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZlMzNkYzczMWU3ZDA3YjFmMGMwNWNmZWJkN2UxOTIyMDIzZTYwNzdiYzBhZTdiYTMwMTQ4ZjUwODMzYTI1YTkiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA3MTliNjZhZDMwNDg1MzkwZGE2M2ZiNjgwNzU3YWZjOGNmOWQxZGU1ZGM0NTNiY2IxMGFjMDdjZWQ1NzAzNTciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQ0Mzc1NDg0NGM1MGE1N2VlZDhhNjUyMjJlMTgwOWVkOTE0ZmIyZTc0YWIyZjEwYzE0M2M3ZWJlZjg2ZjMxMTMifQ" } ] }, { "id": "claim_94fcb528042c4c2e97fadddc7328073e", - "statement": "connectToZeroHub resets the manual-disconnect flag and clears stale ICE timeout handles, so a client that previously called disconnect() starts a clean reusable connection on any new entrypoint.", + "statement": "connectToZeroHub resets isDisconnected to false, cancels any queued same-host retry timer, and clears the reconnectAbandoned latch, so a client that previously called disconnect() or hit a terminal error can start a clean reusable connection on any new entry point. Pending ICE candidate timeouts are intentionally NOT reset here.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L636-L643", - "version": "repo-lines-v1:sha256:42b1a27675c0d03812bf8552e1ddf4f62d9807d27d0042a3e6efa6e7ef869496:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZTEyMjE3OWE5NTNiZWRkZDY0YTNhYWRjOWE0N2Y4NmQ0NDJhMzQ0N2E0MjhmZjQ1MGE2NTFmOTQwNTA0NjkyZCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNmEzZWMzNTk2NzZkMDNkNmNlMmE3N2YzMDE2NmQyMTFkNDk1MzEyNzU0NjVkMmE0Y2M1NzYyN2M3NDk1ZWUxOSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiZmY3MjU3NWJmMzllOGQ3YjY2MmM4ZjcxNDIyZjNkMzYwNGE1NmFkNTZhYTE0MTgxM2FjMzkwNmVlZGViOGZiOSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiYjRhZTBlZTQ5MTAxNTU0NDdiOTFkMGY0NGFhMjFmMTYzMjlhM2U1OThkYjA1N2RmMTYxZWRhNDYwNmJjNjIxYiJ9" + "resource": "repo://client/src/zeroHub.ts#L1201-L1240", + "version": "repo-lines-v1:sha256:ad8ecb08fd2717dee3740e60db1ca580789ebf690af7c234798cde304ac1b001:eyJzZWxlY3RlZExpbmVDb3VudCI6NDAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjlmMzcwZTFkOGE3YjU2OTU3NGNkZjc2Y2I1NDY0OWQzNTcwM2YwNzY4ZjUwM2VlZGRlMGIyNmU1Yjg2MjA0MjIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImI3ZTY5Y2NmZDcwN2MzODY3YzQ2ZWYxYTZmODU5NGIwZGExMDk0YjFmMDE2YTk2MDZlMDViZjJmMGM2MDJiOGUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjdmOWQ0OTQ3Y2FhNGQ4YTA2M2VkMmVhZWU3ZmNlOGYzNDYzN2M5YzhmZjk2NDQ0NDVhODNiYmU5MWM0MjM0YjAifQ" } ] }, { "id": "claim_bd4128b0cd9d456c8ec9c4355a36c977", - "statement": "SFUTopology routes all P2P traffic through a single SFU peer (the numerically lowest peer ID by default, or an explicitly set one — peer IDs are sequential decimal strings, so election sorts parseInt(id, 10) rather than lexicographically); the SFU offers to every client and non-SFU peers connect only to the SFU, trading a single point of failure for better large-group scalability.", + "statement": "SFUTopology routes all P2P traffic through a single SFU peer (lowest numeric peer ID by default, or an explicitly set one via parseInt(id,10) sort); the SFU offers to every client and non-SFU peers connect only to the SFU. When the currently elected SFU leaves the hub, reElectSfu re-elects the lowest remaining peer and re-establishes the star, deduped by lastElectingSfuId; an explicitly configured sfuPeerId is never overridden. On WebRTCDisconnected only the SFU side re-sends an offer.", "evidence": [ { - "resource": "repo://client/src/topology/sfuTopology.ts#L121-L166", - "version": "repo-lines-v1:sha256:1b02c3ce70d673c31b965e5a043b94a6adb40ee5561ebc37b8ca03469d7c7daa:eyJzZWxlY3RlZExpbmVDb3VudCI6NDYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVjNTgxNmFkMTY0ODM3ZTI1ODlhZjAwZDE0MmEwMTYyMzI0N2Y0MjQ1ZWYwZjFkNTJiOTJhZmVjMjJlZDYyNGMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJj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3MjQ2OGMzZDI1OTJhZjIifQ==" + "resource": "repo://client/src/topology/sfuTopology.ts#L103-L249", + "version": "repo-lines-v1:sha256:0d9b2f02b2ab31d9b47d603cf0f5aa78d047c5501b920c67d6a5ca013136710a:eyJzZWxlY3RlZExpbmVDb3VudCI6MTQ3LCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiI1YzU4MTZhZDE2NDgzN2UyNTg5YWYwMGQxNDJhMDE2MjMyNDdmNDI0NWVmMGYxZDUyYjkyYWZlYzIyZWQ2MjRjIiwibGFzdFNlbGVjdGVkTGluZUhhc2giOiIyN2U1Nzg4ZDVkOWQ3M2QyNGE4MWRiYzBhNWE3NGJmYTgyYzljM2IzYWY5OWU1MmFmNzk2ZTkwYjQ2OGE4YTNkIiwicHJlY2VkaW5nQ29udGV4dExpbmVDb3VudCI6MywicHJlY2VkaW5nQ29udGV4dEhhc2giOiIyMjUzNjMwNzhmNzc5MzVjNjdlYTRmMTM1YWQyNzYyYmNiNjI5NmI0YzEyOWEwOGY3Mjg4ZTI2YmQ3NTZlZTM1IiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MywiZm9sbG93aW5nQ29udGV4dEhhc2giOiIyNzNkZmVjZjBmZjBhNjNiM2E4YTM4MzIzMDFjZWQ2ZTMzYzRkZTEzNmM4YWNlOGNlNmM4YTZkNGJiZTM2OWQ2In0" } ] }, { "id": "claim_18ac9d0d7b6f47be9b05f9c35190c4d2", - "statement": "MeshTopology delegates per-peer WebRTC wiring to the shared peerSetup helpers: on Pending, setupDataChannel makes the offerer create numberOfChannels data channels labeled '0','1',... while the answerer wires ondatachannel, and setupMediaChannel adds localStream tracks to the peer's RTCPeerConnection; the offerer then sends the offer.", + "statement": "MeshTopology delegates per-peer WebRTC wiring to the shared peerSetup helpers: on Pending, setupDataChannel makes the offerer create numberOfChannels data channels labeled '0','1',… while the answerer wires ondatachannel, and setupMediaChannel adds localStream tracks to the peer's RTCPeerConnection; the offerer then sends the offer via parseInt(peer.id) > parseInt(myPeerId).", "evidence": [ { - "resource": "repo://client/src/topology/meshTopology.ts#L39-L58", - "version": "repo-lines-v1:sha256:8cb59a25800372c46756c4ad610adb293ac2769b386b1d2787557f0448cc78ca:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijg4NmEyMTNkZWMxMzQxODI2MDgyZGJjZDcwZmRlMzc5YjNiNTA3ZWRmZDJlY2ZhMGFmM2ZkYzE2MzVjNzM4OTMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQxNzQ4NTE3NzAyZTg3NWRkNWUyOWI3YmIwMjdhZjQ4MjI3NjcwY2I4YTQ4OGEyOTc0MGY1ZTlhYTg2OTAwMjUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjI3NjBkNzA4NDczNzBjYWU3NWFjNWY1MDFjM2UxMGRmZTJmY2RjNThjMjE0NjI2MmU4ZjA5Nzk0MjFhZDkwYmQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ0ZWIzNmIxMGRlZmU1MTlkMmRkMTRlZmZiNWZmOWE3MzQzZjI5MjczZmE0OTEyODkwZDFiOWQ5ZWViZTNkM2UifQ==" + "resource": "repo://client/src/topology/meshTopology.ts#L43-L97", + "version": "repo-lines-v1:sha256:db95b6b69fbd99a2d7da684fee67f5e44e241c9f45e9b533dd0b56ffa876d44c:eyJzZWxlY3RlZExpbmVDb3VudCI6NTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVjNTgxNmFkMTY0ODM3ZTI1ODlhZjAwZDE0MmEwMTYyMzI0N2Y0MjQ1ZWYwZjFkNTJiOTJhZmVjMjJlZDYyNGMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE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zZmI3NTI4ZmVhZTYwMjQifQ" }, { - "resource": "repo://client/src/topology/peerSetup.ts#L22-L54", - "version": "repo-lines-v1:sha256:4c0266fb8013ea8cfcef6e29e1dc61ed26b7923a78de4a755804f0fa4c496b8c:eyJzZWxlY3RlZExpbmVDb3VudCI6MzMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZhOWRkNTFmNzY3Nzg4MTlhM2Y3ZjcyMTQzNzBiYTFjZmY2MzI1NjJlNDJiMTljYWM1ZjA3ZjdiMmMxMDEyNWMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjUzMjI1NGRjMjFjZjVmZjUzY2I1NWFiOWFiZDY2MjliNDJlZTQ5ZjA2NjM2YjE3Yjc3ZWRkNmI0MGNhNmU4NDgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6Ijk3YmRkN2ZlMzgwNmIyYjY5NDIzNThhNThjOTU4MTg0YTc0NGJmZDVhYTM2ZWM1MTk3NmVjNzg3NGI3MTViMDYifQ==" + "resource": "repo://client/src/topology/peerSetup.ts#L83-L115", + "version": "repo-lines-v1:sha256:d65b3428a2da6cb5e128759d11a2854220fc21bcfe82c4bd0dc1503e698a7bba:eyJzZWxlY3RlZExpbmVDb3VudCI6MzMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImM5NjAyZWMzOTUwMDJjMjk0NDczMjJiYjRhNGQ5NmFmYWMyNTViZWJlZjc1ZjNmMjEyYTQzYTJmM2JjMjA1MDMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImM3MWJiN2FjYWFlNDZkNzAyZDQ4ZDkzYWE5NGM4OTg1NDRlNjQxZmJlYjNlMWYzNjY3MDJiMmNmNzc5MzYxNjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, { "id": "claim_e11cb136fda1448e855a0daaddcc3104", - "statement": "The default client configuration sets tls:true, logLevel:Warning, waitIceCandidatesTimeout:2000, autoAnswer:true, autoAcceptAnswer:true, and rtcConfig to Google STUN servers with bundlePolicy 'balanced', all overridable via the Config interface.", + "statement": "DEFAULT_CONFIG sets tls: true, logLevel: Warning, logger: console, waitIceCandidatesTimeout: 2000, autoAnswer: true, autoAcceptAnswer: true, maxReconnectAttempts: 10, maxReconnectRounds: 2, reconnectBaseBackoffMs: 250, and rtcConfig = Google STUN servers + bundlePolicy 'balanced'; all are overridable via the Config interface. LogLevel is Debug | Warning | Error | None.", "evidence": [ { - "resource": "repo://client/src/const.ts#L32-L41", - "version": "repo-lines-v1:sha256:280e3c166b9bb0de1460b22956b727000ef383f1a4bf8e566549900c7384173e:eyJzZWxlY3RlZExpbmVDb3VudCI6MTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjYyNzg3ZGJiMjQzMGU3ZTg4OGZkNWZiMjgzODdkMDMxMzVkYTc2ODMzNmY5OTc5YTQ1MDQ0ZTg4ZTZhN2VhOGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFhMWQxYTYzMzkwMjI5Yzc5ODM0N2U4M2EwNDA1NDQx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mI4NTUifQ" } ] }, { "id": "claim_336105228c7a4f48870a324b7f5b4f73", - "statement": "sendZeroHubMessage throws an error if called while isDisconnected is true or when no WebSocket exists, requiring the client to reconnect via createHub/joinHub before sending.", + "statement": "sendZeroHubMessage throws if called while isDisconnected is true, when no WebSocket exists, or when the socket exists but is not yet OPEN (a CONNECTING or CLOSING socket would otherwise make ws.send() throw a raw InvalidStateError); the error messages direct the user to reconnect via createRandomHub or joinStaticHub.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L747-L761", - "version": "repo-lines-v1:sha256:542c2df038f17eb0b461cc21f013d34915e39d5853f7f55eee7ec0cd5e0df7ea:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjFkOGRkNjVlM2Y3NWZlYWQ2NWU0YjExMDQzOTM3N2FhYjFhMDJjOWM2Yzg0ZmVlYjI1YjE2OWQxMWExMjJiNjYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjkyYjkzNDdkNjFiMDEzYTkyNDc3MTNmNWZkYWQ4MDJiMmZkYzU3ZDY5ZTM3NDNiNzc4MjIyMTZjOGVmZWMzMzEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImNmYTdmZTY1ZjUyYjE3NDU5MjM4MGE2MGNhODM3MDRkOTNiOTM0NGFkNjQzNDcwNDk4MzQ4OThkMjRiMmU0NDAifQ" + "resource": "repo://client/src/zeroHub.ts#L1439-L1458", + "version": "repo-lines-v1:sha256:6749dcc3e1805026b92628700504907f2d6c700b832bdb4d45afb606448aaf7b:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjFkOGRkNjVlM2Y3NWZlYWQ2NWU0YjExMDQzOTM3N2FhYjFhMDJjOWM2Yzg0ZmVlYjI1YjE2OWQxMWExMjJiNjYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjkyYjkzNDdkNjFiMDEzYTkyNDc3MTNmNWZkYWQ4MDJiMmZkYzU3ZDY5ZTM3NDNiNzc4MjIyMTZjOGVmZWMzMzEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImNmYTdmZTY1ZjUyYjE3NDU5MjM4MGE2MGNhODM3MDRkOTNiOTM0NGFkNjQzNDcwNDk4MzQ4OThkMjRiMmU0NDAifQ" } ] }, { "id": "claim_0bb2463bfe094c7db8b7ead9edcf6878", - "statement": "When getZeroHubBackupHost rejects because every host in the failover list is exhausted, reconnect's .catch handler surfaces the terminal error ('all ZeroHub hosts are not working, please check the ZeroHub hosts') through onZeroHubError; no further automatic retry is attempted.", + "statement": "Reconnect is bounded and not single-shot: every host gets maxReconnectAttempts same-host retries with exponential backoff, then the sweep fails over across configured hosts and wraps back to the first host, bounded by maxReconnectRounds full sweeps; only when every host's budget is spent on every allowed sweep does the client latch reconnectAbandoned and surface the terminal error 'all ZeroHub hosts are not working, please check the ZeroHub hosts' via onZeroHubError.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L241-L254", - "version": "repo-lines-v1:sha256:6f5b9af2e9be33eb392a84f7413871721aa94af6149325522300f7f17bc53cbd:eyJzZWxlY3RlZExpbmVDb3VudCI6MTQsImZpcnN0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M0ODlmOWMzNzlmNTI0YjIzNGY2MjdiZSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWE5MjkzZmQ4MDU0YjZlNDcyNDgzNzNmMzlmNGRkNzc4MDAxMDVlYjc1ODM0ODY4NzI1NDI4NWNkMTI4MmI3OCJ9" + "resource": "repo://client/src/zeroHub.ts#L649-L744", + "version": "repo-lines-v1:sha256:e28f174e503c6469c1ac7f5eae4a8956c7df9edee8eb58049681a01288645ce0:eyJzZWxlY3RlZExpbmVDb3VudCI6OTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjFhNDc1ZDU5YWM2Nzc1ZjUzNmE1ZGIwZTIyMDg0YTY2MDdiZjkyNDQxYjkzZjMxOTc0ZDkyYzg2MGRhMzY5ZGMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjRmMzExYTFmOWFiMTkwODA0MGMyZDJmZDBjOWRhYjkxODhiZWVjMTFkN2ZhNTYxYzE0ODBiNmY3ODYxNzE0NGQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVlYzk4OWIwODdkMDIyMDAzZjc0NDdiYTIyMzU0YWIwYmQ5ZjIzZTk3OWUzN2MxYmEzMTE3ZDJjYjVmYTZiMWIifQ" } ] }, { "id": "claim_1691c225c3d04d68be98e26d64aafa7f", - "statement": "sendOffer and sendAnswer merge per-call RTC options by spreading into a fresh local object ({ ...config.rtcOfferOptions, ...options }) instead of mutating the shared config, so call-site options cannot leak into the stored config.rtcOfferOptions.", + "statement": "sendOffer and sendAnswer merge per-call RTC options by spreading into a fresh local object ({ ...config.rtcOfferOptions, ...options }) inside the shared negotiateWithPeer helper instead of mutating the shared config, so call-site options cannot leak into the stored config.rtcOfferOptions.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L821-L824", - "version": "repo-lines-v1:sha256:922e126ae5c3e5d439ff70d7e66a7747839e7a1eead7ec63b2c2bb9613321085:eyJzZWxlY3RlZExpbmVDb3VudCI6NCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNjQ3NTMxNzRlMjFiMzBmMTNmMmNmYjE2NjBjMTIxZjI2YWIxMDJhMjA3MzgxNTIxMTZlYzBiYjZkZWMyMTM4MSIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiYWQ5ZTEyNTQ2NDI1NTc2ZDNkZWFlOGM5YjlkYmYxMjhkNWQ2ZGRhZjVkN2ZlODU3OTM0OTI3ZGVmZmEzYjlkZCIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiM2ZhN2Y0MDgxZGUzNTVjMzkyYjBjMWQ5NmMxN2JjNDQxODdkOWU5OWZlMzMxYWI3YWVhYjc2Y2FlNzU2ODlmYyIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWJhOTM4M2IzYTQ1MmIxY2QxNTBiODJkMGUxODBmODNiODhlNDc0NzlkNmU2ODhkODI4ZDc2NjljOTU2NGY5NyJ9" - }, - { - "resource": "repo://client/src/zeroHub.ts#L868-L871", - "version": "repo-lines-v1:sha256:922e126ae5c3e5d439ff70d7e66a7747839e7a1eead7ec63b2c2bb9613321085:eyJzZWxlY3RlZExpbmVDb3VudCI6NCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNjQ3NTMxNzRlMjFiMzBmMTNmMmNmYjE2NjBjMTIxZjI2YWIxMDJhMjA3MzgxNTIxMTZlYzBiYjZkZWMyMTM4MSIsImxh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OWJkNmJiOTcxMGIzODc2MzZlZDVmYzNmN2JiMmQ2MDU2OWIwMzJhZWM4ZDkxOWUwOWQzNjI3ZTY3NGQ3ZSJ9" } ] }, { "id": "claim_2b6a3e2ef22b4cc387020205c3a3370c", - "statement": "The WebSocket onerror handler logs and fires onZeroHubError but does not call reconnect: per RFC 6455 a network failure fires error and then close with code 1006, and reconnecting in both handlers would advance hostIndex twice for a single failure (skipping two hosts); all reconnection is handled in onclose.", + "statement": "The WebSocket onerror handler logs and fires onZeroHubError but does not call reconnect: per RFC 6455 a network failure fires error and then close with code 1006, and reconnecting in both handlers would advance hostIndex twice for a single failure; all reconnection is handled in onclose. The error also settles the connect Promise to avoid a permanently pending promise.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L667-L674", - "version": "repo-lines-v1:sha256:d185ed3dc5fe82df3fb50161baca93df1edb59d081417444306692adbba42bce:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMDc1NzYyOWVlYThjYjYxZjFiODZkZGIyZjVmMDBmYTMxNjJlYTQ1ZGE2NjA5NzdjNTNhMzI4YTliODVhNzg1ZiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiYWQ5ZTEyNTQ2NDI1NTc2ZDNkZWFlOGM5YjlkYmYxMjhkNWQ2ZGRhZjVkN2ZlODU3OTM0OTI3ZGVmZmEzYjlkZCIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNTcwM2FkMGE1MWI1Yzk4ODE2YTgwOTJkNWFhZjY3MTM4YTVkNmU1MjRmNjgwYjI5MWM3Y2I3NTRlYWM0ZmVkMiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiY2ViMTI1YzA0ZWM0NWQ0MjU0ZmIwOWQzYjMwNDQ0MmE1NzAzNTk2NDNmMTQ3MTcxY2RkYjhkOTgwNzEzYmU1MiJ9" + "resource": "repo://client/src/zeroHub.ts#L1297-L1318", + "version": "repo-lines-v1:sha256:ce5a7b31b264dd7b690ec5642652225853c87b1d15c35ca8c5dea4895cbca36c:eyJzZWxlY3RlZExpbmVDb3VudCI6MjIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVlZjE4OTMwNGI3ZDQ3OTc1MzRmZjgwYWU5MzIwNGY2M2FlYzEzM2JjNGRmZGU4ZTg0Y2IzNzNjNDhhNTRiNDkiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZlMzNkYzczMWU3ZDA3YjFmMGMwNWNmZWJkN2UxOTIyMDIzZTYwNzdiYzBhZTdiYTMwMTQ4ZjUwODMzYTI1YTkiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjFhYjAyYjg3YjdiZjg3ZmUwNTNhOGRlNDcyODBlMGE5YTJiZWE5OTBjYzU4MzlmNzQ4OWIyZjFlMTc0ZjQ4YWEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQwYjI1NGMyNzA1MzYwYTViMWU4OTM2MDAxYzVkZThhMjhjMzBmZjAyZGMwMjZkNmE3MTQyMzI3OWYyMTcxOTIifQ" } ] }, { "id": "claim_3d7994bff5cc4ef1aa3bd7aaf510d9a3", - "statement": "All eight hub connection entrypoints (createHub, joinHub, createPermanentHub, joinPermanentHub, joinOrCreateHub, joinOrCreateIPHub, createRandomHub, joinRandomHub) funnel into the private openHubConnection helper, which stores supplied metadata, builds a URL from getWS(host, tls) with id/hubMetadata/peerMetadata query params, and calls connectToZeroHub; the former joinIPHub entrypoint was removed because a client-supplied id can never resolve to an IP hub.", + "statement": "All four hub connection entrypoints (joinStaticHub, joinOrCreateIPHub, createRandomHub, joinRandomHub) funnel into the private openHubConnection helper, which stores supplied metadata, builds a URL from getWS(host, tls) with id/hubMetadata/peerMetadata query params, and calls connectToZeroHub. The former createHub/joinHub/joinOrCreateHub and createPermanentHub/joinPermanentHub entry points were removed; joinIPHub was also removed because a client-supplied id can never resolve to an IP hub.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L1123-L1148", - "version": "repo-lines-v1:sha256:0de34f8b7d331a62474f639f32749cee572d7fba730a5b9c9a6cd48464cb448b:eyJzZWxlY3RlZExpbmVDb3VudCI6MjYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZjNmQ0Mjg5ZjZlZmVkMTE2OWY4M2NjZDBiMDJjZWU1MmIwMjljZGVlODRkOTJhZGZjMmFlMjhhOGU1NWViM2EiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNmZDg5OWY2NmVmZjBiMDVjMzU5MjQwZTI5ZTg1MTk3NDIyNGY1Njg4N2NhZjNlZWIyMWRiMjMxMzVhYmE4YTkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjM3OTI5ZTkxZTBmOTljM2U4MjVkZTY5YjQzNWZiNjQ4NGQxYjBhMWRmMmY0NjU2MWFiZjFhMjlmMDQxODhiODgifQ" - }, - { - "resource": "repo://client/src/zeroHub.ts#L985-L1121", - "version": "repo-lines-v1:sha256:cebe29605f88e17757453628649d7ced7d7ee877094aff35d97f4b293de94ef1:eyJzZWxlY3RlZExpbmVDb3VudCI6MTM3LCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiJmZjVkYTYxMzExZGQ3NzU0MDMzZjQzODkxOTBlNGNkNjNiZjA5OWE5NzQ0ZTI5NzNhOGFiNDE3M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SGFzaCI6IjAxYWUyMzU0YTMyZmM4NTNhODNhOWI4MmI3M2VjMGI1ZTk3OGMzNmZkMTU3OTUyOTBkMTkzNjQ2ZDRiYzA0Y2QifQ" } ] }, { "id": "claim_94dec8e87c65413b9d94fa60a17902c9", - "statement": "On a hubInfoMessage the client reconciles its local peer roster against the authoritative roster carried in the message: it adds any roster peer not yet in the map and prunes any peer it still holds that is no longer listed and is not itself, firing ZeroHubDisconnected and tearing the peer down via the shared removePeer helper. This prune pass is the auto-reconnect fix; without it a peer that left the hub while the socket was down would linger as a stale Peer holding a live, unclosed RTCPeerConnection.", + "statement": "On a hubInfoMessage the client reconciles its local peer roster against the authoritative roster carried in the message: it adds any roster peer not yet in the map and prunes any peer it still holds that is no longer listed and is not itself, firing ZeroHubDisconnected and tearing the peer down via removePeer. This prune pass is the auto-reconnect fix; without it a peer that left the hub while the socket was down would linger as a stale Peer with a live, unclosed RTCPeerConnection.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L405-L453", - "version": "repo-lines-v1:sha256:9c5329aa7d7171db5bbf5441d6784f1102fe52869b66705185ed0966b8360d4a:eyJzZWxlY3RlZExpbmVDb3VudCI6NDksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxNWExNDYyOTRlZjQ5MTI1MWVkZjg3NWQ2OTljZWU3N2ZkMTNmNzUzZTc1NDZhZTVmOTJlOGVmYzM4ZDcyNzIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImUwZjg2OGYyOTM4NDhlZmRjNzQ1NDUzYmUwOGQ1ZTI5OTY5MTQ3NjIyZDFkOTI4MDRiOTc5YWQ5YzgwZTdhYzciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjdjZGM1NmEyNDA1MzBmMzVhODUwNjgxNTVhMTFhNDQ0ODEyMjk2M2JiOGRjMmE1YmI1ZDA4YjM3NmZkMzI5NjUifQ" + "resource": "repo://client/src/zeroHub.ts#L804-L839", + "version": "repo-lines-v1:sha256:d3d0b505365f1fcf569ad0e1ce62d17196b3cf4e497b4e748839f64e935777da:eyJzZWxlY3RlZExpbmVDb3VudCI6MzYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImRlZWVlNWJlMzQ5ZjE5ZDc5MGVhMzRkNDM2ZTc1MTYwMWEzMjYzYWY4M2E3ZWMyN2FkYWIwNjQ4MDFhMGJkYjkiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjAxMzQxZDBjNTg4MmU5MWE2NmM2MGNiODYwMjBiMjQ3ZjBhZmMzMzZjZGY3NmMwYWUxOGJjZDIwYWM4ZmUxZDUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjdjZGM1NmEyNDA1MzBmMzVhODUwNjgxNTVhMTFhNDQ0ODEyMjk2M2JiOGRjMmE1YmI1ZDA4YjM3NmZkMzI5NjUifQ" } ] }, @@ -172,81 +160,73 @@ }, { "id": "claim_bb5769354e864cb2bc46833d98cc362e", - "statement": "Peer creation and teardown are centralised in the shared addPeer and removePeer helpers: addPeer builds a Peer with a fresh RTCPeerConnection, parses metadata, wires the connection and ICE state handlers, stores it, and marks it Pending; removePeer closes the RTCPeerConnection, nulls the state handlers so a stale ICE event cannot call restartIce on a closing connection, and deletes the peer from the map (a no-op if already gone). These are shared by the hubInfoMessage, peerJoinedMessage, peerDisconnectedMessage, roster-prune, and disconnect paths so teardown semantics cannot diverge.", + "statement": "Peer creation and teardown are centralised in the shared addPeer and removePeer helpers: addPeer builds a Peer with a fresh RTCPeerConnection, parses metadata via safeParseJson, wires onconnectionstatechange / oniceconnectionstatechange (both schedule P2P-drop recovery via scheduleWebrtcRecovery on disconnected/failed), stores it, and marks it Pending. removePeer clears the peer's pending ICE-candidate fallback timer and P2P-drop recovery timer, closes the RTCPeerConnection, nulls the state handlers, and deletes the peer from the map (a no-op if already gone). These are shared by the hubInfoMessage, peerJoinedMessage, peerDisconnectedMessage, roster-prune, and disconnect paths.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L544-L553", - "version": "repo-lines-v1:sha256:babeb49a75469fd0f7c1fc3f02dde3b0cc4ce112558d3fdaf264aecf10941290:eyJzZWxlY3RlZExpbmVDb3VudCI6MTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhjMzg5NGNkMTg2NDFlMDY3ODY3Mzk5YjRhMmQ1ZTNkNDgyZDNlNjgwZDMwN2QxMTkwNTk3MDkyM2NjNGE2MTQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImE2YWE3ZDZiMjA1NDM3MmZjMTQzNmFmMWJmYjU4ODExMjcyMzUxMDFkODEwMzBiNGRiMmUyZTBjNGU5YzdkNjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVhYzc4YjEzZGFmZTY5ZTNhZDcxODk3NmU3OTUzNTAzODYwYzJmYThkM2I5NzE2YzRlMWVlYWM5OGRmYjg4NjcifQ" + "resource": "repo://client/src/zeroHub.ts#L1122-L1154", + "version": "repo-lines-v1:sha256:65f365d707c7fbe18363aa28f529f6b2a399024717b13fc47609658a5ad95af9:eyJzZWxlY3RlZExpbmVDb3VudCI6MzMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQwMzNlNzUxY2NkNjYyMTE1YjQxYzM1ZWQ5Y2Y1YmRlMzRhMjVjYjg2MmRkZDdhODFiNjkzYjRhZDdkMWVjZDIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjkzZGVkMGRiZGE4ZmM1OGY2NjA0Mjg3Y2NmYWQ5YjRhNmRmZmIwNjllODU4ZGM5Y2ZmMmQxOWYxYTUxN2Q1M2YiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjUyYjgyYzBiN2NmNjdiYzYxZDIzZTZiNjhjYjZhYTc3Yzg0MGFjYTM0ZTQyZWQwOGZiZjQzNDM2OGE0OGZjNjEifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L576-L616", - "version": "repo-lines-v1:sha256:a0fb6731e74eb7f1dc9764b60253b1d7838085960836e261f79914d15df08acb:eyJzZWxlY3RlZExpbmVDb3VudCI6NDEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQwMzNlNzUxY2NkNjYyMTE1YjQxYzM1ZWQ5Y2Y1YmRlMzRhMjVjYjg2MmRkZDdhODFiNjkzYjRhZDdkMWVjZDIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQ2ZTY3ZjYyNDM0ZWJmYmMzOTlkMWVlYmUwMzM4NDViYTQw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JlZDM2ZDQifQ" } ] }, { "id": "claim_fe80df61090748b8992b0111552683e8", - "statement": "On a 1001 migration redirect, reconnect first validates the close reason with isWellFormedHost (a bare hostname or host:port with no scheme, path, userinfo, whitespace, or port > 65535, mirroring the server's validateBackupHost); a malformed reason (e.g. a proxy's 'Server going away' text) falls back to the automatic host-failover path without touching host state, and a reason equal to the current host is rejected through onZeroHubError instead of retrying. On a valid redirect the client updates this.host to the redirect target and, when the target is in the configured hosts list, points hostIndex at its position, so later entry points and failover start from the redirected host rather than the stale one.", + "statement": "On a 1001 migration redirect, reconnect first validates the close reason with isWellFormedHost (a bare hostname or host:port with no scheme, path, userinfo, whitespace, or port > 65535, mirroring the server's validateBackupHost); a malformed reason falls back to the automatic recovery path without touching host state, and a reason equal to the current host is rejected through onZeroHubError instead of retrying. On a valid redirect the client updates this.host and, when the target is in the configured hosts list, points hostIndex at its position.", "evidence": [ { - "resource": "repo://client/src/utils.ts#L15-L61", - "version": "repo-lines-v1:sha256:6125f7cbec77025e98e9271770c3a3e494c657434b0e77f2526874817ad9fdb6:eyJzZWxlY3RlZExpbmVDb3VudCI6NDcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVhZjIyY2YwNzMyNTkyYzI0NzE0MWNiZTYxZWZhMTEwMTI2MTJmNWEzMTIyYjlhZjliYmFmNTJmNTcyNGQxOTQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjljMzJjM2E2M2Y3MmRlNDJlMmFjZmMxYmMwYjFlNWRkZjQ5MmQ4OTE4NDdmZTZhOTI4N2JlNDQ3YzBjMTAwN2IiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + "resource": "repo://client/src/utils.ts#L51-L92", + "version": "repo-lines-v1:sha256:b42185d8f66f226f899c5e67177fc31146534146875516ff50408cabeb73f80a:eyJzZWxlY3RlZExpbmVDb3VudCI6NDIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZhODNlZjJhMzlhNDIzM2YzMmY2ZTE2NmEyNjNlZjRhOGE0ODc5OTc3MDE2Nzk0MDNkYjAyMjA0M2YxYWVlZmYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjE5YjdiOTYwYmQ3YWRjNWY4MWM4MTZmZmQyMTJmODQ1MGI1YjMzMWNmMTYxY2NlYTMyNjUzYjViYjViMGJkYjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L293-L345", - "version": "repo-lines-v1:sha256:03352dc6e2aa7283915e29654e18c4c58e551f24b1882be2d9344a07a12847aa:eyJzZWxlY3RlZExpbmVDb3VudCI6NTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI1OTQyZjc5NGVjYzQ3MDVlMzNlNjRmMGJjZDQxNDVlYzU3MDI3ZjE5YTZiZDhhNDhhZWYzOTFjNDBlY2Q1ZGIiL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zaCI6ImNmZmM5NTEzZmM4ZTY0NjA3MjAzZTBhYzNiODczODQ3OTYwOGU2ZmVkODEwNzcxZDM4NDM3YzRjNjMzMTYwZWYifQ" } ] }, { "id": "claim_fab1320d27cb4ee9b13d4d8609736414", - "statement": "connectToZeroHub tears down any live WebSocket through the shared private closeActiveSocket helper before creating the new socket: the previous socket's onclose/onerror/onmessage/onopen handlers are nulled (so it cannot fire reconnect() and advance hostIndex a second time for one failure, or a spurious onZeroHubError), then it is closed with code 1000 and this.ws is cleared. The same helper is used by disconnect(), so a second connection entry-point call without disconnect() no longer leaks the previous WebSocket.", + "statement": "connectToZeroHub tears down any live WebSocket through the shared private closeActiveSocket helper before creating the new socket: the previous socket's onclose/onerror/onmessage/onopen handlers are nulled (so it cannot fire reconnect() and advance hostIndex a second time, or a spurious onZeroHubError), then it is closed with code 1000 and this.ws is cleared. The same helper is used by disconnect().", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L609-L654", - "version": "repo-lines-v1:sha256:0b72ed46159dd190e6e1ab72b71afdac4e462dafd62cdc4a6bed31f3cfb7a7a3:eyJzZWxlY3RlZExpbmVDb3VudCI6NDYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZkYTFlOGEwNDU3MWU2MTMwODY3MTRhZDdkMGRkNjZmYzMzNmZmMTI3M2UyMjkwNzQzMTllZTVjNWYzNTZlM2MiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImYxMTMyYmI1MGU0ZjVmYTA1MmU0Y2FhMGQzNDE5MDc2NTgyYTI1ZDkyYjViM2VmMjczZTM3ZTFlN2EwYzk2ZDkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImM4NWY2NjNlN2YwNjU5NGYyMzJhMDIzYTM5ODEzMmIxZmVmZjJmZmVkZjY2OTZmODM3MGNjZmFlY2YzMWZmYWUifQ" + "resource": "repo://client/src/zeroHub.ts#L1165-L1176", + "version": "repo-lines-v1:sha256:0f9b8246a41893c3af6043a7d7529ebfce115acbf7614b50da89621fe6b49b81:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQ4MzRkMTExYWIzMWRkYjU2YWQwNDMwYmQwODMzMDRlNGY2MjZmNTg3NDI3OWYzODAzZDc4NDExNTM4NWQxMmMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjcwODQ5NjBmNjk1MmM1NWUyZWNiMDU1NmE4ZjE1ZmU0NzFjNDQ3YmRjMDk2Zjc1ZDNjZDQ4ZmFiYzU0MWMyY2MiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImE5YzkxNzYyZDk2ZjRlMmUyMGM5NmNjZTI2MmE1NTIwOWYzMTUxNjc4NzJkNzlhMTMwNGJjNzVmNTZiNTcyZjYifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L721-L740", - "version": "repo-lines-v1:sha256:b469d9cd6cc3bd18caecd17bbbb318e6002a1d3d78134594b5b0ae953236b8b3:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFkMTExYmQzNTM1ZThmZThmMDg4YjcxZTQ3YjYwNmEyMWE4YmZlZDdiNmJi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MsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNjM1MGY1OGM2Zjk5Y2Q4NGVmMWM4NzY0ZTU3NGEyMzg3OWIwMGRhZjg3N2NjMGJiMDczYzM3OGMyYWY3MzAyNyJ9" } ] }, { "id": "claim_ea59de1b8139452d86d9932f2f146675", - "statement": "With autoAnswer: false, the offerMessage branch does not call sendAnswer; it moves the peer to AnswerPending and then invokes the public onOffer(peer, offerSdp) callback (guarded on the peer existing in the peers map) so the application completes the exchange via sendAnswer(peer.id, offerSdp). With autoAcceptAnswer: false, the answerMessage branch likewise moves the peer to AcceptPending and invokes the public onAnswer(peer, answerSdp) callback so the application completes the exchange via acceptAnswer(peer.id, answerSdp).", + "statement": "With autoAnswer: false, the offerMessage branch does not call sendAnswer; it moves the peer to AnswerPending and invokes the public onOffer(peer, offerSdp) callback (guarded on the peer existing in the peers map) so the application completes the exchange via sendAnswer(peer.id, offerSdp). With autoAcceptAnswer: false, the answerMessage branch moves the peer to AcceptPending and invokes the public onAnswer(peer, answerSdp) callback so the application completes the exchange via acceptAnswer(peer.id, answerSdp). Both callbacks are isolated from throwing handlers.", "evidence": [ { - "resource": "repo://client/README.md", - "version": "repo-file-v1:sha256:ae29b6e2faaa989fd4ab7f27169fc49509ebb36078eed7943eca68181b9e3cc9" - }, - { - "resource": "repo://client/src/zeroHub.ts#L147-L176", - "version": "repo-lines-v1:sha256:6bf03225c62c20453eb2cb954d6fe33790ab50ef6d75a262ebad542c15c68f4b:eyJzZWxlY3RlZExpbmVDb3VudCI6MzAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjM1NDI5NmQzMmM5ODZhZTcyMDg1ZDYzNWM1MmIzNTk3YTVjNjYxOTY1ZTY1OWMyNjNmNGE0ODQ5NDQyOTIxMmMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImIzNDQ0OTEwOGY5MjQ2Mzc3NzU3YmM4M2JhYWNmYjI1YjMyZGVhNGIyZDFhMzk5ZWMwYzIyNjhlZTYyY2E1ZjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjBhNDQ5YmY3NzAyNjhkMDE1N2ExYzY0YWViZGFmYjFhZWI1N2NjZTgxY2EwNGNiYTljNTQ2NmM0MWJkYTgyMDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjdiMTYyNWY2OGFiOWFmZmQyNDVhMzNmMzQ1Y2NkZjY1MDQzYTYzYWY0ZjdjOGViZjVlMDVlYzI0ZmJiNjc1ZjUifQ" - }, - { - "resource": "repo://client/src/zeroHub.ts#L454-L499", - "version": "repo-lines-v1:sha256:12f3038bef05e68d78d5a9591c208f1a0bf61b00ecc69197ededd5242d90e24a:eyJzZWxlY3RlZExpbmVDb3VudCI6NDYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNlYjI4OTJlMDY2NDc5ZGFiODk2MDdjNWZhZWU4MmQ2YzczN2EzYzg2YzgzNDhlNzJkZjQ4NjJlZGExOWY5MmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmMmNjNzg1OGY1MjFkMzlmNDViNjg3MDQ4NDU4MGIzMjVhYzJjNDA5ZTIyNmQyMGFmYThmNzczMjM0OGUwZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImI1YzRjZDNkZWJlZjg5MDc2ZDNmOTU3OWFkNDIzNDcxMTAxYjM4ODY2N2UzMWViOTg2OWMzM2JkOTk4MjE1NzAifQ" + "resource": "repo://client/src/zeroHub.ts#L840-L901", + "version": "repo-lines-v1:sha256:7cdf88a6b09e213116646c15766262bd6acfddd2a0d6babbe7fc1841e4a5608c:eyJzZWxlY3RlZExpbmVDb3VudCI6NjIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNlYjI4OTJlMDY2NDc5ZGFiODk2MDdjNWZhZWU4MmQ2YzczN2EzYzg2YzgzNDhlNzJkZjQ4NjJlZGExOWY5MmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmMmNjNzg1OGY1MjFkMzlmNDViNjg3MDQ4NDU4MGIzMjVhYzJjNDA5ZTIyNmQyMGFmYThmNzczMjM0OGUwZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFkNTlkYzgyNzhlMjU2NDgyZTVmNTIzNGViYzc2MGNhMmQ4OGUzNzI2ODg5Y2YxMDNlNmU2MjcyODBlNjRlZWMifQ" } ] }, { "id": "claim_229a309d921a4176b3233d02a2dac5c5", - "statement": "ZeroHubClient exposes two new public callbacks for manual SDP handling: onOffer(peer, offerSdp) is invoked when an offerMessage arrives while autoAnswer is false (the peer has just transitioned to AnswerPending) instead of being silently dropped, so the application completes the exchange by calling sendAnswer(peer.id, offerSdp); onAnswer(peer, answerSdp) is invoked when an answerMessage arrives while autoAcceptAnswer is false (the peer has just transitioned to AcceptPending), so the application completes the exchange by calling acceptAnswer(peer.id, answerSdp). Both callbacks are guarded on the peer still existing in this.peers, so a dangling offer/answer for a peer already torn down is not surfaced.", + "statement": "ZeroHubClient exposes two public callbacks for manual SDP handling: onOffer(peer, offerSdp) is invoked when an offerMessage arrives while autoAnswer is false (peer already in AnswerPending); onAnswer(peer, answerSdp) is invoked when an answerMessage arrives while autoAcceptAnswer is false (peer already in AcceptPending). Both callbacks are guarded on the peer still existing in this.peers, so a dangling offer/answer for a peer already torn down is not surfaced.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L148-L176", - "version": "repo-lines-v1:sha256:82232e5ec39333afcdfd0319b8d74fba25ca7b3a9a1af2b10b918426886576d9:eyJzZWxlY3RlZExpbmVDb3VudCI6MjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVlNzExMjdmN2Y1ZjE3MTdiOTZlN2U5NzY5MGE3ZDE4MWE1MDcyMzdmY2FkMTg4NDBiYmIwOTM0MDIyYTkyMGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImIzNDQ0OTEwOGY5MjQ2Mzc3NzU3YmM4M2JhYWNmYjI1YjMyZGVhNGIyZDFhMzk5ZWMwYzIyNjhlZTYyY2E1ZjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA3N2NjNWQyYTVkNDIwZTExZjNiN2Q2MThlOGI5NjkxNzE2MmZhN2JjNWE3ZTk4NmZjZmZhZDY2MjYzZDQ5NjYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjdiMTYyNWY2OGFiOWFmZmQyNDVhMzNmMzQ1Y2NkZjY1MDQzYTYzYWY0ZjdjOGViZjVlMDVlYzI0ZmJiNjc1ZjUifQ" + "resource": "repo://client/src/zeroHub.ts#L250-L264", + "version": "repo-lines-v1:sha256:dcdeb950e92cdb991ae5eb0fd3970da02acf1ca13e0c0783b2b4393a28ed51a6:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZkZmYzMTljNDkxOTM3M2MzZjE0MzJkZDRkNWRkNjNjYjQ3NjY5ZmVjNmI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ozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImI1YzRjZDNkZWJlZjg5MDc2ZDNmOTU3OWFkNDIzNDcxMTAxYjM4ODY2N2UzMWViOTg2OWMzM2JkOTk4MjE1NzAifQ" + "resource": "repo://client/src/zeroHub.ts#L840-L901", + "version": "repo-lines-v1:sha256:7cdf88a6b09e213116646c15766262bd6acfddd2a0d6babbe7fc1841e4a5608c:eyJzZWxlY3RlZExpbmVDb3VudCI6NjIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNlYjI4OTJlMDY2NDc5ZGFiODk2MDdjNWZhZWU4MmQ2YzczN2EzYzg2YzgzNDhlNzJkZjQ4NjJlZGExOWY5MmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmMmNjNzg1OGY1MjFkMzlmNDViNjg3MDQ4NDU4MGIzMjVhYzJjNDA5ZTIyNmQyMGFmYThmNzczMjM0OGUwZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFkNTlkYzgyNzhlMjU2NDgyZTVmNTIzNGViYzc2MGNhMmQ4OGUzNzI2ODg5Y2YxMDNlNmU2MjcyODBlNjRlZWMifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T20:39:20.288Z" } } diff --git a/openwiki/.claims/subsystems/server-signaling.json b/openwiki/.claims/subsystems/server-signaling.json index d91bacb..6a7c8f5 100644 --- a/openwiki/.claims/subsystems/server-signaling.json +++ b/openwiki/.claims/subsystems/server-signaling.json @@ -1,28 +1,28 @@ { "schemaVersion": 1, - "pageVersion": "sha256:26c75352cfd51f969b3a5ef4af09647a05a9e3ce67ac235b91ce826abd9a8730", + "pageVersion": "sha256:92119551acc3819c6e673b533556495f29715d58fee10e1b107289946907a254", "claims": [ { "id": "claim_1d82fd64055a4062925029c4ae4e6575", - "statement": "The server entrypoint loads config, initializes the logger, then constructs four independent ZeroHub instances (static, random, IP, permanent) via a shared newZeroHubOrPanic constructor that panics on construction failure, and passes them to the handler, so each hub type has an isolated hub registry.", + "statement": "The server entrypoint loads config, initializes the logger, then constructs three separate ZeroHub instances (zeroHubStatic, zeroHubRandom, zeroHubIP) via a shared newZeroHubOrPanic constructor that panics on any construction failure, and passes them to the handler, so each hub mode has an isolated hub registry.", "evidence": [ { - "resource": "repo://server/cmd/server.go#L26-L30", - "version": "repo-lines-v1:sha256:7309af0b4408d0c5b67a36cc99f9b613ede7ab7775472a46fa5b07186bde0719:eyJzZWxlY3RlZExpbmVDb3VudCI6NSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMDFiYTQ3MTljODBiNmZlOTExYjA5MWE3YzA1MTI0YjY0ZWVlY2U5NjRlMDljMDU4ZWY4Zjk4MDVkYWNhNTQ2YiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiODQzYjQzOGRjMjEyZjdkZTE2NWFhOGZmZTZiODZiNWRiZDU3MzY4NjIxYTA5YjE1NjExNzRmY2MzNjk0NzhhMSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiYzE4NzEzZjU2MWI4NTYxOTEzMzBjNjg2OTc2ODY3YzUzMDZlOGI3NDMyNmM3YTI3ODkxMTUwNDhmODlhMDJmNiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWRkMjUwMTg5MTBjYjIzNTIwMWI3NGFiNGU0MTZlMjMzMmRkMDVkMDJhMTEzM2Q1NGE3OWIwYWQ0NzE3ODNlZCJ9" + "resource": "repo://server/cmd/server.go#L25-L32", + "version": "repo-lines-v1:sha256:1faa4b059ab3cc3784089ad4037ba815ebc22cd401c0d984b6238dbc16ccf38b:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNWIwMjJjNDcxZDZiZTQ4OTdiMWQ5NjI3N2RmNTQwYTRkMDIyZWE2MDI5MThjZTFhZmFhNWVjZTU4ZDJkMjU0MyIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiODYxMjkzNWQyZDllMzI0ZDBlZjU4NjUwYjFhMDk3ZDI2MTA3MjJlZmFkNjA5ZTk1NTJlODU0NzhkOGQ0NDM4YiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWRlYTBlNGFiZDRjOWQ3YWQyMGJkMGYyOTk0MTU2NzhmNjMxNmY3ODU3NGViMGExZDRjMDQyNDYwNmFlYjZkNSJ9" }, { - "resource": "repo://server/cmd/server.go#L42-L50", - "version": "repo-lines-v1:sha256:de30767efb3115fe6498da80ed9a06712ef6a3e029bb7f939055017c649009fc:eyJzZWxlY3RlZExpbmVDb3VudCI6OSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYmZmNWRiMTQwMjQxYWVhY2Y5MGNiMmU4ZTM2NzhhZTQ1MTIwYWZmNmZiODM5NWUwYzNkMmVmY2MwNTdjNjE3ZCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNDEyY2EzNDVjY2Y3NWJmOWMwODA2YmNlNjk1YmU4ZGU4MDhiNzk5ODQyNTFhN2E1NGQyMDJjZjYxMDFkZDQ1MSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiZjI5NjQwNzljM2M1YzgxNTIwZWYzM2EyYjlkMmUxNWExYjg0ZDcyODBkYjg1OTBkY2Q2NTc0N2UzZTAxMmE0MCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjAsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9" + "resource": "repo://server/cmd/server.go#L41-L47", + "version": "repo-lines-v1:sha256:ce846692ec81b69018df9f46f75a09a401bb4343180001a23d1fba58ea5e5d8b:eyJzZWxlY3RlZExpbmVDb3VudCI6NywiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZjkxYjg0ZWU2OTQ4NjVmM2U2N2IxZjIxMjNhZWI2NjQwZGE5ZDg1ZTNlYzZlYjFhMDY1NzRjZDZkZjdmMjg5MSIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNDEyY2EzNDVjY2Y3NWJmOWMwODA2YmNlNjk1YmU4ZGU4MDhiNzk5ODQyNTFhN2E1NGQyMDJjZjYxMDFkZDQ1MSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNjQxOWM2NjE3ZWUxODBkZTVmZjA0M2YzNzM4ZjM1NTk5NWI5MzYyYzY0MjMyNmVmNjNhOTg0NjdmM2NkYmE5ZiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjAsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9" } ] }, { "id": "claim_11d056afeae2482eb5555e3341dce77f", - "statement": "Server configuration is loaded from .env via godotenv and unmarshaled with go-env; key vars are APP_HOST (default 0.0.0.0), APP_PORT (default 8080), APP_CLIENT_SECRET (required), APP_HUB_STORAGE/APP_PEER_STORAGE (default memory), and APP_TRUST_PROXY (default false).", + "statement": "Server configuration is loaded from .env (or ENV_FILE) via godotenv and unmarshaled with go-env; key vars are APP_HOST (default 0.0.0.0), APP_PORT (default 8080), APP_CLIENT_SECRET (required), APP_HUB_STORAGE/APP_PEER_STORAGE (default memory), APP_TRUST_PROXY (default false), and APP_ALLOWED_ORIGINS (optional comma-separated WebSocket origin allow-list).", "evidence": [ { - "resource": "repo://server/pkg/config/config.go#L28-L40", - "version": "repo-lines-v1:sha256:db0b35d3b8b6e8ea8de056a900a7ad1369655fbb55ac3e3d0d66f213f4e689df:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjlmYWJkYTI2NGU5MDhhNDg0NmRmZDlhNDliNGE5ZDA5ZDgzYzY0ODI1ZmZhODY3YzllOTE5MTY5Zjk3NGY0NzgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZkYTg1ODBiYzc5NjY2NWQxOWU2MjFjOTVkOWZhMDA3YzcwNmZlNTc0ZDM1NGFiMDg0ZWQzZjg0OGJmMDYzNDAiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjgxMjhlMTE0YTBiZjg5YjE4ZmUyODM2Zjc5MzI0ODJmMDJjODc1MTQ5MGVkZDczMmI3ODAzNzdiYzk4NmQ5NjUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjEwNjhjOTE3Y2UxMDdlZjIzMzNlNmI4YmJkODAwZTA2ZTFhNjE4YzZjYTZkY2I1OGRlYWZiODA4ZTMyMGY0YjEifQ==" + "resource": "repo://server/pkg/config/config.go#L28-L44", + "version": "repo-lines-v1:sha256:09f2cf41c15a1f9461c2cc5f537775dac02a7a6ff5fdeb27ddc46de1f327b0d3:eyJzZWxlY3RlZExpbmVDb3VudCI6MTcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjdhMDVkMmZmZDU0MGQ4OTc2MDQ5OTk5YWNkMjRiNGI4MmVjM2FlOGNkYTdjOGQwZjRiYTg5MDQyY2M1ZGZjYjYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijk0ODYzMzJjN2RjYjdiYjBiNjI3NThmNzJhMWYzNWYzMjdkZDJlZGM4ZGQ1ZTRmNjhlMTVhZGMwNmM2ZTI2NWEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNhYTcyMTk3NTA0OGM4YzVjOTg4OWNjMWEyM2I5ZmZhYjkxZmMyODczMDFiMTYxMjcxOGU0OThiNWM4NTNlZWIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjEwNjhjOTE3Y2UxMDdlZjIzMzNlNmI4YmJkODAwZTA2ZTFhNjE4YzZjYTZkY2I1OGRlYWZiODA4ZTMyMGY0YjEifQ" } ] }, @@ -31,8 +31,8 @@ "statement": "handler.NewHandler refuses to start when APP_CLIENT_SECRET is empty, because the admin endpoint would otherwise be open to unauthenticated requests.", "evidence": [ { - "resource": "repo://server/pkg/handler/handler.go#L137-L149", - "version": "repo-lines-v1:sha256:37094b92ee24317319136016132242c0c360b6a015892cc3d5bc5ebdfd966dfc:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE5MmQ4Z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MDBjZjhkZmY2MjA4NTA0MDZiODUwMDk5ZWNjODNkMSJ9" } ] }, @@ -41,46 +41,54 @@ "statement": "ZeroHub.GetOrCreateHub performs the read-then-write under a sync.Mutex so concurrent join-or-create calls for the same hub ID collapse to a single hub instead of orphaning one.", "evidence": [ { - "resource": "repo://server/pkg/zerohub/zerohub.go#L109-L124", - "version": "repo-lines-v1:sha256:ebd3f7b0a5c85305f8544fa8b90283564ddcb08152dfc3a29174153c880a1791:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijk3MmU2OThiOTE4MmUzMThmNGZiOTY2YjM0MjgzZDExNzVmOWY5Y2FhYjY2MzAxZGI2MDNiNGMzZjQ4ZmE4NzUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZhOWVlZmI2NmJhMzJmOTU3NGE5YjZlYmU0NWY2ZDAxMTM4Y2VlYjM4MGJlMTdhMDZmZGFlNTZjZWQyNWQyNjkiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjU2N2Y5NTkxMjliYzI2OTE2NmM1Y2QzYjBjOTAwMmY3Yjc3NTlmNmNhOWJjODRjOWFlMzFjZGY2MTliMmVlZjYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjI0ZDBiY2JlNDVhYjliNmU5ODUyNjAzOWI1N2NjZjhlODI0MzUxMWE3NDQ2NGJlY2ZlMDM4NGM0ZjFmOGE2MzgifQ" + "resource": "repo://server/pkg/zerohub/zerohub.go#L111-L134", + "version": "repo-lines-v1:sha256:912341ca5667f22cc348d8905385557ec9674904ac744775a9d1baad5cafb569:eyJzZWxlY3RlZExpbmVDb3VudCI6MjQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijk3MmU2OThiOTE4MmUzMThmNGZiOTY2YjM0MjgzZDExNzVmOWY5Y2FhYjY2MzAxZGI2MDNiNGMzZjQ4ZmE4NzUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjU2N2Y5NTkxMjliYzI2OTE2NmM1Y2QzYjBjOTAwMmY3Yjc3NTlmNmNhOWJjODRjOWFlMzFjZGY2MTliMmVlZjYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImJjZjM0NWZmZjk4YmYwMzRiYWE5MDk0YzgyNjEyOTBkNTU4ZjhmYWUwZGUwOTYwMTlhNWYxMzA0ZjBmMGMzZGMifQ" } ] }, { "id": "claim_973b6aefbd374b2793b3dbf5ba1a17ff", - "statement": "hub.AddPeer assigns a peer a monotonic numeric ID from an atomic counter, marshals the join signal before registering the peer in PeerStorage (so a marshal failure is a no-op and never leaves a half-registered peer), then stores it in PeerStorage, broadcasts a PeerJoinedMessage to the other peers, and sends the new peer a HubInfoMessage.", + "statement": "hub.AddPeer assigns a peer a monotonic numeric ID from an atomic counter, marshals the join signal before registering the peer in PeerStorage (so a marshal failure is a no-op and never leaves a half-registered peer), then stores it in PeerStorage, broadcasts a PeerJoinedMessage to the other peers, and sends the new peer a HubInfoMessage whose roster excludes the new peer itself.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L70-L107", - "version": "repo-lines-v1:sha256:d33adcb3c4e73afa73f1bb759ba76426f5d59d436c2ebdf0790d85e6ab4c7743:eyJzZWxlY3RlZExpbmVDb3VudCI6MzgsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijc3MjdiMzdhYmJhNjRhOTZlMTJkNmUxODIyNGNkMjJlM2M2ZGI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vdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImRhZmJlZTkxNzJmODJjMjg3MDI3Y2U3ZTcyMTc4YmNhOTU5ZjA4YWUwNDIwNTMyNDRkYjU5YmE1Y2Q0MDY1ODMifQ" } ] }, { "id": "claim_87b7649845d342a2a742287bdf02fff4", - "statement": "Hub teardown runs in two places in handler.Upgrade: the socket close handler (peer.Close() + RemovePeerById, with RemoveHubById when the hub empties) and a fallback right after hub.HandleMessage returns. Both call the idempotent hub.RemovePeerById, which returns false without broadcasting anything when the peer is already gone, so a duplicate removal cannot double-send the PeerDisconnectedMessage or double-trigger RemoveHubById.", + "statement": "Hub teardown runs in two places in handler.Upgrade: the socket close handler (peer.Close() plus hub.RemovePeerIfLast) and a fallback right after hub.HandleMessage returns. Both call the idempotent hub.RemovePeerIfLast, which is a no-op for a missing peer, so a duplicate removal cannot double-send the disconnect signal or double-delete the hub.", "evidence": [ { - "resource": "repo://server/pkg/handler/websocket.go#L40-L65", - "version": "repo-lines-v1:sha256:0de8a393816f422eee7dd91accc6f1cd60a4ac1037df9c5b6a40f30099938565:eyJzZWxlY3RlZExpbmVDb3VudCI6MjYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVmMjliYmE4NDFkMWYzOTUyYTVlNTA1YzE5OWVlYjE5MGZiNDQyZTI5MmVhZDdmOGVkMDZjMDg3ODJmNmJiYTMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY0ZWZjNDk0MThkMjZkY2YxMjliMjJhNmFhMjExMDhjZWVjMzc2NzdhMzJkMDhlOWQ1ZmVlMzVkZGE2NmJiOWQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA0MzczMzc5OTgyNWFiNGMwNjdkMTc0M2E4YjQxNmMwZDA3MDY0NTA5YzFkNzJjNzNkM2U5ZTUxYTIwOTNjZDEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQ5NTE3YWUwZGE3N2NhZDcyNjg3NjFjZGQ3M2U4NzM0OGZhNTBhMTI5ZDIyOGJlMGNiYmVkOWZlYWNkYTJmZGEifQ" + "resource": "repo://server/pkg/handler/websocket.go#L145-L160", + "version": "repo-lines-v1:sha256:bdbc23b39d2dad260502ac1c9def1277529a38a6bcde3e0a3672d933e230ff8c:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI1MDQyMWQ2MjE5YjE3MTVhOGM4ZGMyZDkyZDRhMTZhYmMyNjVjYzQ5ZGYyZWM0YWI4YzI2YjU4MmVkODMyYmQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmMmExYWNjYjFkYjZkYTAzOTdmNjBhMDRiMjdlMjNjNjA4YmY1MGZhYmJhODdhZmUyN2FlYWE5ZjRjNGMxNDgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjM4ZjM3MDJiMDZkZTIxZmUzNGU2ODBlYzljZmFhM2JmZWJiY2JiZjE2NWNmOTA5NTlhMDUyZmZmMzkyOTFmNmUifQ" }, { - "resource": "repo://server/pkg/hub/hub.go#L106-L109", - "version": "repo-lines-v1:sha256:15265520480f53f84eaf4f5e487468864693bfef626ad8137a4e6bbdd81e7888:eyJzZWxlY3RlZExpbmVDb3VudCI6NCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYzcxNGFjY2Q1MDllNGJkNmMwYjk1Nzg4NTc4MDE4ZTg0ZWM0OTI4ZmIzO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xsb3dpbmdDb250ZXh0SGFzaCI6IjdlMTlhMGZmZDE2NmVkYzMzZmVlYmUxODg3ZDg5ZGJjZDZmNDM4ZWMzMzdkNzY2NjE2NGM3ZjgwNDRlOGVjOTYifQ" + }, + { + "resource": "repo://server/pkg/hub/hub.go#L181-L205", + "version": "repo-lines-v1:sha256:39aa727602e995f2f317ffda6c8ed770a8cc4af731e0dc2a57bc028f029cbd0b:eyJzZWxlY3RlZExpbmVDb3VudCI6MjUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImY3NThmMGQ2MTA1OGM4MjczZjFjZjI4YzY2MjMzZWVmMmZjYmUxYWI0YTQ4YzQ2NWRmYWU3MmMxMzdiNjFmOWUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImMxNjFmYWM1M2I1NjQ3NDJhMTliMGI2MjcwNDU1YTVlNmQxN2JhYWY3OWFjMzQwMmQxM2U0NjVlZGIwNTRiMDEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjEyYzAwYWQ4OTM0YmQzNTJhNDcyZDE1ZDRhMDY2OWU5YWQyMTY2N2ZhNGQ2ZDE3YjU1Y2U3MDdiYTM1MjlmOTIifQ" } ] }, { "id": "claim_4df69d732b3049588880a9ea4bfaf548", - "statement": "The server applies a 60 requests/minute ulule/limiter v3 fasthttp middleware keyed by the socket peer address by default, or by the outermost X-Forwarded-For IP only when APP_TRUST_PROXY is set (which must only be enabled behind a proxy that strips or replaces that header). The same clientIP() helper also derives the hub ID for IP-keyed hubs, so behind a trusted proxy the IP-hub ID tracks the real client IP rather than the proxy socket address.", + "statement": "The server wraps every request in an in-package token-bucket rate limiter (handler/ratelimit.go, no external dependency) at 60 requests/minute, keyed by the full socket peer address (IP:port) by default or the outermost X-Forwarded-For IP only when APP_TRUST_PROXY is set (which must only be enabled behind a proxy that strips or replaces that header). The limiter key is intentionally different from clientIP(): clientIP() (port dropped) is what JoinOrCreateHubIP hashes into the IP-hub ID, so all connections from one client IP share a hub while the limiter keys per-connection.", "evidence": [ { - "resource": "repo://server/pkg/handler/handler.go#L154-L238", - "version": "repo-lines-v1:sha256:8fead4c964ce4653409e639c22f885f5b930a57354f5510757b01ec95daafad3:eyJzZWxlY3RlZExpbmVDb3VudCI6ODUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgzYzJjNGJlODZhZWY0YzlhNDFkYWVlYTc2MjNjZTNiNzFjNDQ1OWUwYjE4NzA1NmM1MGYwMGFiMDNmN2Y3ZjgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNlNGU0MmY3MDQwMTdiZmYxMWViODYxODQ1ZDMyYTA0MjRhNjc4OGJhMWU3NDQyOGFiMTI2MDJjOGEzZmEyZjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjBhNTFmODNlM2VkOTU2MDYzMjFlNDI3NWYxYzBjM2MyMmE0ZTliNTg4NGJhYWJlYzZjNjRmYWUzMTQwZmNhY2UifQ==" + "resource": "repo://server/pkg/handler/handler.go#L189-L241", + "version": "repo-lines-v1:sha256:145e3a1827df611976450bc8c970aaec380f1d3c79ae03dd11125521a40b5b08:eyJzZWxlY3RlZExpbmVDb3VudCI6NTMsImZpcnN0U2VsZWN0ZWRMaW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YjhkMzE5NTI4YjJmZmQ1OWFiNmVhOTQ4Zjc0OWRjNjhlODkzM2UwMyIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjAsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiZTNiMGM0NDI5OGZjMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9" }, { - "resource": "repo://server/pkg/handler/join_or_create_hub_ip.go#L16-L22", - "version": "repo-lines-v1:sha256:931f7a4a8f3b00bc368d95200ea9249bd69fc104890935a4f567e5c4f950d4d5:eyJzZWxlY3RlZExpbmVDb3VudCI6NywiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMjI3OTNiYmU3MDFjN2Y4YWI0MTFlMDI0ZjAyYjVmNjgwZmYwNTY2Y2Y4ZWMyYmUzNjY5Zjk5ODEwYjliYjM2ZiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNDEyY2EzNDVjY2Y3NWJmOWMwODA2YmNlNjk1YmU4ZGU4MDhiNzk5ODQyNTFhN2E1NGQyMDJjZjYxMDFkZDQ1MSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNDhhMGFmYzNhODlmOWM1OThiYTJmOGZhMWFhYjcxNjE5OWMyYjcxODBiZmViMDRkZTczOTlhZWMyNjlkZjM3OCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjEsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiMDFiYTQ3MTljODBiNmZlOTExYjA5MWE3YzA1MTI0YjY0ZWVlY2U5NjRlMDljMDU4ZWY4Zjk4MDVkYWNhNTQ2YiJ9" + "resource": "repo://server/pkg/handler/ratelimit.go#L10-L137", + "version": "repo-lines-v1:sha256:8cb149bb880130318e9899609673d9a6ba1f204b8013d86ffddb4cfd4b768968:eyJzZWxlY3RlZExpbmVDb3VudCI6MTI4LCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiJkMGQ5ODZiMGRmN2U5YzQ3YWE3ODJiMDY2MDk0NjliYzhlZWNhNDc2MTJiODM4Y2Y4MjlkZGE0YmNkZGQzMzI5IiwibGFzdFNlbGVjdGVkTGluZUhhc2giOiI0MTJjYTM0NWNjZjc1YmY5YzA4MDZiY2U2OTViZThkZTgwOGI3OTk4NDI1MWE3YTU0ZDIwMmNmNjEwMWRkNDUxIiwicHJlY2VkaW5nQ29udGV4dExpbmVDb3VudCI6MywicHJlY2VkaW5nQ29udGV4dEhhc2giOiIzZjVjODEyNjk5MmJkYmYzNTI0MjhjNzgxODdkZmY0MjNhZTAwMTQ3NDEyYWIzNzRiZWI2MWE5NDVkNThlZGQyIiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MCwiZm9sbG93aW5nQ29udGV4dEhhc2giOiJlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1In0" } ] }, @@ -89,12 +97,16 @@ "statement": "Zero-downtime migration: an authenticated /v1/admin/migrate?host= call first validates the host with validateBackupHost (a bare host or host:port, rejecting any scheme, //, path, query, fragment, userinfo, or out-of-range port with a 400 without touching state), then sets backupHost under a read-write mutex and atomically flips isMigrating; while migrating, create/join-or-create requests are rejected via ForwardMigrate, which upgrades the connection and sends a going-away close (code 1001) whose reason is the backup host so clients reconnect to the new host.", "evidence": [ { - "resource": "repo://server/pkg/handler/migrate.go#L100-L141", - "version": "repo-lines-v1:sha256:eb63f6d954b9a95955b60eb95d5f6d99d63316c10939f1706e2556804280241d:eyJzZWxlY3RlZExpbmVDb3VudCI6NDIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZhNzA1ODIxYzNhYjhjZjgyNTBhMmIxZDlhZmY4MzYxMGMxYWFjYmViZmIwNmZiNzM4YzgwZDFiMDMyNTdkYTAiLCJsYXN0U2VsZWN0Z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zFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + }, + { + "resource": "repo://server/pkg/handler/migrate.go#L27-L58", + "version": "repo-lines-v1:sha256:25c4fe50355c2b330abb396e45bbb7fe563dcf54345deb8431d94c2beddf775a:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ4YmFmMmYwYzMzNjMxYTg3MThiZmQ5OTdhOGRkZmJjOTgyYzM2ZTQxOThmOTgwMWIwZTkzZTQyZTZjMWJiMjEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjI5MmQ2ZjFlMTUyNmMyNmY0NTRmMWE4YWVkM2FlYjU4ODZhMGU4YTJkZjYxYjZjZTRmNDdkNzg5M2MyZmI1OGUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImI2NWQ2Yzc1NDdmOGJjZDg1NDEwMDZhZDYzMGI4YmE0NGMzNmZiNDAwNmJhOTMyMTM1ZWYxNDNiYzhjMGMwMTAifQ" }, { - "resource": "repo://server/pkg/handler/migrate.go#L26-L57", - "version": "repo-lines-v1:sha256:25c4fe50355c2b330abb396e45bbb7fe563dcf54345deb8431d94c2beddf775a:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ4YmFmMmYwYzMzNjMxYTg3MThiZmQ5OTdhOGRkZmJjOTgyYzM2ZTQxOThmOTgwMWIwZTkzZTQyZTZjMWJiMjEiLCJsYXN0U2VsZWN0Z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3YzY4MjkxOTZkYzkzZjMzMTcxYjlhYTM2Y2IzYTBiNmYzZjUwMWRmMTFmZDAwNjdiZTYxMDAzNTYifQ" } ] }, @@ -104,21 +116,21 @@ "evidence": [ { "resource": "repo://server/pkg/storage/gache.go#L17-L28", - "version": "repo-lines-v1:sha256:9c965382e8ae0c8887680fa7f8dc948ac5e90dc9c824665b71feb760af6f5285:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNkYTI1NTZiZjY1YjllMGRkZjAyOGZmYzIzZDI2MGI3MTI0MGEyOTM0ZDg0Y2JiN2E0MmFiODE4Yjg0OTc1ZjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjUwMDc2ZmQ5Mjk4Yzg4MTM0M2U2NzhhNGQ0ZmM5NDY3YzA5NTQzNTc3OTZmNGJmOTFhZThmNmMyOTVhY2ZmZDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImM0ZmRjMWM5NTY3YzRkYjI5YzgwODEyYTQwMDBjNTk2MmEyYTU3NWE2NGZiZmRhMDllOGJiNThjNzY5MjAxZDQifQ==" + "version": "repo-lines-v1:sha256:8d0d9a5a7efe85785e3a97c12ed73a123d0fc9975d8d3f3d681b2c12433f8cd9:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNkYTI1NTZiZjY1YjllMGRkZjAyOGZmYzIzZDI2MGI3MTI0MGEyOTM0ZDg0Y2JiN2E0MmFiODE4Yjg0OTc1ZjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjUwMDc2ZmQ5Mjk4Yzg4MTM0M2U2NzhhNGQ0ZmM5NDY3YzA5NTQzNTc3OTZmNGJmOTFhZThmNmMyOTVhY2ZmZDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImM0ZmRjMWM5NTY3YzRkYjI5YzgwODEyYTQwMDBjNTk2MmEyYTU3NWE2NGZiZmRhMDllOGJiNThjNzY5MjAxZDQifQ" } ] }, { "id": "claim_5cbe6bd3cd134d1d833ce0a9aa9c3e10", - "statement": "hub.RemovePeerById checks PeerStorage.Get(id) first and returns false without broadcasting for a missing peer; for a present peer it deletes the entry, broadcasts the disconnect signal to all other peers, and returns true when the hub is empty unless IsPermanent. TestRemovePeerByIdIdempotent and TestRemovePeerByIdLastPeerTwice pin this duplicate-teardown behavior.", + "statement": "hub.RemovePeerIfLast (via its internal removePeer helper) checks PeerStorage.Get(id) first and returns without broadcasting for a missing peer; for a present peer it deletes the entry, broadcasts the disconnect signal to all other peers, and, when that peer was the last member and the hub is not permanent, deletes the hub from HubStorage. TestRemovePeerIfLastIdempotent and TestRemovePeerIfLastLastPeerTwice pin this duplicate-teardown behavior.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L106-L135", - "version": "repo-lines-v1:sha256:cca966e1fff7f1bb8916646f19e93f86630eff51469ab8b1e7444b356f96a320:eyJzZWxlY3RlZExpbmVDb3VudCI6MzAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImM3MTRhY2NkNTA5ZTRiZDZjMGI5NTc4ODU3ODAxOGU4NGVjNDkyOGZiMzlkM2ZiN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W50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ5OTJjOWM1ZmVkMjkzYTEwNmQyM2E2NmEwMTc1OTI4MzRiMDY0MWNkYTQ2NjY1MWZjMDRmZjI3OGY0NDg4NjcifQ" }, { - "resource": "repo://server/pkg/hub/hub_test.go#L148-L184", - "version": "repo-lines-v1:sha256:6548ba734396107b963f998081f9e92761f1ebc4bbb13e8c4094d32acdfb97c8:eyJzZWxlY3RlZExpbmVDb3VudCI6MzcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjMwZTU2ZjVhZGZlOTg0MTQxOGNkNWIxNzgwNWEzNWYyNjkyYjc2ZmM3YmUwMzNlY2M5YTM1MTUzN2U2ZGZlMmQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjkzYzhjODdlNTc4NGY3YmM2ZDRhNTJkNTQ5YTdkZjQ3MGY5MmExNGNiYTdkNzkxNWI5ZWFjZWM5M2Y2NjUxNzEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVmYmI2YWJiYTkyYTY0OGZjMDRkZWZlYzMyMzc3NDI0NWRlODI0MTc1ODExMjVhZDllYzVkMzA5MDk2NDU5OWMifQ==" + "resource": "repo://server/pkg/hub/hub_test.go#L392-L460", + "version": "repo-lines-v1:sha256:ecd60c313fa054423fcf707dd16ff5169de84610284252bf026b3e4d621f7728:eyJzZWxlY3RlZExpbmVDb3VudCI6NjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjdlMTFlZTM4YzQ0YTEyM2E1YzgxNTFhYzYwNjIwN2FmOTk4ODgwZmNhOWU4NWRmYzc3MmZjNzFiYzg4MTkwMzEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImYyOTY0MDc5YzNjNWM4MTUyMGVmMzNhMmI5ZDJlMTVhMWI4NGQ3MjgwZGI4NTkwZGNkNjU3NDdlM2UwMTJhNDAiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjY4MWNjZmNmMWQ0NTM4NzJhOTEzNzVmOTliYTRjZmZkNzAzYjE5MDM1NWJlNTZhYzlkMTQyMDdkMDUzMDNiYWIifQ" } ] }, @@ -137,36 +149,36 @@ "statement": "/v1/status is a public read-only health and migration endpoint that answers with a static Access-Control-Allow-Origin: * plus Vary: Origin, a constant rather than a reflection of the request Origin header, because reflecting an arbitrary origin is the classic CORS anti-pattern and is unnecessary when the endpoint is open to all origins; the exposed status and backupHost data is considered public.", "evidence": [ { - "resource": "repo://server/pkg/handler/status.go#L19-L28", - "version": "repo-lines-v1:sha256:c1bf59e8e04029feb476c42df4e21b53f7b23d1b0e43924e09db0c1389b1ce20:eyJzZWxlY3RlZExpbmVDb3VudCI6MTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImRmYzU4M2JlMTFmZjBlMjNjYjc1NjBiYWFkYjdlMjI3MjZkZjg4ODFlNTM3NmY2MmQ2YmYwNTk2YzY4MTFiOGYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA1Yzc2ZmY4NjNmZjFhYzRmNGQ0Mzk5MWJlMDcyZWQ2NjlmZjUwYzA0N2JmNzVlMzlkOWNhYTZkMTZlOGZmZmUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoxLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIifQ==" + "resource": "repo://server/pkg/handler/status.go", + "version": "repo-file-v1:sha256:3a920e285f3f940c3878b771957ca6dcab670b6508c46843b49903c4b72f7b58" } ] }, { "id": "claim_8419e00d1be14a278561a44dd1eeae16", - "statement": "When the WebSocket upgrade does not fully succeed — a handshake error (non-nil error from Upgrade) or the up-front peerMetadata rejection that already wrote a 400 (responseWritten=true) — AddPeer never ran, so the hub holds no peer for this request and is empty; CreateHubByID and JoinOrCreateHubByID therefore call zh.RemoveHubById on that hub to prevent an unbounded empty-hub leak on memory storage. JoinOrCreateHubByID removes the hub only when this call created it, since a pre-existing hub may hold live peers, and when responseWritten is true the already-written 400 is returned as nil instead of being overwritten by a 500.", + "statement": "When the WebSocket upgrade does not fully succeed, a handshake error (non-nil error) or an up-front peerMetadata rejection that already wrote a 413 (oversized) or 400 (malformed JSON), reported as responseWritten=true, means AddPeer never ran, so the hub holds no peer for this request and is empty. CreateHubByID and JoinOrCreateHubByID therefore route the failure through the shared finishUpgradeFailure helper with a rollback that removes the hub via zh.RemoveHubById; JoinOrCreateHubByID rolls back only when this call created the hub (the created flag from GetOrCreateHub), since a pre-existing hub may hold live peers. When responseWritten is true the already-written 4xx is returned as nil instead of being overwritten by a 500.", "evidence": [ { - "resource": "repo://server/pkg/handler/create_hub_by_id.go#L61-L75", - "version": "repo-lines-v1:sha256:3aa3fcae530ce3355e47153679505a20a797e86eec1d697ca9f89b67c46b22fb:eyJ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ZTc2ZWZhZDBiYTg5ODIxOGM2ZWU0MzRmZjQ3Mjg3NzBhY2MyN2FkZjdkZWM3NGU5MzNmYTgwMGQzNmMzZWZjZSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNTJiMTkyMmNlMTEzNTI0YTM5YWRkYzljNjdkMGU3MGJlMWM0N2U3M2E4MTU5MDRiMDdjZGFlNzhjNTQ1ODliYSJ9" }, { - "resource": "repo://server/pkg/handler/join_hub.go#L30-L40", - "version": "repo-lines-v1:sha256:89438c8580412b4b8630e7fc427e0fc34e3c9d57bdd440dfbd486c2930b38c91:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI0YTM2MWFmOTdiZmIxYjUzOTJlMjE2YTViYTAyOGIwNWE5MTZlNmVjNzg2ODUzMzJlYjNmMTZlNGM1ZWZiOWMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOTY0OGFlNWQ0M2EyYmY4Y2Q2MzQ3ZjgyNjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjQ2ODFiYTU2YjY1M2Q1OWU1OTljZjlmZGVjOWFjNDMyNDhkYzA2MjFhMGVlYmJiNTVhZmNmOGY5NDA2ZTUxMzMiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjUyYjE5MjJjZTExMzUyNGEzOWFkZGM5YzY3ZDBlNzBiZTFjNDdlNzNhODE1OTA0YjA3Y2RhZTc4YzU0NTg5YmEifQ" + "resource": "repo://server/pkg/handler/join_or_create_hub_by_id.go#L44-L50", + "version": "repo-lines-v1:sha256:eb9fd5e20ce4be6231828680782d38a56e5c795b98e6e4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mdDb250ZXh0SGFzaCI6ImY2N2I5YTk4Y2U1ODIwMWVjYmY1YjUxMDc5NDdiZjBmZTQyMGQ0OTk0MWE0NTUyODU2ZjYxY2RiOTg3OGQ1OTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjUyYjE5MjJjZTExMzUyNGEzOWFkZGM5YzY3ZDBlNzBiZTFjNDdlNzNhODE1OTA0YjA3Y2RhZTc4YzU0NTg5YmEifQ" + "resource": "repo://server/pkg/handler/websocket.go#L251-L265", + "version": "repo-lines-v1:sha256:650e7504c18e0f2c35457e9a83c217ae07b01a254ca469f90def56c5f4e0972e:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE0MmI2YThkNGE4YjdjNTY3ZDI3NjZhYTU3OThlZmQ2OGVkZjJjN2E1OGNhMTY3YWI1YzNjMDMyNjQ3ZWIyYjAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjdjYzFlZTQxNzk3MTYwZWI3ZmRiMDllYzJkMTRkZjc0M2VmMWM0YmU2M2NlYzM4OGMzMGM0YzE5ODIzNjEwNWYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" }, { - "resource": "repo://server/pkg/handler/websocket.go#L25-L38", - "version": "repo-lines-v1:sha256:086c97af7e4827ded2e606ccd6f08dc04ecfc9b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dDb250ZXh0SGFzaCI6ImFiZGMwNGY2Mzc4NGNlYzM0ZWM3MTk2ODYyZGQwYTIwZGYxNjgyNzAxNGM4Mzg4NTUxYTA4OTUzMzk1OTI0MWQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjA5NGIxOGE0OWNlZmYyNTFmZWYzMzgyYTE3MWUyZDQ2MTcxM2E4NWE5NjFlMTZkN2FkZjY4NGI4MjQyMmMwM2MifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T20:39:20.288Z" } } diff --git a/openwiki/.last-update.json b/openwiki/.last-update.json index 9c03939..cb18909 100644 --- a/openwiki/.last-update.json +++ b/openwiki/.last-update.json @@ -1,7 +1,7 @@ { - "updatedAt": "2026-10-14T09:46:27.559Z", + "updatedAt": "2026-11-20T23:35:42.120Z", "command": "update", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", "model": "host-agent/hermes", "status": "complete", "language": "en" diff --git a/openwiki/.page-manifest.json b/openwiki/.page-manifest.json index 8de7f36..9f1c6e6 100644 --- a/openwiki/.page-manifest.json +++ b/openwiki/.page-manifest.json @@ -2,46 +2,46 @@ "schemaVersion": 1, "pages": { "/openwiki/architecture/overview.md": { - "pageVersion": "sha256:0806d508634e9230e866fd53d01d49e2b1cc389c54f606cd68e9a88650a38ca7", + "pageVersion": "sha256:f0d65c13022833a8f46f4197184f611dd88ce2b02a273c8f5f28e2f29a43aa1e", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "e1f99995-8849-4c57-9884-653eab501034", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/architecture/signaling-protocol.md": { - "pageVersion": "sha256:fcebf6ee6c88427db464195a4f7993cbff73e8fd1b71f794f5cfff68621cd711", + "pageVersion": "sha256:b18b4dde086c39631b1ed698de089b3688882038998eff5ccb4adeb99b75387f", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "e1f99995-8849-4c57-9884-653eab501034", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/operations/development-testing.md": { - "pageVersion": "sha256:51c83b77aea8ca74345876cf4d42f42bf74828ffb21cc22879929437b5054f27", + "pageVersion": "sha256:5f6ea535317ac0bb92a307263a84708ba7b6e5a8924782f579731e740348ed8d", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "e1f99995-8849-4c57-9884-653eab501034", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/quickstart.md": { - "pageVersion": "sha256:94bd773e020290bf3102e695603cbadb5482c9d2e9e8788017ac64e7c6a9a4b3", + "pageVersion": "sha256:6c7c9e03e68c17133c38b685237b8cd717ea4ef09c99c3b6b2fa13c1e23c3bde", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "e1f99995-8849-4c57-9884-653eab501034", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/subsystems/client-sdk.md": { - "pageVersion": "sha256:50521a05b8c690b969a2f6027245e965d4e08e0b8ca6c066819b62b892bc0ce8", + "pageVersion": "sha256:39557c8c0ef9c6c9e53ed943580a1cbcf09dc1ce71211da29d4cacb47a224de2", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "e1f99995-8849-4c57-9884-653eab501034", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/subsystems/server-signaling.md": { - "pageVersion": "sha256:26c75352cfd51f969b3a5ef4af09647a05a9e3ce67ac235b91ce826abd9a8730", + "pageVersion": "sha256:92119551acc3819c6e673b533556495f29715d58fee10e1b107289946907a254", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "e1f99995-8849-4c57-9884-653eab501034", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" } } } diff --git a/openwiki/architecture/overview.md b/openwiki/architecture/overview.md index 4694d62..b069052 100644 --- a/openwiki/architecture/overview.md +++ b/openwiki/architecture/overview.md @@ -5,8 +5,10 @@ description: End-to-end explanation of how ZeroHub's Go signaling server, TypeSc tags: [architecture, webrtc, signaling, server, client, protobuf] verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T20:39:20.288Z sources: + - id: openwiki-source-df0d81c76704b851d02513e1 + resource: repo://client/src/const.ts - id: openwiki-source-22df8f9ebcff0eeb4e4ed38f resource: repo://client/src/topology/meshTopology.ts - id: openwiki-source-3fc48cf443ddea6d020b0fe8 @@ -15,8 +17,10 @@ sources: resource: repo://client/src/zeroHub.ts - id: openwiki-source-926f5bdf2e4b77b0b06cf4e8 resource: repo://server/cmd/server.go - - id: openwiki-source-b539b60065144e2cf7f200e7 - resource: repo://server/pkg/handler/create_hub_by_id.go + - id: openwiki-source-9ef7bf558ea5a77d41c4fa0b + resource: repo://server/pkg/handler/claim_hub_for_create.go + - id: openwiki-source-91c8b5702e75b83f8531a612 + resource: repo://server/pkg/handler/create_static_hub.go - id: openwiki-source-b985a45eeefdba7d9abbac00 resource: repo://server/pkg/handler/validation.go - id: openwiki-source-3fcd30e2964f43d36d37064d @@ -27,7 +31,7 @@ sources: resource: repo://server/pkg/storage/storage.go - id: openwiki-source-0eb2a9b2acf717d5c99e9894 resource: repo://server/pkg/zerohub/zerohub.go -generated: { by: "hermes", at: "2026-10-14T01:29:11.350Z" } +generated: { by: "hermes", at: "2026-11-20T20:39:20.288Z" } --- # Architecture Overview @@ -45,8 +49,10 @@ components plus shared wire-format definitions: - **`proto/`** — Protobuf definitions for the client↔server wire format (`client_message.proto`, `server_message.proto`). These are the single source of truth, compiled into TypeScript for the client and Go for the server. -- **`test/`** — E2E tests (Playwright + Svelte) that drive the real client SDK - against two live server instances. +- **`test/`** — E2E tests: Playwright specs that drive a plain-TypeScript + harness (bundled with esbuild) against two live server instances, plus unit + specs that exercise client internals with a mocked `RTCPeerConnection` and + WebSocket. - **`docs/`** — an Astro-based documentation site. ## The three layers @@ -69,24 +75,28 @@ RTCPeerConnection ◀──── direct P2P (SDP carried only via signaling) ### 1. Entry: server bootstrap `server/cmd/server.go` is the entrypoint. It loads configuration -(`config.LoadConfig`), initializes the zerolog logger, then constructs **four -independent `ZeroHub` instances** — one per hub type (static, random, IP, -permanent) — and hands them to `handler.NewHandler`, which `Serve()`s the -fasthttp server on `APP_HOST:APP_PORT` (default `0.0.0.0:8080`). +(`config.LoadConfig`), initializes the zerolog logger, then constructs **three +independent `ZeroHub` instances** — one per hub mode (static, random, IP) — +and hands them to `handler.NewHandler`, which `Serve()`s the fasthttp server +on `APP_HOST:APP_PORT` (default `0.0.0.0:8080`). -The four instances matter because each hub "type" has different ID semantics -and expiry; see the Go Signaling Server page for the routing table. +The three instances matter because each hub mode has different ID semantics +and expiry: static hubs are the never-expiring named hubs (`isPermanent=true`, +created out-of-band by an admin over plain HTTP and joined over WebSocket), +random hubs get a server-generated uuid, and IP hubs key by the caller's IP. +See the Go Signaling Server page for the routing table. ### 2. Hub join / create over HTTP→WebSocket -A client calls one of the connection entrypoints -(`createHub`, `joinHub`, `joinOrCreateHub`, IP/random variants). Each opens a -WebSocket to a typed path (e.g. `/v1/hubs/create`, `/v1/hubs/join`) with `id`, -`peerMetadata`, `hubMetadata` as query parameters. The handler authenticates -where needed, validates the query params up front — a missing/empty `id` or -non-JSON metadata is rejected with `400` before the handshake — then resolves -or creates the hub on the right `ZeroHub` instance and upgrades the HTTP -connection to a WebSocket. Creates go through the atomic `CreateHubIfAbsent` +A client calls one of the connection entrypoints (`joinStaticHub`, +`createRandomHub`, `joinRandomHub`, `joinOrCreateIPHub`). Each opens a +WebSocket to a typed path (e.g. `/v1/static-hubs/join`, +`/v1/random-hubs/create`) with `id`, `peerMetadata`, `hubMetadata` as query +parameters. The handler authenticates where needed, validates the query params +up front — a missing/empty `id` or non-JSON metadata is rejected with `400` +before the handshake — then resolves or creates the hub on the right `ZeroHub` +instance and upgrades the HTTP connection to a WebSocket. +Creates go through the atomic `CreateHubIfAbsent` primitive, so concurrent creates of the same ID collapse to a single hub (race winners create, the rest get `409`) instead of orphaning one. diff --git a/openwiki/architecture/signaling-protocol.md b/openwiki/architecture/signaling-protocol.md index 89e6faa..71359b5 100644 --- a/openwiki/architecture/signaling-protocol.md +++ b/openwiki/architecture/signaling-protocol.md @@ -4,6 +4,8 @@ title: Signaling Protocol & Peer Lifecycle description: The ZeroHub client/server protobuf wire format, the SDP offer/answer exchange and offer-collision rule, ICE candidate flushing, and the full PeerStatus lifecycle that drives peer negotiation. tags: [protobuf, signaling, webrtc, sdp, peer-lifecycle, protocol] sources: + - id: openwiki-source-df0d81c76704b851d02513e1 + resource: repo://client/src/const.ts - id: openwiki-source-718b618612c033c4f36b3a45 resource: repo://client/src/zeroHub.ts - id: openwiki-source-f883369ffaf926acfc02d144 @@ -12,10 +14,10 @@ sources: resource: repo://proto/zerohub/v1/server_message.proto - id: openwiki-source-da50555ad2e1dffee0054a4e resource: repo://server/pkg/hub/hub.go -generated: { by: "hermes", at: "2026-10-13T03:37:16.218Z" } +generated: { by: "hermes", at: "2026-11-20T20:39:20.288Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T20:39:20.288Z --- # Signaling Protocol & Peer Lifecycle @@ -38,8 +40,7 @@ message: |---|---| | `send_offer_message` | `answer_peer_id`, `offer_sdp` | | `send_answer_message` | `offer_peer_id`, `answer_sdp` | -| `send_ice_candidate_message` | `peer_id`, `candidate` (unused) | -| `update_peer_metadata_message` | `peer_id`, `metadata` (unused in server handler) | +| `send_ice_candidate_message` | `peer_id`, `candidate` (relayed to the target peer for trickle ICE) | **ServerMessage (server → client)** @@ -50,7 +51,7 @@ message: | `peer_disconnected_message` | `peer_id` | | `offer_message` | `offer_peer_id`, `offer_sdp` | | `answer_message` | `answer_peer_id`, `answer_sdp` | -| `ice_candidate_message` | `peer_id`, `candidate` (not used yet) | +| `ice_candidate_message` | `peer_id`, `candidate` (relays a trickled ICE candidate to the target peer) | `Peer` is `{ id, metadata, join_time }` — a string ID plus a JSON-serialized metadata string (the client parses `metadata` with `JSON.parse`). @@ -119,25 +120,34 @@ either mode. ## ICE candidate handling -Rather than signaling individual ICE candidates (the -`ice_candidate_message` / `send_ice_candidate_message` frames exist but are -marked unused), ZeroHub relies on **trickle-avoidance via a timeout**. The -duplicated wait-and-send logic from `sendOffer`/`sendAnswer` is extracted into -the shared private helper `armSendOnIceReady(peerId, rtcConn, sendOnce)`, so -the two paths can never diverge: - -- Both `sendOffer`/`sendAnswer` delegate the ICE wait-and-send to the shared - `armSendOnIceReady(peerId, rtcConn, sendOnce)` helper: `onicecandidate` sends - the SDP to the server the moment `event.candidate` is null (gathering - finished) and no prior send happened, and a `setTimeout` of +ZeroHub signals ICE candidates two ways: it sends the SDP offer/answer +**exactly once**, and it **trickles every individual candidate** to the remote +peer as it arrives. The duplicated wait-and-send logic from +`sendOffer`/`sendAnswer` is extracted into the shared private helper +`armSendOnIceReady(peerId, rtcConn, sendOnce)`, so the two paths can never +diverge: + +- The `onicecandidate` handler fires the SDP send exactly once on the first + candidate-less event (gathering finished), and a `setTimeout` of `waitIceCandidatesTimeout` (default **2000 ms**, from `DEFAULT_CONFIG`) fires as a fallback: if candidates are still pending, it flushes the current SDP anyway so negotiation is not blocked forever. The two paths share a single `isSent` guard inside the helper, so the SDP is sent exactly once even if a late candidate event and the timer race. +- Every candidate-bearing `onicecandidate` event — including candidates that + trickle in **after** the SDP has gone out — is forwarded to the remote peer + via `sendIceCandidateToWebsocket`, which wraps it in a + `SendIceCandidateMessage`. The server relays it to the named peer + (`hub.SendIceCandidateToPeer`), and the receiver applies it with + `addIceCandidate` (the candidate is JSON-serialized by the sender and + `safeParseJson`-decoded on receipt, so a poisoned value degrades instead of + crashing the dispatcher). If the signaling socket is not open (e.g. + mid-reconnect) the candidate is dropped with a logged warning rather than + throwing out of the event handler. - Pending ICE timeout handles are tracked per peer in `iceTimeouts` and cleared - on `disconnect()`, so a timer can never write to a closed socket. The prior - handle for a peer is always cleared before arming a new one. + on `disconnect()` and per-peer removal, so a timer can never write to a + closed socket. The prior handle for a peer is always cleared before arming a + new one. ## Peer status lifecycle @@ -159,11 +169,14 @@ Beyond the happy path there are three terminal/abnormal states: calls `restartIce()` on `iceConnectionState === "failed"`. - **`ZeroHubDisconnected`** — the server broadcast a `PeerDisconnectedMessage` (the peer left the hub). The local client fires - the status change, closes the peer's `RTCPeerConnection`, nulls its ICE/ - connection handlers, and removes the peer from the `peers` map. + the status change, then tears the peer down through the shared `removePeer` + helper: it clears the peer's pending ICE-candidate fallback timer and + pending P2P-drop recovery timer, closes the peer's `RTCPeerConnection`, + nulls its ICE/connection handlers, and removes the peer from the `peers` + map. - **`Disconnected`** — the local client called `disconnect()`, closing the ZeroHub WebSocket and tearing down every peer. No peer can be restored until - the client reconnects via `createHub()`/`joinHub()`. + the client reconnects via a hub entrypoint (e.g. `joinStaticHub()`). The topology observes every transition through `onPeerStatusChange`, which is where `MeshTopology` triggers the offer (on `Pending`, if it is the offerer) diff --git a/openwiki/operations/development-testing.md b/openwiki/operations/development-testing.md index 43f7c1f..51d2cb7 100644 --- a/openwiki/operations/development-testing.md +++ b/openwiki/operations/development-testing.md @@ -22,18 +22,18 @@ sources: resource: repo://test/tests/unit-manual-offer-handling.spec.ts - id: openwiki-source-d5ba4efac3261c35045dc88c resource: repo://test/tests/unit-migration-redirect.spec.ts - - id: openwiki-source-28ab2f95a9b9d21c0110a864 - resource: repo://test/tests/unit-permanent-hub-endpoints.spec.ts - id: openwiki-source-29851cc9f0534cab4748f6fb resource: repo://test/tests/unit-reconnect-peer-prune.spec.ts + - id: openwiki-source-fc03789f03ea810eb48d9541 + resource: repo://test/tests/unit-static-hub-endpoints.spec.ts - id: openwiki-source-30c344265a55823115544978 resource: repo://test/tests/unit-ws-replacement.spec.ts - id: openwiki-source-801ca2739d5984913a9ac0eb resource: repo://test/unit-harness/index.ts -generated: { by: "hermes", at: "2026-10-14T01:29:11.350Z" } +generated: { by: "hermes", at: "2026-11-20T20:39:20.288Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T20:39:20.288Z --- # Development & Testing @@ -52,10 +52,11 @@ The root `Makefile` is the primary orchestration point. Key targets: | `server-serve` | Run the server (`APP_CLIENT_SECRET=client_secret go run ./cmd/server.go`) | | `server-serve-2` | Run a second server on `APP_PORT=8081` | | `server-test` | `go test -v ./...` in `server/` | +| `client-test` | Typecheck the client (`npm run typecheck`), then run the client's vitest suite (`npm run test`) | | `e2e-test` | Kills ports, spawns two servers on 8080/8081, waits, runs `test/`, kills servers | -| `test-all` | `server-test` + `e2e-test` in parallel (`-j3`) | +| `test-all` | `server-test` + `e2e-test` + `client-test` in parallel (`-j3`) | | `proto-gen` | Runs `api-linter`, then regenerates TS + Go protobuf for both | -| `server-mock` | Regenerate gomock mocks for `zerohub`, `hub`, `peer` | +| `server-mock` | Regenerate the gomock mock for `zerohub` | | `kill-server` | Kill whatever is LISTENing on 8080/8081 | ## Protobuf regeneration @@ -93,26 +94,31 @@ In `server/`: - `go test -bench ./pkg/*** -benchmem` for benchmarks. Config comes from `.env` (copy `.env.example`); key vars are `APP_PORT`, -`APP_CLIENT_SECRET`. Regenerate mocks (`make server-mock`) after interface -changes in `pkg/zerohub/zerohub.go`, `pkg/hub/hub.go`, or `pkg/peer/peer.go`. +`APP_CLIENT_SECRET`. Regenerate the mock (`make server-mock`) after interface +changes in `pkg/zerohub/zerohub.go` (the generated `MockHub` / `MockPeer` +mocks were removed — those interfaces no longer need mocks). ## E2E test suite -The `test/` directory is a Playwright suite using Svelte harness components -that instantiate the real `ZeroHubClient` (imported via relative path -`../../client/src/index`): +The `test/` directory is a Playwright suite driven by a plain-TypeScript +harness (bundled with esbuild) that instantiates the real `ZeroHubClient` +(imported via relative path `../../client/src/index`): - **Harness** (`test/harness/index.ts`) exposes a `window.ZeroHubHarness` that creates/joins hubs, logs peer status changes, and tracks data-channel state, keyed by `componentId`. Tests drive it via `page.evaluate`. -- **Specs** (`test/tests/`): `connnect.spec.ts` (create/join + peer status), +- **Specs** (`test/tests/`): `connect.spec.ts` (create/join + peer status), `data-channel.spec.ts`, `concurrent.spec.ts`, `disconnect.spec.ts`, - `migrate.spec.ts`, `multihosts.spec.ts`, plus thirteen `unit-*.spec.ts` specs + `zz-migrate.spec.ts` (zero-downtime migration; named `zz-` so it sorts and + runs LAST — it latches the shared `:8080` server into one-way migrate mode), + `multihosts.spec.ts`, `static-hub.spec.ts`, plus twenty-three + `unit-*.spec.ts` specs (e.g. `unit-sfu-election.spec.ts`, `unit-reconnect-error.spec.ts`, `unit-malformed-metadata.spec.ts`, `unit-reconnect-peer-prune.spec.ts`, - `unit-ice-candidate-send.spec.ts`, `unit-manual-offer-handling.spec.ts`, + `unit-ice-candidate-send.spec.ts`, `unit-trickle-ice-receive.spec.ts`, + `unit-manual-offer-handling.spec.ts`, `unit-manual-answer-handling.spec.ts`, `unit-migration-redirect.spec.ts`, - `unit-permanent-hub-endpoints.spec.ts`, `unit-ws-replacement.spec.ts`) + `unit-static-hub-endpoints.spec.ts`, `unit-ws-replacement.spec.ts`) that exercise client internals in a Playwright page through the unit harness (`test/unit-harness/index.ts`) with a mocked `RTCPeerConnection` and a `MockWebSocket` installed on `globalThis` (each mock socket is @@ -121,32 +127,31 @@ that instantiate the real `ZeroHubClient` (imported via relative path malformed-metadata spec pins the `safeParseJson` fallback, the reconnect-peer-prune spec pins the `hubInfoMessage` roster reconciliation that removes stale peers, the ice-candidate-send spec pins the shared - ICE-candidate wait-and-send behavior, the manual offer/answer specs pin the + ICE-candidate wait-and-send behavior, the trickle-ice-receive spec pins + post-SDP candidate relay, the manual offer/answer specs pin the `onOffer`/`onAnswer` manual-SDP paths, the migration-redirect spec pins the 1001 close-reason host validation (and the self-redirect stop plus the - `host`/`hostIndex` update on a valid redirect), the - permanent-hub-endpoints spec pins that `createPermanentHub`/`joinPermanentHub` - dial `/v1/permanent-hubs/create` and `/v1/permanent-hubs/join` with the - correct `id`/`hubMetadata`/`peerMetadata` query params, and the ws-replacement spec - pins that a second entry-point call tears down the previous socket instead - of leaking it. + `host`/`hostIndex` update on a valid redirect), the static-hub-endpoints + spec pins that `joinStaticHub` dials `/v1/static-hubs/join` with the + correct `id`/`peerMetadata` query params, and the ws-replacement spec pins + that a second entry-point call tears down the previous socket instead of + leaking it. - **Dual servers**: `make e2e-test` spins up two signaling servers on 8080 and 8081 (for multi-host/failover tests), sleeps 3s, then runs the suite. ### Running the E2E suite correctly - **Always run via `cd test && npm test`**, not `npx playwright test` - directly. `npm test` triggers `pretest`, which runs `build:harness` - (`test/dist/harness.js` for the E2E Svelte harness) **and** - `build-unit-harness` (`test/dist/unit-harness.js` for the unit specs), both - via esbuild. Invoking Playwright directly makes the specs fail with ENOENT - on their missing harness bundles. + directly. `npm test` triggers `pretest`, which type-checks the specs + (`tsc -p tsconfig.json`), builds the E2E harness (`test/dist/harness.js`) + **and** the unit harness (`test/dist/unit-harness.js`), both via esbuild. + Invoking Playwright directly makes the specs fail with ENOENT on their + missing harness bundles. - The Playwright config runs **serially** (`fullyParallel: false`) with a 10s - per-test timeout, Chrome-only. Under `CI=1` it sets `workers: 1` and - `retries: 2`. -- **Parallel e2e runs flake under load** on pre-existing specs. To distinguish - a real regression from load flakiness, run serially (`CI=1 npx playwright - test`) or run each spec individually. + per-test timeout, Chrome-only, and `workers: 1` pinned unconditionally: the + specs share two live server processes and `zz-migrate.spec.ts` permanently + latches `:8080` into migrate mode, so parallel runs would race that shared + state. Under `CI=1` it additionally sets `retries: 2` and `forbidOnly`. ## Zero Factory precommit gate diff --git a/openwiki/quickstart.md b/openwiki/quickstart.md index 8d1c66e..5806474 100644 --- a/openwiki/quickstart.md +++ b/openwiki/quickstart.md @@ -12,18 +12,22 @@ sources: resource: repo://client/src/zeroHub.ts - id: openwiki-source-012f2c78e3b1446dfc35803f resource: repo://Makefile + - id: openwiki-source-41f21ee88395963644de9448 + resource: repo://server/pkg/config/config.go - id: openwiki-source-e27a23c64f72b7d3d77630c6 resource: repo://server/pkg/handler/handler.go + - id: openwiki-source-93a30dd3c2c7599eb46400a4 + resource: repo://test/harness/index.ts - id: openwiki-source-b7181b4d7359d016a13b092d resource: repo://test/package.json - id: openwiki-source-bb910847e63080c9ced0e830 resource: repo://test/playwright.config.ts - id: openwiki-source-801ca2739d5984913a9ac0eb resource: repo://test/unit-harness/index.ts -generated: { by: "hermes", at: "2026-10-13T01:29:56.745Z" } +generated: { by: "hermes", at: "2026-11-20T20:39:20.288Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T20:39:20.288Z --- # ZeroHub Quickstart @@ -52,7 +56,7 @@ orient, then follow the related pages for depth: | `client/` | TypeScript/JavaScript SDK, published as `@zero-hub/client` on npm | | `server/` | Go signaling server (`fasthttp`) | | `proto/` | Protobuf definitions for client↔server communication | -| `test/` | E2E tests (Playwright + Svelte) driving the real client, plus unit specs that exercise client internals with a mocked `WebSocket` and `RTCPeerConnection` | +| `test/` | E2E tests (Playwright driving a plain-TypeScript harness bundled by esbuild against two live servers), plus unit specs that exercise client internals with a mocked `WebSocket` and `RTCPeerConnection` | | `docs/` | Astro-based documentation site | | `Makefile` | Root orchestration (run, test, proto-gen, e2e) | | `AGENTS.md` | Repository development guide | @@ -72,9 +76,10 @@ go run cmd/server.go # listens on 0.0.0.0:8080 by default ``` `APP_CLIENT_SECRET` is required (the server refuses to start without it). See -`server/.env.example` for `APP_PORT`, `APP_HUB_STORAGE`, `APP_PEER_STORAGE`, -and `APP_TRUST_PROXY`. From the repo root you can also run -`make server-serve` (or `make server-serve-2` for a second instance on 8081). +`server/.env.example` for `APP_TRUST_PROXY` and `APP_ALLOWED_ORIGINS`; +`APP_PORT` (default `8080`) and the hub/peer storage backends (default +`memory`) fall back to their config defaults. From the repo root you can also +run `make server-serve` (or `make server-serve-2` for a second instance on 8081). ## 2. Use the client @@ -85,7 +90,9 @@ npm install @zero-hub/client ``` Instantiating a client makes **no network connection** — call one of the hub -entrypoints to connect: +entrypoints to connect. They return `Promise` that resolves when the +signaling WebSocket opens (hub state like `myPeerId`/`peers` fills in when +`onHubInfo` fires): ```typescript import { ZeroHubClient, PeerStatus, LogLevel } from '@zero-hub/client'; @@ -107,13 +114,18 @@ client.onPeerStatusChange = (peer) => { } }; -// Connect and establish the mesh. -client.createHub('my-hub', { name: 'Alice' }); -// ...or client.joinHub('my-hub', { name: 'Bob' }); +// Create a random hub (the server picks the id) and establish the mesh: +await client.createRandomHub({ name: 'Alice' }); +// ...or a second peer joins it by the id it got from onHubInfo: +// await client.joinRandomHub(hubId, { name: 'Bob' }); +// Or join a static (named, never-expires) hub — static hubs are created +// out-of-band via the admin-gated /v1/static-hubs/create endpoint: +// await client.joinStaticHub('my-hub', { name: 'Bob' }); ``` -For a second peer, call `joinHub` with the same hub ID. The two clients -negotiate over the server and establish a direct WebRTC data channel. +For a second peer, call `joinRandomHub` (or `joinStaticHub`) with the same hub +ID. The two clients negotiate over the server and establish a direct WebRTC +data channel. > Manual SDP handling: set `autoAnswer: false` / `autoAcceptAnswer: false` to > surface incoming offers/answers via the `onOffer` / `onAnswer` callbacks and @@ -122,8 +134,8 @@ negotiate over the server and establish a direct WebRTC data channel. ## 3. Core concepts (in one line each) -- **Hub** — a room; peers join it by ID (`createHub` / `joinHub` / - `joinOrCreateHub`). +- **Hub** — a room; peers enter via `createRandomHub` / `joinRandomHub` / + `joinStaticHub` / `joinOrCreateIPHub`. - **Peer** — a connected client, assigned a numeric ID by the server; the higher ID creates the offer to the lower ID to avoid collision. - **Metadata** — arbitrary JSON attached to each peer and to each hub, @@ -136,10 +148,14 @@ negotiate over the server and establish a direct WebRTC data channel. ## 4. Common tasks - **Regenerate protobuf** after editing `proto/*.proto`: `make proto-gen`. -- **Run the full test cycle** (two servers + E2E): `make test-all`. +- **Run the full test cycle** (server unit tests + two-server E2E + client + tests, in parallel): `make test-all`. - **Run server unit tests**: `make server-test` (or `cd server && go test ./...`). -- **Run E2E tests**: `cd test && npm test` (the `pretest` step builds both - the E2E Svelte harness and the unit-spec harness; don't invoke +- **Run E2E tests**: `cd test && npm test` (the `pretest` step type-checks + and bundles the plain-TypeScript E2E harness and the unit-spec harness with + esbuild; the suite runs serially (`workers: 1`) because the shared `:8080` + server's `/v1/admin/migrate` latch is one-way — the migrate spec is named + `zz-migrate.spec.ts` so it sorts and runs last; don't invoke `npx playwright test` directly). - **Factory precommit gate**: `./.zerofactory/precommit.sh` (format, build, test). diff --git a/openwiki/subsystems/client-sdk.md b/openwiki/subsystems/client-sdk.md index beb489e..21e3a77 100644 --- a/openwiki/subsystems/client-sdk.md +++ b/openwiki/subsystems/client-sdk.md @@ -4,8 +4,6 @@ title: TypeScript Client SDK description: The @zero-hub/client SDK — ZeroHubClient connection lifecycle, reconnection with host failover, migration-redirect handling, manual offer/answer handling, disconnect/reuse semantics, the pluggable topology system, data/media channel configuration, and SDP send/receive. tags: [typescript, client, sdk, webrtc, topology, reconnection, data-channel] sources: - - id: openwiki-source-61fafffac07a0fdf636cac43 - resource: repo://client/README.md - id: openwiki-source-df0d81c76704b851d02513e1 resource: repo://client/src/const.ts - id: openwiki-source-22df8f9ebcff0eeb4e4ed38f @@ -18,10 +16,10 @@ sources: resource: repo://client/src/utils.ts - id: openwiki-source-718b618612c033c4f36b3a45 resource: repo://client/src/zeroHub.ts -generated: { by: "hermes", at: "2026-10-14T01:29:11.350Z" } +generated: { by: "hermes", at: "2026-11-20T20:39:20.288Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T20:39:20.288Z --- # TypeScript Client SDK @@ -29,8 +27,9 @@ verified: `@zero-hub/client` is the browser/Node SDK. It opens the WebSocket to the signaling server, drives SDP offer/answer negotiation, and hands the resulting `RTCPeerConnection`s to a pluggable topology. Public surface is re-exported from -`client/src/index.ts`: `Peer`, `ZeroHubClient`, the config consts/types, and the -`topology` module. The class is generic over `PeerMetadata` and `HubMetadata`. +`client/src/index.ts`: `Peer`, `ZeroHubClient`, the `Logger` / +`ZeroHubLogger` types, the config consts/types, and the `topology` +module. The class is generic over `PeerMetadata` and `HubMetadata`. ## ZeroHubClient: state & entrypoints @@ -43,8 +42,12 @@ signaling server, drives SDP offer/answer negotiation, and hands the resulting - `myPeerId`, `hubInfo` — set when the `HubInfoMessage` arrives. - `topology` — the connection strategy (default `MeshTopology`). - `ws` — the active WebSocket (binary `arraybuffer` frames). -- `isDisconnected` — manual-disconnect flag. -- `iceTimeouts` — per-peer pending ICE candidate timers. +- `isDisconnected` — manual-disconnect flag; `reconnectAbandoned` — terminal + latch set once all hosts exhaust their reconnect budget. +- `iceTimeouts` — per-peer pending ICE candidate timers; + `webRtcRecoveryTimeouts` — per-peer pending P2P-drop recovery timers. +- `reconnectAttempts` / `reconnectRound` / `isInitialConnection` / + `inConfiguredHosts` — auto-reconnect retry/backoff/sweep state. - Callbacks: `onZeroHubError`, `onHubInfo`, `onPeerStatusChange`, `onPeerError`, `onOffer`, `onAnswer`. - `logger` — a `ZeroHubLogger` honoring `logLevel`. @@ -63,19 +66,25 @@ with `id`, `hubMetadata`, `peerMetadata` as query params, and calls | Method | Path | Purpose | |---|---|---| -| `createHub(hubId, peerMetadata?, hubMetadata?)` | `/v1/hubs/create` | create a static hub | -| `joinHub(hubId, peerMetadata?)` | `/v1/hubs/join` | join a static hub | -| `joinOrCreateHub(...)` | `/v1/hubs/join-or-create` | join or create | -| `joinOrCreateIPHub(...)` | `/v1/ip-hubs/join-or-create` | IP-keyed join-or-create | -| `createPermanentHub(hubId, peerMetadata?, hubMetadata?)` | `/v1/permanent-hubs/create` | create a permanent (never-expires) hub; server gates creation behind admin auth | -| `joinPermanentHub(hubId, peerMetadata?)` | `/v1/permanent-hubs/join` | join a permanent hub | -| `createRandomHub(...)` | `/v1/random-hubs/create` | create a random hub | -| `joinRandomHub(hubId, peerMetadata?)` | `/v1/random-hubs/join` | join a random hub | - -The old `joinIPHub(hubId)` entry point was removed: an IP hub's id is derived -from the caller's IP by the server, so a client-supplied hub id can never -resolve to an IP hub (the endpoint always returned 404). Use -`joinOrCreateIPHub` instead. +| `joinStaticHub(hubId, peerMetadata?)` | `/v1/static-hubs/join` | join a static (never-expires, named) hub | +| `joinOrCreateIPHub(peerMetadata?, hubMetadata?)` | `/v1/ip-hubs/join-or-create` | IP-keyed join-or-create (id derived server-side from the caller's IP) | +| `createRandomHub(peerMetadata?, hubMetadata?)` | `/v1/random-hubs/create` | create a random hub (server picks the id) | +| `joinRandomHub(hubId, peerMetadata?)` | `/v1/random-hubs/join` | join a random hub by id | + +All four return a `Promise` that resolves when the signaling +WebSocket opens and rejects when the connection attempt fails. + +Static hubs are **created out-of-band by an admin** via the plain-HTTP +`GET /v1/static-hubs/create` endpoint (admin-gated with the +`Authorization` header), not through the SDK — the browser WebSocket API +cannot send custom headers. The former `createHub`/`joinHub`/ +`joinOrCreateHub` (the old `/v1/hubs/*` static endpoints) and +`createPermanentHub`/`joinPermanentHub` (the old +`/v1/permanent-hubs/*` endpoints) entry points have been removed. The +former `joinIPHub(hubId)` entry point was also removed: an IP hub's id +is derived from the caller's IP by the server, so a client-supplied hub +id can never resolve to an IP hub (the endpoint always returned 404). +Use `joinOrCreateIPHub` instead. ## WebSocket lifecycle & message dispatch @@ -99,9 +108,11 @@ resolve to an IP hub (the endpoint always returned 404). Use - `onclose` — interprets the close code: `1000` (normal) does nothing; `1001` (going away) hands the close *reason* to `reconnect(url, reason)` as the migration redirect — which validates the reason as a well-formed host - before acting on it (see Reconnection below); `1006`/`1011` - (abnormal/internal error) reconnect; anything else fires - `onZeroHubError`. + before acting on it (see Reconnection below); `1006`/`1011`/`1012`/`1013` + (abnormal, internal error, service restart, try-again-later — all + transient outages) feed the reconnect loop; any other code is a + protocol-level failure that rejects the still-pending connect `Promise` + and fires `onZeroHubError`. `handleZeroHubMessage` branches on the `ServerMessage` oneof: @@ -139,15 +150,18 @@ add or remove a peer can never diverge: - **`addPeer(peerId, metadata, joinTime)`** — builds a `Peer` with a fresh `RTCPeerConnection`, parses its metadata via `safeParseJson`, wires - `onconnectionstatechange` / `oniceconnectionstatechange` (ICE restart on - `failed`), stores it in the map, and marks it `Pending`. Used by both the - `hubInfoMessage` and `peerJoinedMessage` paths. -- **`removePeer(peerId)`** — closes the peer's `RTCPeerConnection`, nulls the - two state handlers so a stale ICE event cannot call `restartIce()` on a - closing connection, and deletes the peer from the map. No-op if already - gone. Used by `disconnect()`, the `peerDisconnectedMessage` broadcast, and - the `hubInfoMessage` roster-prune pass. The caller emits the appropriate - status first (it differs per path). + `onconnectionstatechange` / `oniceconnectionstatechange` (both schedule a + delayed P2P-drop recovery via `scheduleWebrtcRecovery` on `disconnected` + / `failed`), stores it in the map, and marks it `Pending`. Used by both + the `hubInfoMessage` and `peerJoinedMessage` paths. +- **`removePeer(peerId)`** — clears the peer's pending ICE-candidate + fallback timer and P2P-drop recovery timer, closes the + `RTCPeerConnection`, nulls the two state handlers so a stale ICE event + cannot call back into the client on a closing connection, and deletes + the peer from the map. No-op if already gone. Used by `disconnect()`, + the `peerDisconnectedMessage` broadcast, and the `hubInfoMessage` + roster-prune pass. The caller emits the appropriate status first (it + differs per path). `safeParseJson(raw, fallback)` (module-level helper) `JSON.parse`s the raw metadata string and returns the parsed value on success, or `fallback` when @@ -157,81 +171,119 @@ can legitimately equal the fallback — so a corrupt hub/peer metadata value from the server degrades to the fallback instead of crashing the WebSocket message dispatcher. -## Reconnection with host failover +## Reconnection: retry, backoff, failover, wraparound -`reconnect(currentURL, newHost?)`: +`reconnect(currentURL, newHost?)` is the single entry point for all recovery +paths: -- Returns immediately if `isDisconnected` (manual disconnect). -- If `newHost` is supplied (the 1001 going-away redirect case), the close +- **Abort** — returns immediately if `isDisconnected` (manual disconnect) or + if the `reconnectAbandoned` latch is set (the terminal "all hosts + exhausted" error already fired; only a fresh entry-point call — which + clears the latch in `connectToZeroHub` — may start a new session). +- **1001 going-away redirect** (when `newHost` is supplied): the close reason is first validated as a well-formed host by `isWellFormedHost` (client/src/utils.ts — a bare hostname or `host:port`, no scheme, no path/query/fragment, no userinfo, port in 0..65535; it mirrors the server's `validateBackupHost` for the host emitted in migration closes). `1001` is a generic RFC 6455 code, so a proxy or load balancer may close with a human-readable reason: a malformed reason logs a warning and falls - through to the automatic host-failover path below **without touching host - state**. A redirect back to the current host (`newHost === this.host`, e.g. - an operator pointing `/admin/migrate` at the current host) is surfaced - through `onZeroHubError` and stopped, since it would cycle forever with no - backoff and no terminal error. A valid redirect updates `this.host` (every - entry point builds its URL from it) and `hostIndex` (pointing at the - redirected host when it is in the configured list) before reconnecting. -- Otherwise it calls `getZeroHubBackupHost()`, which advances `hostIndex` to - the next host in the list and resolves it (rejecting when the last host has - been exhausted). **Critically, the `isDisconnected` flag is re-checked inside - the async `.then` callback**, not just at entry — a user calling - `disconnect()` while the backup-host fetch is in flight must not resurrect - the connection. It also bails if the backup host equals the current host. -- When every host is exhausted, the rejection reaches the `.catch`, which - surfaces the terminal failure (`all ZeroHub hosts are not working, please - check the ZeroHub hosts`) through `onZeroHubError` — there is no further - automatic retry. + through to the automatic recovery path below **without touching host + state**. A redirect back to the current host (`newHost === this.host`, + e.g. an operator pointing `/admin/migrate` at the current host) is + surfaced through `onZeroHubError` and stopped, since it would cycle + forever with no backoff and no terminal error. A valid redirect updates + `this.host` (every entry point builds its URL from it) and `hostIndex` + (pointing at the redirected host when it is in the configured list), + resets the retry and sweep budgets, and re-dials immediately. +- **Same-host retry with exponential backoff** — on an abnormal close + (1006/1011/1012/1013), every host gets a bounded budget of + `maxReconnectAttempts` (default **10**) same-host re-dials spaced + `reconnectBaseBackoffMs` (default **250 ms**) × 2^(attempts − 1), with + ±20% random jitter, capped at 30 seconds — so long-lived sessions survive + transient blips (Wi-Fi handover, NAT/proxy hiccup, laptop sleep) instead + of dying permanently. Same-host retries leave `hostIndex` untouched, so + "a single logical failure advances `hostIndex` exactly once" (pinned by + `test/tests/multihosts.spec.ts`) still holds. The budget refills only when + a connection is confirmed (the server's `hubInfoMessage` arrives). +- **Host failover** — when the current host's retry budget is spent and it + is not the last configured host, `hostIndex` advances to the next host, + which gets a fresh retry budget. +- **Wraparound** — when the last configured host's budget (with more than + one configured) or a redirected out-of-list host's budget is spent, the + sweep wraps back to the FIRST configured host instead of giving up after + one pass through the list; this is bounded by `maxReconnectRounds` + (default **2**) full sweeps, so the terminal error stays reachable. +- **Terminal** — when every host's budget is spent on every allowed sweep, + `reconnectAbandoned` latches and the terminal failure (`all ZeroHub hosts + are not working, please check the ZeroHub hosts`) is surfaced through + `onZeroHubError`; any later close on a leftover socket is a no-op. + +The initial connection (before any `hubInfoMessage` has ever been +confirmed) skips same-host retry and fails over to the next host +immediately: a first-dial failure is not a transient blip on a confirmed +session. Pending retry timers carry a generation token, so `disconnect()` +and a fresh entry-point dial cancel and invalidate them — a stale timer can +never resurrect a manually disconnected client or dial a stray second +socket. ## Disconnect & reuse `disconnect()`: -1. Sets `isDisconnected = true`. -2. Clears all pending `iceTimeouts`. +1. Sets `isDisconnected = true`, cancels any queued same-host retry timer, + and resets `reconnectRound` so a reused client starts with a full sweep budget. +2. Clears all pending `iceTimeouts` and `webRtcRecoveryTimeouts`, so a timer + can never fire after teardown and resurrect a socket or a peer. 3. Calls the shared `closeActiveSocket()` helper, which detaches all WebSocket handlers (`onclose`/`onerror`/`onmessage`/`onopen`) so the close does **not** trigger auto-reconnect, then closes the socket with code 1000. (The same helper is used by `connectToZeroHub` to replace a socket left open by a previous entry-point call.) -4. Transitions every peer to `Disconnected` and closes each `RTCPeerConnection` - (nulling handlers around `close()` so a stale ICE event can't call - `restartIce()` on a closing connection), then empties the `peers` map. +4. Transitions every peer to `Disconnected` and closes each + `RTCPeerConnection` via the shared `removePeer` helper (nulling handlers + around `close()` so a stale ICE event can't call `restartIce()` on a + closing connection), then empties the `peers` map. The client is **reusable** after `disconnect()`: calling any entrypoint again -resets `isDisconnected` and starts a fresh connection. `sendZeroHubMessage` -throws if called while disconnected or when no socket exists. +resets `isDisconnected` (and clears `reconnectAbandoned`) and starts a fresh +connection. `sendZeroHubMessage` throws if called while disconnected, when no +socket exists, or when the socket is not yet `OPEN` (a CONNECTING/CLOSING +socket would otherwise make `ws.send()` throw a raw `InvalidStateError`). ## SDP send/receive -- `sendOffer(peerId, ...)` — runs `createOffer`/`setLocalDescription`, then - delegates the ICE-candidate wait-and-send to the shared - `armSendOnIceReady` helper (below). Transitions the peer to `Offering`. - Offer options are **spread into a fresh local object** +- `sendOffer(peerId, ...)` and `sendAnswer(peerId, offerSdp, ...)` — both + funnel through the shared private `negotiateWithPeer` helper, which runs + the op-specific WebRTC steps (`createOffer`/`setLocalDescription`, or + `setRemoteDescription(offer)`/`createAnswer`/`setLocalDescription`) and + then delegates the ICE-candidate wait-and-send to the + `armSendOnIceReady` helper (below). Offer options are **spread into a + fresh local object** inside `negotiateWithPeer` (`{ ...config.rtcOfferOptions, ...rtcOfferOptions }`) rather than `Object.assign`-ed onto the shared config, so per-call options can never - leak into the stored `config.rtcOfferOptions`. -- `sendAnswer(peerId, offerSdp, ...)` — sets the remote offer description, - creates the answer, and delegates to the same `armSendOnIceReady` helper. - Transitions to `Answering`. + leak into the stored `config.rtcOfferOptions`. A failed exchange is logged, + surfaced via the `onPeerError` callback, and re-thrown to the caller. + `sendOffer` transitions the peer to `Offering`; `sendAnswer` to + `Answering` (the transitions happen in `sendOfferToWebsocket` / + `sendAnswerToWebsocket`, which wrap the SDP in a `ClientMessage`, send it, + and advance the peer status). - `acceptAnswer(peerId, answerSdp)` — sets the remote answer description. -- `sendOfferToWebsocket` / `sendAnswerToWebsocket` — wrap the SDP in a - `ClientMessage` and send it; they also advance the peer status. `armSendOnIceReady(peerId, rtcConn, sendOnce)` (private, shared by -`sendOffer` and `sendAnswer`) wires the peer's `onicecandidate` handler plus a -`waitIceCandidatesTimeout` fallback so `sendOnce` is invoked **exactly once**: -`onicecandidate` fires the send on the first event that carries no candidate -(the gathering-complete marker), skipping events that still carry a candidate; -the timer fires the send if no such event arrives within -`waitIceCandidatesTimeout` milliseconds. The two paths share a single `isSent` -guard, so re-negotiation (or a late candidate after the timeout) can never -send the SDP a second time. Re-arm clears the prior pending handle for -`peerId` so `disconnect()` cannot miss it and records the timer in +`sendOffer` and `sendAnswer` via `negotiateWithPeer`) wires the peer's +`onicecandidate` handler plus a `waitIceCandidatesTimeout` fallback so +`sendOnce` is invoked **exactly once**: `onicecandidate` fires the send on +the first event that carries no candidate (the gathering-complete marker), +skipping events that still carry a candidate; the timer fires the send if no +such event arrives within `waitIceCandidatesTimeout` milliseconds. Every +candidate-bearing event is additionally **trickled** to the remote peer via +`sendIceCandidateToWebsocket` (a `SendIceCandidateMessage` frame) — +including candidates that arrive after the SDP has gone out; if the signaling +socket is not `OPEN` at that moment, the candidate is dropped with a logged +warning rather than throwing. The two paths share a single `isSent` guard, +so re-negotiation (or a late candidate after the timeout) can never send the +SDP a second time. Re-arm clears the prior pending handle for `peerId` so +`disconnect()` cannot miss it and records the timer in `this.iceTimeouts[peerId]`. ICE timeout handles are tracked in `iceTimeouts[peerId]`; a prior handle is @@ -281,7 +333,20 @@ Both topologies delegate the per-peer WebRTC wiring to the shared helpers in logging. The media helper requires call sites to pass the level-gated `ZeroHubClient.logger`, not the raw user `config.logger`. -Both topologies treat `ZeroHubDisconnected` and `Disconnected` as no-ops. +Both topologies treat `ZeroHubDisconnected` and `Disconnected` as no-ops. On +`WebRTCDisconnected` (P2P drop while the signaling socket is still alive), +both topologies re-negotiate the existing `RTCPeerConnection` instead of +rebuilding it: the collision-free offer role decides who re-sends the offer +(higher-ID peer in mesh; the SFU in SFU topology, since the SFU is always the +offerer), and the answerer recovers when that offer arrives through the +normal `offerMessage`/`sendAnswer` path. Data channels and media tracks are +**not** re-created — the renegotiation refreshes the ICE/DTLS transport while +the established channels/transceivers persist, so the application is never +handed duplicate channels. The SFU topology additionally **re-elects** a new +SFU when the currently elected one leaves the hub (deduped by +`lastElectingSfuId` against duplicate/delayed departure broadcasts), so the +star does not silently degrade; an explicitly configured `sfuPeerId` is never +overridden by re-election. ## Data & media channels @@ -298,9 +363,10 @@ Both topologies treat `ZeroHubDisconnected` and `Disconnected` as no-ops. `DEFAULT_CONFIG` sets: `tls: true`, `logLevel: Warning`, `logger: console`, `waitIceCandidatesTimeout: 2000`, `autoAnswer: true`, `autoAcceptAnswer: true`, -and `rtcConfig` = Google STUN servers + `bundlePolicy: "balanced"`. All are -overridable via the `Config` interface. `LogLevel` is `Debug | Warning | Error -| None`. +`maxReconnectAttempts: 10`, `maxReconnectRounds: 2`, +`reconnectBaseBackoffMs: 250`, and `rtcConfig` = Google STUN servers + +`bundlePolicy: "balanced"`. All are overridable via the `Config` interface. +`LogLevel` is `Debug | Warning | Error | None`. ## Peer diff --git a/openwiki/subsystems/server-signaling.md b/openwiki/subsystems/server-signaling.md index 3781385..4847efe 100644 --- a/openwiki/subsystems/server-signaling.md +++ b/openwiki/subsystems/server-signaling.md @@ -13,14 +13,14 @@ sources: resource: repo://server/pkg/handler/create_hub_by_id.go - id: openwiki-source-e27a23c64f72b7d3d77630c6 resource: repo://server/pkg/handler/handler.go - - id: openwiki-source-3c52325a8fc10ab26c610646 - resource: repo://server/pkg/handler/join_hub.go - id: openwiki-source-9df2276596bc3c7c9f0676fd resource: repo://server/pkg/handler/join_or_create_hub_by_id.go - id: openwiki-source-260d31194d7a0cb2a0aa776c resource: repo://server/pkg/handler/join_or_create_hub_ip.go - id: openwiki-source-1eae49f0a1c1e6b3c42e6b07 resource: repo://server/pkg/handler/migrate.go + - id: openwiki-source-92ce67688621ba2c2d38e777 + resource: repo://server/pkg/handler/ratelimit.go - id: openwiki-source-596cf169341f9612a2d0dea6 resource: repo://server/pkg/handler/status.go - id: openwiki-source-3fcd30e2964f43d36d37064d @@ -33,10 +33,10 @@ sources: resource: repo://server/pkg/storage/gache.go - id: openwiki-source-0eb2a9b2acf717d5c99e9894 resource: repo://server/pkg/zerohub/zerohub.go -generated: { by: "hermes", at: "2026-10-14T01:29:11.350Z" } +generated: { by: "hermes", at: "2026-11-20T20:39:20.288Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T20:39:20.288Z --- @@ -54,38 +54,34 @@ entrypoint in `server/cmd/server.go`. 1. `config.LoadConfig()` — reads `.env` (or `ENV_FILE`) via `godotenv` and unmarshals environment variables into `Config` via `go-env`. Key vars: `APP_ENVIRONMENT` (default `dev`), `APP_HOST` (default `0.0.0.0`), - `APP_PORT` (default `8080`), `APP_DOMAIN` (default `localhost`), - `APP_CLIENT_SECRET` (required), `APP_HUB_STORAGE` / `APP_PEER_STORAGE` - (default `memory`), and `APP_TRUST_PROXY` (default `false`). + `APP_PORT` (default `8080`), `APP_CLIENT_SECRET` (required), + `APP_HUB_STORAGE` / `APP_PEER_STORAGE` (default `memory`), + `APP_TRUST_PROXY` (default `false`), and `APP_ALLOWED_ORIGINS` + (optional comma-separated origin allow-list for the WebSocket upgrader). 2. `logger.InitLogger(cfg)` — configures the global zerolog logger. -3. Constructs **four separate `zerohub.ZeroHub` instances** — `zeroHub` - (static), `zeroHubRandom`, `zeroHubIP`, `zeroHubPermanent` — via a shared +3. Constructs **three separate `zerohub.ZeroHub` instances** — + `zeroHubStatic`, `zeroHubRandom`, `zeroHubIP` — via a shared `newZeroHubOrPanic(cfg, name)` constructor that panics on any construction - failure, so each hub type has an isolated hub registry and its own - peer/expiry semantics. + failure, so each hub mode has an isolated hub registry. 4. `handler.NewHandler(...)` then `Serve()`. `NewHandler` refuses to start if `APP_CLIENT_SECRET` is empty, because the admin endpoint would otherwise be open to unauthenticated requests. -## The four hub types & routing +## The three hub modes & routing `handler.Serve` builds a fasthttp server and dispatches on `ctx.Path()`: | Path | Handler | ZeroHub instance | Notes | |---|---|---|---| -| `/v1/status` | `Status` | — | health/version | +| `/v1/status` | `Status` | — | health/version, CORS `*` | | `/v1/admin/migrate` | `Migrate` | — | admin auth | -| `/v1/hubs/create` | `CreateHubStatic` | static | 409 if ID exists | -| `/v1/hubs/get` | `GetHub` | static | 404 if missing | -| `/v1/hubs/join` | `JoinHub` | static | | -| `/v1/hubs/join-or-create` | `JoinOrCreateHubStatic` | static | | +| `/v1/static-hubs/create` | `CreateStaticHub` | static | admin auth, plain HTTP JSON, 409 if ID exists | +| `/v1/static-hubs/join` | `JoinHub` | static | WebSocket upgrade | | `/v1/random-hubs/create` | `CreateHubRandom` | random | server picks ID | -| `/v1/random-hubs/get` | `GetHub` | random | | -| `/v1/random-hubs/join` | `JoinHub` | random | | -| `/v1/ip-hubs/join-or-create` | `JoinOrCreateHubIP` | IP | ID from client IP | -| `/v1/permanent-hubs/join` | `JoinHub` | permanent | | -| `/v1/permanent-hubs/create` | `CreateHubPermanent` | permanent | admin auth | +| `/v1/random-hubs/get` | `GetHub` | random | plain HTTP JSON | +| `/v1/random-hubs/join` | `JoinHub` | random | WebSocket upgrade | +| `/v1/ip-hubs/join-or-create` | `JoinOrCreateHubIP` | IP | ID derived from caller IP (FNV-1a) | Unknown paths return 404; other handler errors return 503 — **except** `errAdminUnauthorized`, which `CheckAdminAuth` has already rendered as a 401 @@ -105,43 +101,47 @@ creating. join-or-create: concurrent calls always return the same hub instance. `GetHubById` / `RemoveHubById` wrap the underlying `HubStorage`. - **`hub.Hub`** (pkg/hub) owns one hub's peers. `AddPeer` assigns a monotonic - numeric ID from an `atomic.Uint64` counter, marshals the join signal **before** - registering the peer in `PeerStorage` (so a marshal failure is a no-op — no - storage entry, no broadcast, no half-registered peer), then stores the peer, - broadcasts a `PeerJoinedMessage` to other peers, and sends the new peer a - `HubInfoMessage`. `RemovePeerById` is **idempotent**: it first checks the - peer exists in `PeerStorage` and returns `false` without broadcasting - anything when it is missing, so a duplicate removal cannot double-send the - `PeerDisconnectedMessage` or double-trigger hub removal. For a present peer - it deletes the peer, broadcasts a `PeerDisconnectedMessage`, and returns - `true` when the hub is now empty (unless the hub is permanent). - `SendOfferToPeer` / `SendAnswerToPeer` relay SDP to the target peer. - `HandleMessage` is the per-socket read loop. + numeric ID from an `atomic.Uint64` counter, marshals the join signal + **before** registering the peer in `PeerStorage` (so a marshal failure is a + no-op — no storage entry, no broadcast, no half-registered peer), then + stores the peer, broadcasts a `PeerJoinedMessage` to other peers, and sends + the new peer a `HubInfoMessage` (roster excludes the new peer itself). A + `closing` atomic flag set under the peer-mutation lock prevents a racing + join from registering into a hub that is being deleted. `RemovePeerIfLast` + atomically removes the peer and, when it was the last member, deletes the + hub from `HubStorage` — all under the peer-mutation lock so a concurrent + `AddPeer` cannot observe a half-empty hub. It is idempotent: a missing peer + is a no-op. Permanent (never-expire) hubs are never deleted. + `SendOfferToPeer` / `SendAnswerToPeer` / `SendIceCandidateToPeer` relay + frames to the target peer via a shared `sendToPeer` helper. `HandleMessage` + is the per-socket read loop. - **`peer.Peer`** (pkg/peer) wraps a `fasthttp/websocket` connection plus metadata; it is guarded by a `sync.Mutex`. `NewPeer` has no ID until `AddPeer` sets one. **Hub teardown** happens in two places inside `handler.Upgrade`: the socket's -close handler (`peer.Close()` + `RemovePeerById` → `zh.RemoveHubById` when the -hub empties), and a fallback right after `hub.HandleMessage` returns (fires -only when the read loop exited before the close handler ran, e.g. a read -error). Both paths are safe to race because `RemovePeerById` is idempotent — -the second call sees the missing peer, broadcasts nothing, and returns -`false`. Permanent hubs never expire. +close handler (`peer.Close()` + `RemovePeerIfLast`), and a fallback right after +`hub.HandleMessage` returns (fires only when the read loop exited before the +close handler ran, e.g. a read error or idle-timeout close). Both paths are +safe to race because `RemovePeerIfLast` is idempotent — a missing peer is a +no-op. The upgrade callback also starts a keepalive goroutine that sends +periodic WebSocket pings (interval = idleTimeout / 4) and closes the socket +when `idleTimeout` elapses without a pong, reaping half-open connections. +Inbound frames are capped at `config.WSMaxFrameSize` via `ws.SetReadLimit`. **Upgrade-failure cleanup** plugs an orphaned-hub leak. `Upgrade` reports a failed connection two ways: a non-nil error (a real handshake error) or -`responseWritten=true` (the up-front `peerMetadata` rejection that already -wrote a `400`). `AddPeer` only runs inside the upgrade callback, so whenever -`Upgrade` does not fully succeed, no peer was added for this request and the -hub is empty. `CreateHubByID` and `JoinOrCreateHubByID` therefore call -`zh.RemoveHubById` on that hub immediately, so a failed handshake (or a -rejected `peerMetadata`) cannot leave an empty hub squatting in the registry -forever — an unbounded leak on memory storage. `JoinOrCreateHubByID` removes -the hub only when this call created it, because a pre-existing hub may hold -live peers; `JoinHub` never creates a hub and has nothing to clean up. When -`responseWritten` is true the already-written `400` is not overwritten by a -`500`. +`responseWritten=true` (the up-front `peerMetadata` size/JSON rejection that +already wrote a 413/400). `AddPeer` only runs inside the upgrade callback, so +whenever `Upgrade` does not fully succeed, no peer was added for this request +and the hub is empty. `CreateHubByID` and `JoinOrCreateHubByID` therefore call +the shared `finishUpgradeFailure` helper with a rollback that removes the hub +via `zh.RemoveHubById`, so a failed handshake (or a rejected `peerMetadata`) +cannot leave an empty hub squatting in the registry. `JoinOrCreateHubByID` +removes the hub only when this call created it (the `created` flag from +`GetOrCreateHub`), because a pre-existing hub may hold live peers; `JoinHub` +never creates a hub and passes a nil rollback. When `responseWritten` is true +the already-written 4xx is not overwritten by a 500. ## Pluggable storage @@ -157,20 +157,23 @@ unknown value. ## Rate limiting & proxy trust -`Serve` wraps the request handler in a `ulule/limiter/v3` fasthttp middleware -at **60 requests/minute**. The limiter is keyed by: +`Serve` wraps the request handler in an **in-package token-bucket rate +limiter** (`handler/ratelimit.go`, no external dependency) at +**60 requests/minute** per key. The limiter is keyed by: -- the **socket peer address** (`ctx.RemoteAddr()`) by default — unspoofable; or +- the **socket peer address** (`ctx.RemoteAddr()`, IP:port) by default — + unspoofable; or - the **outermost `X-Forwarded-For` IP** when `APP_TRUST_PROXY` is set. -`APP_TRUST_PROXY` must only be enabled behind a reverse proxy that strips or -replaces `X-Forwarded-For`/`X-Real-IP`; otherwise a client could forge the -header to defeat the per-client DoS throttle. The key getter and the -limiter's own IP parsing must agree (see `remoteAddrKey` / -`forwardedIPKey` / `ipFromForwardedHeader`). The same `clientIP()` helper is -also used to derive the hub ID for IP-keyed hubs (`JoinOrCreateHubIP`), so -behind a trusted proxy the IP-hub ID tracks the real client IP rather than -the proxy's socket address. +Idle keys are swept every 32 seconds after a 2-minute inactivity TTL so the +bucket map cannot grow unbounded. `APP_TRUST_PROXY` must only be enabled behind +a reverse proxy that strips or replaces `X-Forwarded-For`/`X-Real-IP`; +otherwise a client could forge the header to defeat the per-client DoS +throttle. The limiter key (`remoteAddrKey` / `forwardedIPKey`) is +**intentionally different** from `clientIP()` (IP-only, port dropped), which +derives the hub ID for IP-keyed hubs: the limiter keys per-connection +(IP:port), while IP hubs key per-client-IP so all connections from one IP +share a hub. ## Input validation & CORS @@ -178,13 +181,17 @@ Before any WebSocket upgrade the handler rejects malformed query params with `400` (once upgraded, no HTTP status can be sent): - **Hub ID** — `validHubId` requires a non-empty, non-whitespace `id`; a - missing/empty ID is rejected up front instead of silently creating a junk - hub under the empty-string key. The check is a no-op for server-generated - IDs (uuid for random hubs, xxh3 hash for IP hubs). + missing/empty ID is rejected up front with 400 instead of silently creating + a junk hub under the empty-string key. The check is a no-op for + server-generated IDs (uuid for random hubs, FNV-1a hash for IP hubs). +- **Size caps** — `validMetadataSize` rejects any `id`, `hubMetadata`, or + `peerMetadata` query param exceeding `config.MaxMetadataSize` with a 413, + before the JSON shape is checked (oversized values would otherwise be stored + and re-broadcast O(N) across the hub). - **Metadata JSON** — `validJSONQueryParam` rejects a `hubMetadata` / - `peerMetadata` query param that is not valid JSON. Malformed metadata would - otherwise be stored and re-broadcast to every peer, where a client that - `JSON.parse`s it would crash its message dispatcher. + `peerMetadata` query param that is not valid JSON with a 400. Malformed + metadata would otherwise be stored and re-broadcast to every peer, where a + client that `JSON.parse`s it would crash its message dispatcher. `/v1/status` is a public, read-only health/migration endpoint, so it answers with a static `Access-Control-Allow-Origin: *` plus `Vary: Origin` — a @@ -201,7 +208,7 @@ the endpoint is open to all origins anyway). The exposed data plain `!=` comparison would leave open. On failure it writes a 401 JSON body and returns `errAdminUnauthorized`; callers must treat a non-nil error as a hard stop (no state mutation after failure). It guards - `/v1/admin/migrate` and `/v1/permanent-hubs/create`. + `/v1/admin/migrate` and `/v1/static-hubs/create`. - **Zero-downtime migration** (`Migrate` + `ForwardMigrate`): an admin call to `/v1/admin/migrate?host=` validates the host with `validateBackupHost` (a bare `host` or `host:port` — no scheme, `//`, @@ -209,18 +216,28 @@ the endpoint is open to all origins anyway). The exposed data `400` without touching state, so a typo or an attacker holding `APP_CLIENT_SECRET` cannot redirect every client to a garbage or malicious host), then sets `backupHost` (under `migrateMu`) and atomically flips - `isMigrating`. While migrating, create/join-or-create requests are rejected - with `ForwardMigrate`, which upgrades the connection and sends a WebSocket - *going-away* close (code 1001) whose reason is the backup host. The - client's `reconnect` reads that reason and reconnects to the new host; - existing sessions drain naturally. The two fields are kept consistent as a + `isMigrating`. While migrating, WebSocket create/join-or-create requests are + rejected with `ForwardMigrate`, which upgrades the connection and sends a + WebSocket *going-away* close (code 1001) whose reason is the backup host. + The client's `reconnect` reads that reason and reconnects to the new host; + existing sessions drain naturally. Plain-HTTP endpoints (`GetHub`, + `CreateStaticHub`) instead answer a 301 with the backup host via + `migrateHTTPResponse` (an upgrade attempt would surface a 503 to a + non-WebSocket client). The two fields are kept consistent as a unit: `isMigrating` implies `backupHost != ""`. ## Failure behavior - Per-socket errors in `HandleMessage` are logged and end the read loop; the - close handler then tears down the peer/hub. + close handler or post-loop fallback then tears down the peer via + `RemovePeerIfLast`. - The fasthttp server enforces `MaxRequestBodySize` and the WebSocket upgrader - applies `HandshakeTimeout` and read/write buffer sizes from - `config` consts. -- The upgrader's `CheckOrigin` accepts all origins (`return true`). + applies `HandshakeTimeout`, read/write buffer sizes, and a per-frame + `SetReadLimit` (`config.WSMaxFrameSize`) that caps inbound binary frames to + prevent OOM from a single oversized frame. +- The upgrader's `CheckOrigin` uses `sameOriginOrAllowed`: requests with no + Origin (non-browser clients) or whose Origin host matches the request Host + are always accepted; additionally, any origin listed in the + comma-separated `APP_ALLOWED_ORIGINS` env var is allowed, and a wildcard + `*` in that list accepts all origins (ZeroHub is intentionally operated as + a public signaling server).