diff --git a/openwiki/.claims/architecture/overview.json b/openwiki/.claims/architecture/overview.json index 0c472c9..c945ebe 100644 --- a/openwiki/.claims/architecture/overview.json +++ b/openwiki/.claims/architecture/overview.json @@ -1,18 +1,18 @@ { "schemaVersion": 1, - "pageVersion": "sha256:0806d508634e9230e866fd53d01d49e2b1cc389c54f606cd68e9a88650a38ca7", + "pageVersion": "sha256:e9db173c388e72be8c0b253d786fe2b53fa5d7f314a263fe701e47e187481398", "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, and 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 former 'permanent' mode was merged into the never-expiring static mode.", "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", - "version": "repo-lines-v1:sha256:de30767efb3115fe6498da80ed9a06712ef6a3e029bb7f939055017c649009fc:eyJzZWxlY3RlZExpbmVDb3VudCI6OSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYmZmNWRiMTQwMjQxYWVhY2Y5MGNiMmU4ZTM2NzhhZTQ1MTIwYWZmNmZiODM5NWUwYzNkMmVmY2MwNTdjNjE3ZCIsIm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jMWMxNDlhZmJmNGM4OTk2ZmI5MjQyN2FlNDFlNDY0OWI5MzRjYTQ5NTk5MWI3ODUyYjg1NSJ9" } ] }, @@ -31,8 +31,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:eyJzZWxlY3RlZExpbmVDb3VudCI6NTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVlMTJiNjExODk0M2UzMGMwMDY4MzNlNzgxNjMwYTUzYjMyZjQxN2VmNWY5Nzk1YzNmMTJmMzMwODAyNGM1ZDkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjMzMzYyNWQwMzMxMjJmODNhMzQwMTlhODIwMmE5N2Y1MTBmODY2ZWJjYzAwNWY3YzEyMDQyMGY2YzI1ZmZlMDYifQ" + "resource": "repo://client/src/const.ts#L43-L43", + "version": "repo-lines-v1:sha256:be7a4b59f31f5eb4b033b4dce9a8aef6dba7d9b1fcb53acc40bef78c066a1a96:eyJzZWxlY3RlZExpbmVDb3VudCI6MSwiZmlyc3RTZWxlY3RlZExpbm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NzRlYWVkYWQ0ZDI5ZWYyYmUyIiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MywiZm9sbG93aW5nQ29udGV4dEhhc2giOiI2NzhmZWEzMGEzMjM1ZDI0OTIyNTgxODFiN2U4M2QwMjI3NGJjODkxMjEwMmJiYWFlYjUwMWI1NWNkOWE4ZWJhIn0" } ] }, @@ -41,8 +45,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:d33adcb3c4e73afa73f1bb759ba76426f5d59d436c2ebdf0790d85e6ab4c7743:eyJzZWxlY3RlZExpbmVDb3VudCI6MzgsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijc3MjdiMzdhYmJhNjRhOTZlMTJkNmUxODIyNGNkMjJlM2M2ZGI4OWNjMmZlZThmMjI1MzhkM2VhNzkyZDIxYjgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjhjMzZlY2Y2NmY3ODE0YWNjOWRjODE2OGE2ZDVjNWMwY2E2ZjhlMDAzODdiNzRiMjcyZTZlNzg1NTQzNzcwNzgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjAwZjFmMjEyNzYxMjFhY2UyNzJjNmYwNGM2NTU1ZDE2ZmUxYzk2YWVjNTRlMmI1YmY1YmUyZTExZGU0ZWRkNTcifQ" + "resource": "repo://server/pkg/hub/hub.go#L99-L171", + "version": "repo-lines-v1:sha256:f26e757f59106578f4cd70f5aeeae01afefe70d76a9a54f34fe534f63b7b274c:eyJzZWxlY3RlZExpbmVDb3VudCI6NzMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjJiMTQ5NDZhZDNiODJmNmJlMjE1NTg0MDRhNWY3MTQ2YTM4YTE3ZDRmNzUwZWQzZGZmNzI4Nzk3YTY4YWRhODkiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjM3NTQ5MjYyZjJiYjUyYTNhMmNhMTVlZWE5YzM0ZDk0MDVkMzUwOTBiOGI3NWZlODM1ZjlmMjZlNDkxZTliODkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImRhZmJlZTkxNzJmODJjMjg3MDI3Y2U3ZTcyMTc4YmNhOTU5ZjA4YWUwNDIwNTMyNDRkYjU5YmE1Y2Q0MDY1ODMifQ" } ] }, @@ -71,46 +75,42 @@ "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:eyJzZWxlY3RlZExpbmVDb3VudCI6MjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ1MDFkN2I2Zjc0YzY2N2JiYmU0Zjg4Nzg0MzVkNWI1NzRjYzA5NGVjNjE3MGExYzc0Yj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IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjRjZTc4ZmRiNWUwODRkNmY5MWQ3YjFjNWE5ZTRiYjBlZTcxZTkzOTM1NDFmZTBhMDM5MWZmODY3ZTEzNzEyOWYifQ" } ] }, { "id": "claim_96c053cdb46a4bee82188877cdd6cbb6", - "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.", + "statement": "Hub creation on the Go server is performed through the atomic CreateHubIfAbsent primitive on zerohub.ZeroHub (run under a cross-mode collision lock), 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:eyJzZWxlY3RlZExpbmVDb3VudCI6MTksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjIwZTEyZDYxOWIxOTc0ZTEyNmFhYzNhZmUzODhiMzA2MDZhZjMwYzhiYjYzNjI1OGI3ZGFlYWJlMDIzYWRmMzciLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMjMyMjc0YTk2ZjhjZGE2YTI1MTQyMTZmNDc0NTFkZGQ0NGMyOWIzYmVlYWY1YmNkMjFlYzQ3ZjNhYTgyYjIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImM4ODMwY2NhZDJiMjMxNmVjNDQ2ZGUyMmZlM2VjNTgxYjVlY2M4NjMxMjMxZTUyZjg0MDc5NGFjYWU2MWExMDkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVkNzA3YjJjZDU0OWMzZDliOTJjOGY2NTQ4NTc5YzM4NWQ1MTBmN2Q1NTNmM2EzMzdlNDg1MjRhYmMzMjI0NzYifQ" + "resource": "repo://server/pkg/handler/claim_hub_for_create.go#L17-L41", + "version": "repo-lines-v1:sha256:0df50966e728cd57dee498be7041584b96ca0552697e3f1393b4bfc57eacbf54:eyJzZWxlY3RlZExpbmVDb3VudCI6MjUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImRiOGYyYzQ3NjI5ZDk4NGMyNDllZTc4YTc4OGMwZWFmZWFlODBhNGQ1Njg5NzkzZGY1OTFiNjk0YWE2YTAwZmEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOTY0OGFlNWQ0M2EyYmY4Y2Q2MzQ3ZjgyNjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjdkZDRhMWY1NTMwNzMxYzQzNmYzNmFkMWZjZDMwMDFhMDI3MzVjNThkYTYwMDllMTYzMDQ2YTMwODMzYWNmZjYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoyLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjY4OWIwODJmZTUwMmNjYzllMjhiOTg4OGNkNzg4NWExMTk5ODgyMWMwMjQ2NmY2NDc2YWQwZjk3ZTRlNTJhMWUifQ" }, { - "resource": "repo://server/pkg/zerohub/zerohub.go#L83-L98", - "version": "repo-lines-v1:sha256:02fd3ec40b9bbcd4ef64aafdd235afa2ee1bd3b27d30b78a21538a3b6aec51b1:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVmMjhhYTM5YTQwZDQxOTFhNWE2YjE4Y2Q3NzZiZmZmYmY3ZGY0MzYzZTRkN2VhMzIyM2EyYjJkZ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bmdDb250ZXh0SGFzaCI6Ijc0ZjI1ZWI1ZmQ4YzVlYjg3MWE3MWFmMjZjNDk2NmNlYWYxM2EzZDkyYmY3NTY3N2YwNGJhYzhmNWE0YzRjOTUifQ" } ] }, { "id": "claim_2c43b5311acc47ee9d484447edca9b51", - "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.", + "statement": "The Go signaling server validates hub-endpoint query parameters before the WebSocket handshake via the shared validateHubCreateParams helper: a missing/empty/whitespace id or non-JSON hubMetadata is rejected with HTTP 400 and an oversized id/hubMetadata with 413; peerMetadata is size- and shape-checked at Upgrade. An empty-id request can no longer create a junk hub under the empty-string key and oversized or 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:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgwYzM2N2Y3YTU3NTFiNWMwZDM4OThhZjJkNzM5MzljMDBlMTdiM2UwNzU5N2NkNDEzY2M5MDNkOWY1YjAzYmUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjM2ZTQyZmRlOGIwZWI5ZGUwOGY2YTgzODBiYWIzNjg4OWUwNjllYTRiOTk0MDkyODk2OWQ0MjRmODcxNWMwMjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjlmMmRjNTA3MDU4YmEzN2NiOWM4ODVjOWJjZTA2OTUxNzc1Njc0NWE4MGI1YTc2NzhlYTg1MTEwNmFjMTY2ODcifQ" - }, - { - "resource": "repo://server/pkg/handler/validation.go#L18-L28", - "version": "repo-lines-v1:sha256:17ed46d7eb0a346ccd2209e7fa37cfff2b083f3f39a628388e06da9d96d1ff60:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjEzZjc3OGQ2ZjllZTY2NjY3MmFkMTg2ODhlYjFjMDIyMDI1MzQ1OTViZDQ1ODY2ZWNjNjE1MTA3NDBlYjk3ZWQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjAzODVmZDNjMTFmODFlOTA1Yzg2MmRmODZjNDc2YjFlNDE4Yzc1MDViNzIzOTVmYjBlYTAwODZjYTk0MzBkY2YiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + "resource": "repo://server/pkg/handler/validation.go#L79-L113", + "version": "repo-lines-v1:sha256:fe3a5f349af90f44bdbb749e4d8d78828ef7ca2c30dce2f7d1285982907cced2:eyJzZWxlY3RlZExpbmVDb3VudCI6MzUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImYzZmRkOTQyMWQ2NjQ2YTI2YzFhNmEyZmRlMmVlNWVlNGE0ZWQ2YTg5MDkxZWRiMTliM2JlMW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xsb3dpbmdDb250ZXh0SGFzaCI6IjkwMzI4Zjk3OTVhMjkzYTI4NGNkNTczYTc3ZDRmNTAxMmIzZmM2MzExZDA2OTY4YzlhMDU0NDQxNzNmMmU3YzAifQ" + "resource": "repo://server/pkg/handler/websocket.go#L80-L105", + "version": "repo-lines-v1:sha256:ce602dd435b9d480f7b710706f3c4f8ea0f4c2f4633a8f4ad38168add19a7f08:eyJzZWxlY3RlZExpbmVDb3VudCI6MjYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQwMTcyMTkzNTU1YmExZjAwMjhhNzllZTZhZjc2N2UwNzUxZTdlYTk2OWQ1NDYzZTE1MDhiYzJlNWJkNmI5OWMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOTY0OGFlNWQ0M2EyYmY4Y2Q2MzQ3ZjgyNjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImFiZGMwNGY2Mzc4NGNlYzM0ZWM3MTk2ODYyZGQwYTIwZGYxNjgyNzAxNGM4Mzg4NTUxYTA4OTUzMzk1OTI0MWQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjA5NGIxOGE0OWNlZmYyNTFmZWYzMzgyYTE3MWUyZDQ2MTcxM2E4NWE5NjFlMTZkN2FkZjY4NGI4MjQyMmMwM2MifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T15:09:12.940Z" } } diff --git a/openwiki/.claims/architecture/signaling-protocol.json b/openwiki/.claims/architecture/signaling-protocol.json index 9341db0..b9c1bfb 100644 --- a/openwiki/.claims/architecture/signaling-protocol.json +++ b/openwiki/.claims/architecture/signaling-protocol.json @@ -1,14 +1,14 @@ { "schemaVersion": 1, - "pageVersion": "sha256:fcebf6ee6c88427db464195a4f7993cbff73e8fd1b71f794f5cfff68621cd711", + "pageVersion": "sha256:d163eb51d54a69283dc907799e29306ae58efe22135e7574246485a18ebbe7a3", "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). The orphaned update_peer_metadata_message variant was 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#L35-L44", + "version": "repo-lines-v1:sha256:ad8f2360991730cf1ccff93868afd8a41f431c1685950348fac36d476939657b:eyJzZWxlY3RlZExpbmVDb3VudCI6MTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjEwMGE2ZjA4Mzk3YWVlZGE2MzJkODZiM2Q5ODI4OTJhODI0Yjk0ZmYxY2JjNWY1MTliNDlhOGRhN2I0NDc4OWYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjMyMzMzNDE2NTg0NjBkODYyMzQ3ZGI2YTdkNTA5NGJkZDFmYjU3ZWUxMjFiZGY4ZjEyM2Q3YTc4M2UzMTNlZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, @@ -24,65 +24,77 @@ }, { "id": "claim_cd9255bb1caf4d07ac07cf885713f8d2", - "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.", + "statement": "The server hub routes a client SendOfferMessage to the named answer peer and a SendAnswerMessage to the named offer peer (and SendIceCandidateMessage to its target peer, warning on self-targeted frames); the server relays SDP verbatim without inspecting its content.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L197-L205", - "version": "repo-lines-v1:sha256:beb81b1fc7ef696140e333cc04fed6aac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h0SGFzaCI6IjFjOWE5MjY4NGI4Zjc1MzM0MjdkOGM4NzhiOTdjYzNkY2ZiM2M0OGU3MjUwYzViYTMwYjMyZTY3MTIzODZhYzgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjRjZTc4ZmRiNWUwODRkNmY5MWQ3YjFjNWE5ZTRiYjBlZTcxZTkzOTM1NDFmZTBhMDM5MWZmODY3ZTEzNzEyOWYifQ" } ] }, { "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": "ICE candidates are individually signaled (trickle ICE): the shared armSendOnIceReady helper used by sendOffer/sendAnswer forwards every onicecandidate candidate via sendIceCandidateToWebsocket (including candidates arriving after the SDP went out), flushes the SDP on the gathering-complete event or as a fallback after the waitIceCandidatesTimeout timer (default 2000 ms), and uses a single isSent guard so the SDP itself is sent exactly once.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L901-L956", - "version": "repo-lines-v1:sha256:3aa9667674eaa2dc2a2f7eb92e754b88d071fa93ba677f8a394e05691213924a:eyJzZWxlY3RlZExpbmVDb3VudCI6NTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVlMTJiNjExODk0M2UzMGMwMDY4MzNlNzgxNjMwYTUzYjMyZjQxN2VmNWY5Nzk1YzNmMTJmMzMwODAyNGM1ZDkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjMzMzYyNWQwMzMxMjJmODNhMzQwMTlhODIwMmE5N2Y1MTBmODY2ZWJjYzAwNWY3YzEyMDQyMGY2YzI1ZmZlMDYifQ" + "resource": "repo://client/src/const.ts#L43-L43", + "version": "repo-lines-v1:sha256:be7a4b59f31f5eb4b033b4dce9a8aef6dba7d9b1fcb53acc40bef78c066a1a96:eyJzZWxlY3RlZExpbmVDb3VudCI6MSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYmU3YTRiNTlmMzFmNWViNGIwMzNiNGRjZTlhOGFlZjZkYmE3ZDliMWZjYjUzYWNjNDBiZWY3OGMwNjZhMWE5NiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiYmU3YTRiNTlmMzFmNWViNGIwMzNiNGRjZTlhOGFlZjZkYmE3ZDliMWZjYjUzYWNjNDBiZWY3OGMwNjZhMWE5NiIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiYTc5ZTllYTYyNjIxNTQ3MjFmNjU0NGZiODEzMWZmY2Q5Y2VkZDBlNzc3Y2M3YjcyNzI4M2JhOThjMGM0ZmRlZiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiMzEyNzI2Y2QxZjYzZGJlM2MwOGI2NmU2Nzg4MmQ5ZTgwYWVkODllNzZlMmFjYTQ5MmMxZDRkMmRlMDQ5M2NkZCJ9" + }, + { + "resource": "repo://client/src/zeroHub.ts#L1656-L1762", + "version": "repo-lines-v1:sha256:ef8eaba0fa647878eac16ce1becb992e19cc99022ac730a130f7b605dad872ec:eyJzZWxlY3RlZExpbmVDb3VudCI6MTA3LCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiI0ZjJhMmY5OTZmMDhlNjgwYmQyOTIxMzVhNmZhNDk3OGJkYTI2ZTYwMmQ4NGYzM2NiMWQ1OTQ3NzVkNDMwNGI1IiwibGFzdFNlbGVjdGVkTGluZUhhc2giOiIyN2U1Nzg4ZDVkOWQ3M2QyNGE4MWRiYzBhNWE3NGJmYTgyYzljM2IzYWY5OWU1MmFmNzk2ZTkwYjQ2OGE4YTNkIiwicHJlY2VkaW5nQ29udGV4dExpbmVDb3VudCI6MywicHJlY2VkaW5nQ29udGV4dEhhc2giOiIxZGIzZTdjZDBjM2E2MjMwNDc2NjgxNjFkMTA0ZTk5ZDg2MjA5Y2EzZTc3NTRhMjViMTE5YTQ5MDc4NzgwNDI2IiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MywiZm9sbG93aW5nQ29udGV4dEhhc2giOiIzMzM2MjVkMDMzMTIyZjgzYTM0MDE5YTgyMDJhOTdmNTEwZjg2NmViY2MwMDVmN2MxMjA0MjBmNmMyNWZmZTA2In0" } ] }, { "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 and P2P-recovery timers, 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:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRM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0MTdhNWIzM2U3NzdiOTk0OTlkYTllODAiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6Ijk3ZDg2MzJlNTRlOTI5OGFiYjk1ODcyN2UyZDUxNDA4YWJhZjEzNjYwMzUzNzkxMDE0MGFiZjY1YjMwYWI2MTMifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L544-L553", - "version": "repo-lines-v1:sha256:babeb49a75469fd0f7c1fc3f02dde3b0cc4ce112558d3fdaf264aecf10941290:eyJzZWxlY3RlZExpbmVDb3VudCI6MTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhjMzg5NGNkMTg2NDFlMDY3ODY3Mzk5YjRhMmQ1ZTNkNDgyZDNlNjgwZDMwN2QxMTkwNTk3MDkyM2NjNGE2MTQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImE2YWE3ZDZiMjA1NDM3MmZjMTQzNmFmMWJmYjU4ODExMjcyMzUxMDFkODEwMzBiNGRiMmUyZTBjNGU5YzdkNjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVhYzc4YjEzZGFmZTY5ZTNhZDcxODk3NmU3OTUzNTAzODYwYzJmYThkM2I5NzE2YzRlMWVlYWM5OGRmYjg4NjcifQ" + "resource": "repo://client/src/zeroHub.ts#L973-L997", + "version": "repo-lines-v1:sha256:ae26bd61cee6dcf0fdbb8e1ef65640e86f6c3c77a3b5e9c41108806175848652:eyJzZWxlY3RlZExpbmVDb3VudCI6MjUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhjMzg5NGNkMTg2NDFlMDY3ODY3Mzk5YjRhMmQ1ZTNkNDgyZDNlNjgwZDMwN2QxMTkwNTk3MDkyM2NjNGE2MTQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImE2YWE3ZDZiMjA1NDM3MmZjMTQzNmFmMWJmYjU4ODExMjcyMzUxMDFkODEwMzBiNGRiMmUyZTBjNGU5YzdkNjIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjliNTMwODY4ZTVjYWM3MDdlYjNmNTkxOGM3NGI3ODI0OTljYjdiZmEwOTFmMjZlOTlkMTY3OWE5YzJlZDM2ZDQifQ" } ] }, { "id": "claim_af1687183859403b8088b23626e9132e", - "statement": "hub.HandleMessage's read loop terminates on read errors, non-binary frames, or protobuf unmarshal failures, and exits with the peer torn down.", + "statement": "hub.HandleMessage's read loop terminates on read errors, non-binary frames, or protobuf unmarshal failures (logging the exit error); after it returns, the WebSocket upgrade path closes the peer and runs RemovePeerIfLast to tear the peer down.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L167-L182", - "version": "repo-lines-v1:sha256:4bfb6a380f4176f34716968934a3a6c044e8f2a81e31f02feb6e6448e61e86ba:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImEzMjI0ZGNlMTc0YzZmMGMxNmE3ZjNhOGMzOTY0ZDZmYTY3ZWU2NWFjODUxYzIyMTkwYTNhMThhMTk3N2JiMjQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliMGIxNGM3ODczOWU3NzE2Y2YxNz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JlMGNiYmVkOWZlYWNkYTJmZGEifQ" + }, + { + "resource": "repo://server/pkg/hub/hub.go#L303-L353", + "version": "repo-lines-v1:sha256:1d35b9bdb0e34b2193c1115006bbee902eb8aaa75ccfbaafbc9ce5081c574cb8:eyJzZWxlY3RlZExpbmVDb3VudCI6NTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImMwMGY5NDgxZGIwZTBlYmFkYzY5MDg3ZWQ3NjA4MTQ2N2I1ZGEyZjY0NDU5ZTc5NjFhMDIzYjQ5NTdkMmZhNDQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImYyYjBhZTk3Y2ZkNTI5YWQzMjIxYTYwYmEwMmIyM2EwZGU1Y2ViYTg5ZDkxMTJjNTg5NWVlNzdkNmMwODQ5YTUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, { "id": "claim_0c33f71cabdc4671a4bfda00589c427d", - "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.", + "statement": "When autoAnswer is false the incoming offerMessage is surfaced to the application through the onOffer callback (peer in AnswerPending, guarded on the peer still existing in the peers map) 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, same guard) and the application calls acceptAnswer(peer.id, answerSdp). 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:eyJzZWxlY3RlZExpbmVDb3VudCI6MjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVlNzExMjdmN2Y1ZjE3MTdiOTZlN2U5NzY5MGE3ZDE4MWE1MDcyMzdmY2FkMTg4NDBiYmIwOTM0MDIyYTkyMGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImIzNDQ0OTEwOGY5MjQ2Mzc3NzU3YmM4M2JhYWNmYjI1YjMyZGVhNGIyZDFhMzk5ZWMwYzIyNjhlZTYyY2E1ZjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA3N2NjNWQyYTVkNDIwZTExZjNiN2Q2MThlOGI5NjkxNzE2MmZhN2JjNWE3ZTk4NmZjZmZhZDY2MjYzZDQ5NjYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjdiMTYyNWY2OGFiOWFmZmQyNDVhMzNmMzQ1Y2NkZjY1MDQzYTYzYWY0ZjdjOGViZjVlMDVlYzI0ZmJiNjc1ZjUifQ" + "resource": "repo://client/src/zeroHub.ts#L1656-L1762", + "version": "repo-lines-v1:sha256:ef8eaba0fa647878eac16ce1becb992e19cc99022ac730a130f7b605dad872ec:eyJzZWxlY3RlZExpbmVDb3VudCI6MTA3LCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiI0ZjJhMmY5OTZmMDhlNjgwYmQyOTIxMzVhNmZhNDk3OGJkYTI2ZTYwMmQ4NGYzM2NiMWQ1OTQ3NzVkNDMwNGI1IiwibGFzdFNlbGVjdGVkTGluZUhhc2giOiIyN2U1Nzg4ZDVkOWQ3M2QyNGE4MWRiYzBhNWE3NGJmYTgyYzljM2IzYWY5OWU1MmFmNzk2ZTkwYjQ2OGE4YTNkIiwicHJlY2VkaW5nQ29udGV4dExpbmVDb3VudCI6MywicHJlY2VkaW5nQ29udGV4dEhhc2giOiIxZGIzZTdjZDBjM2E2MjMwNDc2NjgxNjFkMTA0ZTk5ZDg2MjA5Y2EzZTc3NTRhMjViMTE5YTQ5MDc4NzgwNDI2IiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MywiZm9sbG93aW5nQ29udGV4dEhhc2giOiIzMzM2MjVkMDMzMTIyZjgzYTM0MDE5YTgyMDJhOTdmNTEwZjg2NmViY2MwMDVmN2MxMjA0MjBmNmMyNWZmZTA2In0" + }, + { + "resource": "repo://client/src/zeroHub.ts#L248-L266", + "version": "repo-lines-v1:sha256:c1da00f1ddb1d4ac05046285fff6a9b4b7cdf79ac17bf805e0d90ca07e5a930f:eyJzZWxlY3RlZExpbmVDb3VudCI6MTksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjM1NDI5NmQzMmM5ODZhZTcyMDg1ZDYzNWM1MmIzNTk3YTVjNjYxOTY1ZTY1OWMyNjNmNGE0ODQ5NDQyOTIxMmMiLCJsYX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mYzhkOGVlZTRhMzQ5OGZkYjU2MDNiZWI0NWU1Njg2NTRlNmMxYTlkNTE4MmI1MmMxOWE0ZDk1ZGJiMDA3OGQifQ" + "resource": "repo://client/src/zeroHub.ts#L846-L898", + "version": "repo-lines-v1:sha256:db67bd49d635f293dc88e924d7f83470509db9bd37250f8dc7ac32c1a1e957f2:eyJzZWxlY3RlZExpbmVDb3VudCI6NTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImViZjllMDBlNmNkN2ZjNjkwOWU0YjA1ZmE1MGJmNjQzYmYxZDE5NDg1MWNjODg5YzI3ZDdhOTFkN2FmZDdkODYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjdkNTk4YTZkNTZhZDVhY2NiMzg2YTViOTJmOWQ4NTFhYmE5NDRjNWNjZmRlMWM3NTkwZWFmZTQ2ZjNkMGJkMTUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImI2MDUyNWZiOWRmYzQ3MmEzZTUzMjJhYzNhYWNhNTliM2I3Zjg0ZTAzYzZjYTBjNTRlYmI2YTdhMDlhODExNTIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImY0OTllODhhNDBmMjhhOTYxOTg2OTUyOWEzZDZlYmZiZWM5YzMzMTcwOGQ0ODIwOTUyNjQwOWFkMGM0Zjg3MzcifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T15:09:12.940Z" } } diff --git a/openwiki/.claims/operations/development-testing.json b/openwiki/.claims/operations/development-testing.json index 18d8e5c..3e09654 100644 --- a/openwiki/.claims/operations/development-testing.json +++ b/openwiki/.claims/operations/development-testing.json @@ -1,14 +1,18 @@ { "schemaVersion": 1, - "pageVersion": "sha256:51c83b77aea8ca74345876cf4d42f42bf74828ffb21cc22879929437b5054f27", + "pageVersion": "sha256:25aed5e762c87c1ef262de1d2333450a438e198d97d001157b355b083ac2c90d", "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: server-serve/server-serve-2 run the Go server on 8080/8081 (with APP_CLIENT_SECRET=client_secret and APP_ALLOWED_ORIGINS=null), e2e-test kills ports, spawns two servers, runs the test suite, and exits with the Playwright status, and test-all runs server-test + e2e-test + client-test in parallel (-j3).", "evidence": [ { - "resource": "repo://Makefile", - "version": "repo-file-v1:sha256:88e925b14c788e4c2ea098abc8791c1ad186880027ba73f56c3c7d6ff0fcb8ab" + "resource": "repo://Makefile#L53-L64", + "version": "repo-lines-v1:sha256:7f9f3d812e2f4e78d747ee58ac7d51822a170836f025f2e968dca5155d3c9280:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgyMzQwMGY0ZmRiYjM0NWUyMDVhN2NiZjE5OGFmMjkwYTExMzhjYTkzNWM2YzRmNDY5ZDkwODhmMjZjZjc0M2MiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImRjN2JmZmUyOWU2ZjZmMTY3YjZmNmQ0ZTg2ZjNkNTdmNDg4ZjA2OTQ1NmJkYWZjZjc3ZmZkODI1YTg5MGNmMmUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjcyOGNlYWNmMWFmZDQ1OTI1MzY1ZWYwNzc2NDUwNzJhZDBiYjI1YWU4NTM4MGY2NWRmZGYzNzQ1NDNlNjhhMWEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + }, + { + "resource": "repo://Makefile#L7-L7", + "version": "repo-lines-v1:sha256:59bd73896b994db4c07c4da4434a37d5ea597acf4d6e61a782f60cc78861ee23:eyJzZWxlY3RlZExpbmVDb3VudCI6MSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNTliZDczODk2Yjk5NGRiNGMwN2M0ZGE0NDM0YTM3ZDVlYTU5N2FjZjRkNmU2MWE3ODJmNjBjYzc4ODYxZWUyMyIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNTliZDczODk2Yjk5NGRiNGMwN2M0ZGE0NDM0YTM3ZDVlYTU5N2FjZjRkNmU2MWE3ODJmNjBjYzc4ODYxZWUyMyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNWYyMWU3MjVjNzFmZmYyM2NlMzU4OTZlMjAxMTZmN2I2YWM5MTMxZGY5NWY2MmIwMGE0YWNkMDRjODU4NGNlNSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiMDM1NGI2NGE3ZDEzYzdmMmM5ZGFiZmQ0ZDQzY2MzNGUzYzhlYmEwYTM2NWE4MDliNGM1MGI0NGIxMjYyODg1OCJ9" } ] }, @@ -24,21 +28,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 runs the tsc typecheck, build:harness, and the unit-harness esbuild script to produce test/dist/harness.js and test/dist/unit-harness.js; 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" + "resource": "repo://test/package.json#L7-L12", + "version": "repo-lines-v1:sha256:1f7463db41187db93844b0868087f55297f2eda179f9c1ae0664d536fd99801b:eyJzZWxlY3RlZExpbmVDb3VudCI6NiwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMzQ4MzNkNTk0OWMwM2E0MGNhOTUyNDkxNjEwYTY2NTk2NDRiM2FhNDY2MzYyZjc5OTAyMGRiZjE5ODE1NDdkYiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNGQ1Y2QyZmI0ZjNkZjg4NDUxNTI1NWIzOTUyM2YyZjhiNTQ3MmJlZWE5ZjU2NmZmY2EyMDRkYjgwMjU2MTA0MSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiMmFkNTI4ZGJmZmQzNTRkNjhjM2Q3Y2E1MzdhOWZhMDE5N2IzNmY2MDVjM2RiZjIzZWJjNThmZDI2ZjA1ZDYxMSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiM2YxZjE3ZDg5ZmRhNjdhOWQzNzEzZWZmYmM0YjgwMjkxMTc1NWI0Yzc4YWRmZjZlNWRlZDIzODI5ZTlkOGIzNyJ9" } ] }, { "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; workers: 1 is always pinned (locally and on CI) because the specs share two live server processes and zz-migrate.spec.ts latches one of them, and retries is 2 under CI=1 and 0 locally.", "evidence": [ { - "resource": "repo://test/playwright.config.ts", - "version": "repo-file-v1:sha256:a0e5f4efc37af724af8cac7f4d0361ca73b7db18f0ea5844ce679e874d5d6758" + "resource": "repo://test/playwright.config.ts#L3-L24", + "version": "repo-lines-v1:sha256:e8730a06ce6f24cc4f4c81f5ca8fe0ca6e7fdec9b9ed9d82b7b4684c204a1dec:eyJzZWxlY3RlZExpbmVDb3VudCI6MjIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImIyY2VjYjE0NGE0NmY1ZGNmMTJhNjE2OWZjZWVkNzY5NWU4Mjk0YjA5MGRlNzZmMzY2MWNkZDAyNDkzMDAxNDciLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijg4MzA2NzgwMDUyZTA2OTE0NmEyMDc4MDY4N2I3OWVmZjk5MjQ5YTFkOTUyYWRlM2MwYzgzYzA2YTEwM2FlNGUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjoyLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA4ZGYzZTUyNTJhYmI0Y2QzY2Y1MzgwYzY1NzhkMGIwMGMyZGRhNTRmZGEyYmFiOTMxOTllMzE1NGVjZjY0OWQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjBlZjg3M2M1OTUxOGMzNjJkMTg2ZjY1OGYzMGZkNGE5OGMzMWQxYjZmYjE1ODgyOTllMDJmY2VkZDI5ZTk4ODQifQ" } ] }, @@ -58,55 +62,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 joinStaticHub dials /v1/static-hubs/join with the hub id and peerMetadata query params (static-hub create is deliberately not exposed on the SDK and is an admin-gated plain-HTTP endpoint); 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-20T15:09:12.940Z" } } diff --git a/openwiki/.claims/quickstart.json b/openwiki/.claims/quickstart.json index df55196..acca2ff 100644 --- a/openwiki/.claims/quickstart.json +++ b/openwiki/.claims/quickstart.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, - "pageVersion": "sha256:94bd773e020290bf3102e695603cbadb5482c9d2e9e8788017ac64e7c6a9a4b3", + "pageVersion": "sha256:b7b0a5bb668206318b939146dde62f60bf4efec366c71a5366aed2ae07bcc716", "claims": [ { "id": "claim_29b96b61359846dd9149060c8b57d3a3", @@ -8,23 +8,23 @@ "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 public surface is re-exported from client/src/index.ts: the peer module (Peer, PeerStatus), ZeroHubClient, the config consts and types, the topology module, and the logger module (Logger, ZeroHubLogger).", "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 such as createRandomHub or joinRandomHub is called.", "evidence": [ { "resource": "repo://client/src/zeroHub.ts#L190-L230", @@ -37,42 +37,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#L27-L45", + "version": "repo-lines-v1:sha256:d34de20c4cbb0894574fdc50f2b71a2fd616e53d0e917c51088a349bba641e0e:eyJzZWxlY3RlZExpbmVDb3VudCI6MTksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjlmYWJkYTI2NGU5MDhhNDg0NmRmZDlhNDliNGE5ZDA5ZDgzYzY0ODI1ZmZhODY3YzllOTE5MTY5Zjk3NGY0NzgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjgxMjhlMTE0YTBiZjg5YjE4ZmUyODM2Zjc5MzI0ODJmMDJjODc1MTQ5MGVkZDczMmI3ODAzNzdiYzk4NmQ5NjUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjcyNTgxYmMxYzdjNDljOWJiZjI1OTZhNDJmZmQ2MDdkY2NmOWYzMTg1ZDJmNmQ0MjI1ODg3MDAwNDdiOTA4ZWEifQ" + }, + { + "resource": "repo://server/pkg/handler/handler.go#L155-L168", + "version": "repo-lines-v1:sha256:2947573de4270d3c8eacbf28d620c59408701070d5be0820837c238de7e47bf0:eyJzZWxlY3RlZExpbmVDb3VudCI6MTQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZhOWEwMDI2OTVhY2JmNjViMTU3ZDY1NzlmNjQyNzkxYWQ4NDgwMWU3ZGE4MjY2OTU5MzcxMjg5NTA1MzMzMDEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmN2FmODVhOTk1ZWY1YmY3ZWQ5MmIxMGJjOWM4Y2I3ZWJkYjBkZjQ4NzEzYzM0NDg5MjI5ZTBiNjc4OTliMTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImIzNmI0MGIxYTY4YTUzNjJlYTk5ODNlNGM3ZjZjMmQwYWQwMTJhMzc3YWQ5N2I5MTg1Mzc2NDk3NGZlMWFkYjcifQ" } ] }, { "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 server unit tests, the client vitest suite, and the E2E cycle (two live servers), and make server-test, server-serve and server-serve-2 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 a Playwright E2E suite whose plain-TypeScript harness (test/harness/index.ts, bundled to test/dist/harness.js with esbuild) drives the real ZeroHubClient against two live servers, and 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; cd test && npm test type-checks and builds both harnesses via esbuild in pretest before invoking Playwright, and the suite is pinned to workers: 1 (serial) because specs share the two live server processes.", "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-20T15:09:12.940Z" } } diff --git a/openwiki/.claims/subsystems/client-sdk.json b/openwiki/.claims/subsystems/client-sdk.json index b95caa0..5614939 100644 --- a/openwiki/.claims/subsystems/client-sdk.json +++ b/openwiki/.claims/subsystems/client-sdk.json @@ -1,62 +1,52 @@ { "schemaVersion": 1, - "pageVersion": "sha256:50521a05b8c690b969a2f6027245e965d4e08e0b8ca6c066819b62b892bc0ce8", + "pageVersion": "sha256:1d9852ca4b2464a2a66fff67f85b6a16c988b2bbaf85b3d3525633df764d628a", "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 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), resets the same-host retry budget and sweep round, and re-dials.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L288-L380", - "version": "repo-lines-v1:sha256:e652757e5757dce0f9ffe558e27c3c8a2eff0f1c50e19cc1491d09c9bfa7a1b8:eyJzZWxlY3RlZExpbmVDb3VudCI6OTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliY2FlYTFkOGVkZTZhYTJkMmY4MmUyY2IwNDE4Y2UzNjVlMjE1Y2NhMDMxNDExNjg2ZjJhNzZjOGFlOTBkZDAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjM3YWZjMGU3YmY2YTM4NzVkMTk0OTk1Zjg3M2MxYWEyZGFmNmRjNTNhZDdjN2Y1MTZiMmE4ODEwMmRhYjJjYWEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVlYzk4OWIwODdkMDIyMDAzZjc0NDdiYTIyMzU0YWIwYmQ5ZjIzZTk3OWUzN2MxYmEzMTE3ZDJjYjVmYTZiMWIifQ" + "resource": "repo://client/src/zeroHub.ts#L538-L621", + "version": "repo-lines-v1:sha256:a9b3204bb3d3114647cbf6494a66eea38f41280745b86c9047f7407fa478292a:eyJzZWxlY3RlZExpbmVDb3VudCI6ODQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliY2FlYTFkOGVkZTZhYTJkMmY4MmUyY2IwNDE4Y2UzNjVlMjE1Y2NhMDMxNDExNjg2ZjJhNzZjOGFlOTBkZDAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE3OTJmODQ3YmIyMWNiMjkyZGQwOWY3ZmE2ZTdjYWM0YThjMTRkOTdkMzg5NjMzYjNkMTUyMGVhMTRiNWIxZGMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjM3YWZjMGU3YmY2YTM4NzVkMTk0OTk1Zjg3M2MxYWEyZGFmNmRjNTNhZDdjN2Y1MTZiMmE4ODEwMmRhYjJjYWEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImNmZmM5NTEzZmM4ZTY0NjA3MjAzZTBhYzNiODczODQ3OTYwOGU2ZmVkODEwNzcxZDM4NDM3YzRjNjMzMTYwZWYifQ" } ] }, { "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, clears pending ICE and P2P-recovery timers, 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.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L618-L629", + "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:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFkMTExYmQzNTM1ZThmZThmMDg4YjcxZTQ3YjYwNmEyMWE4YmZlZDdiNmJiYThmNWU1MTk0N2ZmMzc1Njc0MDgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNhMzk5OTQxNzMxOTQyN2IyOGU1MWI5YTMxOWFkOWRmOTYxNWY1MjhjZWJlYTA1OGIxM2E2NjQ1NjFmMGE3MTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ2MGQzZDg5Y2ZiN2UxYjU5M2FhNjdhMTEwZDlkODZkYzdkMWFjYWIxZDM0NjRjNTU4YTI2NDE3MDdiNTk0MmIifQ" + "resource": "repo://client/src/zeroHub.ts#L1388-L1425", + "version": "repo-lines-v1:sha256:1c458d9a9b9f8a30f4b18553b19f13ba72e56644542b2d249b1c387a1092b36f:eyJzZWxlY3RlZExpbmVDb3VudCI6MzgsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFkMTExYmQzNTM1ZThmZThmMDg4YjcxZTQ3YjYwNmEyMWE4YmZlZDdiNmJiYThmNWU1MTk0N2ZmMzc1Njc0MDgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjlmZTZmYTE2ZGUzNTg1NDZhODQzNGFjMjBjMWE2M2U5ZjRmMmJkMTEyYzFiODM2MWEzYWMyNThmNjhlMjAwYjkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ2MGQzZDg5Y2ZiN2UxYjU5M2FhNjdhMTEwZDlkODZkYzdkMWFjYWIxZDM0NjRjNTU4YTI2NDE3MDdiNTk0MmIifQ" } ] }, { "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 (normal close) does nothing; 1001 (going away) hands the close reason to reconnect(url, reason) as the migration redirect; 1006/1011/1012/1013 (abnormal closure, internal error, service restart, try-again-later — all transient codes) call reconnect(url) without settling the connect Promise; any other code is a protocol-level failure that fires onZeroHubError and rejects the connect Promise.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L675-L706", - "version": "repo-lines-v1:sha256:cd5d82aa7499e609c1e00e9e4b912fbc672263974b32c44c1394f13388e8500a:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhiZjQ1OThmMmM3ZjNjOWRkZTljYzA3NDFjMDU2YmFiMmRhZmVkZmUyYzUzYTNmYzlhMWJmODhkNjQwMDRmZDgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFkOWUxMjU0NjQyNTU3NmQzZGVhZThjOWI5ZGJmMTI4ZDVkNmRkYWY1ZDdmZTg1NzkzNDkyN2RlZmZhM2I5ZGQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjE4M2M0YjJhYjY3YTdmZGU3ODY4NWUzMTUwODhkMDZhM2QxY2ZjMThlNjBmY2ZlMTVhMzhhZjAzMzk3ZDhkNzQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjI4ZTc1ZjJjNDVkYzYwNDRhNjRiOWY3Y2Y1ODNhZjJkZDNhZjQzODNhOWQxOTZkNDM3M2UwMmRjYWI2ODVkMTMifQ" - } - ] - }, - { - "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.", - "evidence": [ - { - "resource": "repo://client/src/zeroHub.ts#L636-L643", - "version": "repo-lines-v1:sha256:42b1a27675c0d03812bf8552e1ddf4f62d9807d27d0042a3e6efa6e7ef869496:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZTEyMjE3OWE5NTNiZWRkZDY0YTNhYWRjOWE0N2Y4NmQ0NDJhMzQ0N2E0MjhmZjQ1MGE2NTFmOTQwNTA0NjkyZCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNmEzZWMzNTk2NzZkMDNkNmNlMmE3N2YzMDE2NmQyMTFkNDk1MzEyNzU0NjVkMmE0Y2M1NzYyN2M3NDk1ZWUxOSIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiZmY3MjU3NWJmMzllOGQ3YjY2MmM4ZjcxNDIyZjNkMzYwNGE1NmFkNTZhYTE0MTgxM2FjMzkwNmVlZGViOGZiOSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiYjRhZTBlZTQ5MTAxNTU0NDdiOTFkMGY0NGFhMjFmMTYzMjlhM2U1OThkYjA1N2RmMTYxZWRhNDYwNmJjNjIxYiJ9" + "resource": "repo://client/src/zeroHub.ts#L1319-L1368", + "version": "repo-lines-v1:sha256:d36000e1e9fe52d95945f74e83e13d52ef3f579d85b29b1786d35c83bc092c4f:eyJzZWxlY3RlZExpbmVDb3VudCI6NTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRiYzkzNDE1ZmJmYWQ1NjY2OWNkNGE5YmUzYmM1M2RlMTFiYzAzYzkxNGQ1MDMxOTk3ZWFkYmFjZTlhNTk0NDgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZlMzNkYzczMWU3ZDA3YjFmMGMwNWNmZWJkN2UxOTIyMDIzZTYwNzdiYzBhZTdiYTMwMTQ4ZjUwODMzYTI1YTkiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA3MTliNjZhZDMwNDg1MzkwZGE2M2ZiNjgwNzU3YWZjOGNmOWQxZGU1ZGM0NTNiY2IxMGFjMDdjZWQ1NzAzNTciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQ0Mzc1NDg0NGM1MGE1N2VlZDhhNjUyMjJlMTgwOWVkOTE0ZmIyZTc0YWIyZjEwYzE0M2M3ZWJlZjg2ZjMxMTMifQ" } ] }, { "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 (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. P2P drops are recovered only from the SFU side by re-sending an offer; an explicitly configured SFU is never re-elected.", "evidence": [ { - "resource": "repo://client/src/topology/sfuTopology.ts#L121-L166", - "version": "repo-lines-v1:sha256:1b02c3ce70d673c31b965e5a043b94a6adb40ee5561ebc37b8ca03469d7c7daa:eyJzZWxlY3RlZExpbmVDb3VudCI6NDYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVjNTgxNmFkMTY0ODM3ZTI1ODlhZjAwZDE0MmEwMTYyMzI0N2Y0MjQ1ZWYwZjFkNTJiOTJhZmVjMjJlZDYyNGMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjIyNTM2MzA3OGY3NzkzNWM2N2VhNGYxMzVhZDI3NjJiY2I2Mjk2YjRjMTI5YTA4ZjcyODhlMjZiZDc1NmVlMzUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjI3M2RmZWNmMGZmMGE2M2IzYThhMzgzMjMwMWNlZDZlMzNjNGRlMTM2YzhhY2U4Y2U2YzhhNmQ0YmJlMzY5ZDYifQ==" + "resource": "repo://client/src/topology/sfuTopology.ts#L183-L193", + "version": "repo-lines-v1:sha256:778dd7b3661c146e3facf8c67f662266cab6ffd8e4960dc18d98d634fb3512a0:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImYxNjUzMDAyZDYx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jQ5OTRiM2IiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjcwMzAwMjRmMzg2MTg5NjE2ZDBlODE0NTkxY2QwM2Q1ODhhNmYyN2Q4OTk3MzNkNWI3MjQ2OGMzZDI1OTJhZjIifQ==" + "resource": "repo://client/src/topology/sfuTopology.ts#L64-L137", + "version": "repo-lines-v1:sha256:0f24bd273414e0aa111c54b83b3b107e7d27c075f4d4d8ebe7ced10580690192:eyJzZWxlY3RlZExpbmVDb3VudCI6NzQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQxNzQ4NTE3NzAyZTg3NWRkNWUyOWI3YmIwMjdhZjQ4MjI3NjcwY2I4YTQ4OGEyOTc0MGY1ZTlhYTg2OTAwMjUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImJkNWQ4ZjU0MGU2ODE1YzdmMDA1ODA0ZjgwYTYyODM5ZmU5NjlkOTAyOGY1YTcxNGFiOWFkNmYyZjQ5OTRiM2IiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImU0NTI2YTNjODkzOTQ1NjJmNDQ1YjBmNTI3M2M4MjJlMTJjZDY3MTZjOWFmMmE5YWJkNTc4MWU2YTI3YzQxMjIifQ" } ] }, @@ -65,84 +55,76 @@ "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.", "evidence": [ { - "resource": "repo://client/src/topology/meshTopology.ts#L39-L58", - "version": "repo-lines-v1:sha256:8cb59a25800372c46756c4ad610adb293ac2769b386b1d2787557f0448cc78ca:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijg4NmEyMTNkZWMxMzQxODI2MDgyZGJjZDcwZmRlMzc5YjNiNTA3ZWRmZDJlY2ZhMGFmM2ZkYzE2MzVjNzM4OTMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQxNzQ4NTE3NzAyZTg3NWRkNWUyOWI3YmIwMjdhZjQ4MjI3NjcwY2I4YTQ4OGEyOTc0MGY1ZTlhYTg2OTAwMjUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjI3NjBkNzA4NDczNzBjYWU3NWFjNWY1MDFjM2UxMGRmZTJmY2RjNThjMjE0NjI2MmU4ZjA5Nzk0MjFhZDkwYmQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ0ZWIzNmIxMGRlZmU1MTlkMmRkMTRlZmZiNWZmOWE3MzQzZjI5MjczZmE0OTEyODkwZDFiOWQ5ZWViZTNkM2UifQ==" + "resource": "repo://client/src/topology/meshTopology.ts#L54-L69", + "version": "repo-lines-v1:sha256:1ab3bbd354239e5a7d671aca886480c5a7ee271dcd426625bb1c3e61edcd7936:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijg4NmEyMTNkZWMxMzQxODI2MDgyZGJjZDcwZmRlMzc5YjNiNTA3ZWRmZDJlY2ZhMGFmM2ZkYzE2MzVjNzM4OTMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImU2YjA0NDkxNDY5NzIyZTgzNjNhOTRlNDA0NDUzOGUwMTNhMmEyMTdlMzZi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3MTViMDYifQ==" + "resource": "repo://client/src/topology/peerSetup.ts#L25-L115", + "version": "repo-lines-v1:sha256:d2575b83b179c30c09f238bee6c7795f9e8727ce92b0dc710b6b78b4f6f7d81c:eyJzZWxlY3RlZExpbmVDb3VudCI6OTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZhOWRkNTFmNzY3Nzg4MTlhM2Y3ZjcyMTQzNzBiYTFjZmY2MzI1NjJlNDJiMTljYWM1ZjA3ZjdiMmMxMDEyNWMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjUzMjI1NGRjMjFjZjVmZjUzY2I1NWFiOWFiZDY2MjliNDJlZTQ5ZjA2NjM2YjE3Yjc3ZWRkNmI0MGNhNmU4NDgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, { "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": "The default client configuration sets tls:true, logLevel:Warning, logger:console, waitIceCandidatesTimeout:2000, autoAnswer:true, autoAcceptAnswer:true, maxReconnectAttempts:10, maxReconnectRounds:2, reconnectBaseBackoffMs:250, and rtcConfig to Google STUN servers with bundlePolicy 'balanced', all overridable via the Config interface.", "evidence": [ { - "resource": "repo://client/src/const.ts#L32-L41", - "version": "repo-lines-v1:sha256:280e3c166b9bb0de1460b22956b727000ef383f1a4bf8e566549900c7384173e:eyJzZWxlY3RlZExpbmVDb3VudCI6MTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjYyNzg3ZGJiMjQzMGU3ZTg4OGZkNWZiMjgzODdkMDMxMzVkYTc2ODMzNmY5OTc5YTQ1MDQ0ZTg4ZTZhN2VhOGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFhMWQxYTYzMzkwMjI5Yzc5ODM0N2U4M2EwNDA1NDQxYzk0MDAwMzUyODRhZDE2OGMxYmY2Y2RmMWQ3MGEzNzAiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjFjN2NlNjA4MjhkZmY3NjhjYTIwMGQ1YjMyNTk5OGJlMGJjZTU1MjkxYjFkMWViOWE4MDk5ZmY5NTM0MWUwMzkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoxLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIifQ==" + "resource": "repo://client/src/const.ts#L39-L51", + "version": "repo-lines-v1:sha256:e72614d259fb4a38815534354c42033508ac162405fc723b4353d5ac23054b4f:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjYyNzg3ZGJiMjQzMGU3ZTg4OGZkNWZiMjgzODdkMDMxMzVkYTc2ODMzNmY5OTc5YTQ1MDQ0ZTg4ZTZhN2VhOGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImFhMWQxYTYzMzkwMjI5Yzc5ODM0N2U4M2EwNDA1NDQxYzk0MDAwMzUyODRhZDE2OGMxYmY2Y2RmMWQ3MGEzNzAiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjFjN2NlNjA4MjhkZmY3NjhjYTIwMGQ1YjMyNTk5OGJlMGJjZTU1MjkxYjFkMWViOWE4MDk5ZmY5NTM0MWUwMzkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, { "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 when isDisconnected is true, when no WebSocket exists, or when the socket exists but its readyState is not OPEN (a CONNECTING or CLOSING socket) — without that last guard ws.send() would throw a raw InvalidStateError that could escape the calling event handler. A disconnected client must reconnect via a hub entry point (createRandomHub, joinRandomHub, joinStaticHub, or joinOrCreateIPHub) before sending.", "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": "When every configured host's same-host retry budget is spent on every allowed sweep (including the single-configured-host case, where wraparound to itself is not a new host), reconnect() sets the reconnectAbandoned latch and surfaces the terminal failure ALL_HOSTS_EXHAUSTED_ERROR_MESSAGE ('all ZeroHub hosts are not working, please check the ZeroHub hosts') via reportZeroHubError/onZeroHubError; no further automatic retry is attempted, and the latch is cleared only by a fresh entry-point call.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L241-L254", - "version": "repo-lines-v1:sha256:6f5b9af2e9be33eb392a84f7413871721aa94af6149325522300f7f17bc53cbd:eyJzZWxlY3RlZExpbmVDb3VudCI6MTQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjEzZjI2MzM3NmY3YjY4MWMzZmY0NjFhZTA4OGI2OTAwOWJjZjliMjU1NDljMDI0OTE4OTdmZDVmZDM0NGM0NjQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjBlMWVjODE5YTc5MDhhNTAyMzNjNmE2NWNmNDEyMDEwYmZjZTYwYWJmOTkwYTQzODYzOTExNzk2M2I1OWYxZTUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjM0YzgxY2QyOTYwZjllM2RmMDMwOWMyNjNhYmNhZDE5OWEwOTJhMzczOTIxNmQ2YWJhY2FiOGMxZDRhYmFkMTkifQ" + "resource": "repo://client/src/const.ts#L33-L34", + "version": "repo-lines-v1:sha256:e7f20b2b20fd924db37d64df8508b01295e11d46ebe8b8515a1c5a8cafcb8a13:eyJzZWxlY3RlZExpbmVDb3VudCI6MiwiZmly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NTU5MGM0ODlmOWMzNzlmNTI0YjIzNGY2MjdiZSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNWE5MjkzZmQ4MDU0YjZlNDcyNDgzNzNmMzlmNGRkNzc4MDAxMDVlYjc1ODM0ODY4NzI1NDI4NWNkMTI4MmI3OCJ9" + "resource": "repo://client/src/zeroHub.ts#L729-L744", + "version": "repo-lines-v1:sha256:ed96bf7dc3a2ebeec60270ce2f1142e31e1652f2c01a5c48788b4c0e4a0b1107:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImY4Yzg2ZGQzZjJhYjNiMTU1YjgyYmM0NTJkNDkxN2RjYTMxNGY4YTk3ZjYyOTBkMjkxZTNlNTYxZGJlMTRhNGMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI3ZTU3ODhkNWQ5ZDczZDI0YTgxZGJjMGE1YTc0YmZhODJjOWMzYjNhZjk5ZTUyYWY3OTZlOTBiNDY4YThhM2QiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImJlNmYzNjYyYzM3NTJhZDhhODEzNjAzMDMyZmI1NzBjNGNjMTZhYjcyMGYxNjU0OWEzZWU3YWYzMTJmN2QxMTciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjVlYzk4OWIwODdkMDIyMDAzZjc0NDdiYTIyMzU0YWIwYmQ5ZjIzZTk3OWUzN2MxYmEzMTE3ZDJjYjVmYTZiMWIifQ" } ] }, { "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 both delegate to the shared negotiateWithPeer helper, which merges per-call RTC options by spreading into a fresh local object ({ ...config.rtcOfferOptions, ...rtcOfferOptions }) 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:eyJzZWxlY3RlZExpbmVDb3VudCI6NCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNjQ3NTMxNzRlMjFiMzBmMTNmMmNmYjE2NjBjMTIxZjI2YWIxMDJhMjA3MzgxNTIxMTZl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dDb250ZXh0SGFzaCI6Ijg5N2E0ZjVlNGVmNGVlMDU2NTliNjE1ZmNiOTllZGFjODNiYmE0NGU3MzM1MTA0ZGFlNDc1Mzk5YmNiM2JhYWEifQ" } ] }, { "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 (skipping two hosts); all reconnection is handled in onclose. onerror also settles the connect Promise for a dial that failed before it ever opened.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L667-L674", - "version": "repo-lines-v1:sha256:d185ed3dc5fe82df3fb50161baca93df1edb59d081417444306692adbba42bce:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMDc1NzYyOWVlYThjYjYxZjFiODZkZGIyZjVmMDBmYTMxNjJlYTQ1ZGE2NjA5NzdjNTNhMzI4YTliODVhNzg1ZiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiYWQ5ZTEyNTQ2NDI1NTc2ZDNkZWFlOGM5YjlkYmYxMjhkNWQ2ZGRhZjVkN2ZlODU3OTM0OTI3ZGVmZmEzYjlkZCIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiNTcwM2FkMGE1MWI1Yzk4ODE2YTgwOTJkNWFhZjY3MTM4YTVkNmU1MjRmNjgwYjI5MWM3Y2I3NTRlYWM0ZmVkMiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiY2ViMTI1YzA0ZWM0NWQ0MjU0ZmIwOWQzYjMwNDQ0MmE1NzAzNTk2NDNmMTQ3MTcxY2RkYjhkOTgwNzEzYmU1MiJ9" + "resource": "repo://client/src/zeroHub.ts#L1308-L1318", + "version": "repo-lines-v1:sha256:fb832b28237a4323a2780081ef33136358bc8e4fefd1222d33edbcea4540bef4:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjcwYzg4MDEzZTM3YjM0Y2Q3NDAwNjM4YjlmMjIwNjBhNTI3MjM5Zjg5ODBlNjZhMWFiNjFhZWVmMWQwNDU5MzQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZlMzNkYzczMWU3ZDA3YjFmMGMwNWNmZWJkN2UxOTIyMDIzZTYwNzdiYzBhZTdiYTMwMTQ4ZjUwODMzYTI1YTkiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjI4NjI1NTdjMjYzZTllNmVjNzE0MDJmN2ViMDAwMGE0MjEzMjVkZDNjOTAzOGMxNDA4Mjk1NTAxZWJiZDVjMzYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQwYjI1NGMyNzA1MzYwYTViMWU4OTM2MDAxYzVkZThhMjhjMzBmZjAyZGMwMjZkNmE3MTQyMzI3OWYyMTcxOTIifQ" } ] }, { "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 (createRandomHub, joinRandomHub, joinStaticHub, joinOrCreateIPHub) funnel into the private openHubConnection helper, which stores any supplied metadata, builds a URL from getWS(host, tls) with id/hubMetadata/peerMetadata query params as applicable, and calls connectToZeroHub. The former createHub/joinHub/joinOrCreateHub (named-hub) and createPermanentHub/joinPermanentHub entrypoints no longer exist — named hubs are now 'static hubs' whose creation is an admin-gated plain-HTTP endpoint — and joinIPHub was 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:eyJzZWxlY3RlZExpbmVDb3VudCI6MTM3LCJmaXJzdFNlbGVjdGVkTGluZUhhc2giOiJmZ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WFkZTNjIiwiZm9sbG93aW5nQ29udGV4dExpbmVDb3VudCI6MywiZm9sbG93aW5nQ29udGV4dEhhc2giOiIzNzkyOWU5MWUwZjk5YzNlODI1ZGU2OWI0MzVmYjY0ODRkMWIwYTFkZjJmNDY1NjFhYmYxYTI5ZjA0MTg4Yjg4In0" } ] }, @@ -151,8 +133,8 @@ "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.", "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,29 +154,29 @@ }, { "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, wires the connection and ICE state handlers, stores it, and marks it Pending; removePeer clears the peer's pending ICE-candidate and P2P-drop recovery timers, 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.", "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:eyJzZWxlY3RlZExpbmVDb3VudCI6MzMsImZpcnN0U2VsZW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YWQ5YjRhNmRmZmIwNjllODU4ZGM5Y2ZmMmQxOWYxYTUxN2Q1M2YiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjYzNTEwNjYxNzFiMGEzNzA5Yzg1OWM1OTI3MzJjMjVlYThjZmYzM2MxMTNiN2I3ZTdmYjVmYjQxY2Y4OTNkNDMifQ" + "resource": "repo://client/src/zeroHub.ts#L954-L977", + "version": "repo-lines-v1:sha256:6339d931b2da8911e23a9677c47f7a2c5907ee96cf7f081167e37df7bc99759e:eyJzZWxlY3RlZExpbmVDb3VudCI6MjQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjRmMmEyZjk5NmYwOGU2ODBiZDI5MjEzNWE2ZmE0OTc4YmRhMjZlNjAyZDg0ZjMzY2IxZDU5NDc3NWQ0MzA0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ4OTNmNDBlMzc4MWViODk2YzgyZDA0NmEwODA2N2ExMWUzNWNkZjJmMWRmYWYyNmZlYTkwYjhkYjY2NzY0MTMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6Ijk3ZDg2MzJlNTRlOTI5OGFiYjk1ODcyN2UyZDUxNDA4YWJhZjEzNjYwMzUzNzkxMDE0MGFiZjY1YjMwYWI2MTMiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQxNjgzYzY0NGRkY2ZlOTkxNmFiMzlmNTg1Njc3YjUyNDc4M2VmYmY1Y2ViODFhMDE2OTMxNTQwNmJjZDIzNWUifQ" } ] }, { "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 and deliberately accepting non-canonical-but-valid spellings such as uppercase hosts and zero-padded ports); 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.", "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:eyJzZWxlY3RlZExpbmVDb3VudCI6NTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI1OTQyZjc5NGVjYzQ3MDVlMzNlNjRmMGJjZDQxNDVlYzU3MDI3ZjE5YTZiZDhhNDhhZWYzOTFjNDBlY2Q1ZGIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE3OTJmODQ3YmIyMWNiMjkyZGQw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I0NmYxMTljOTYwZTc4MGRmOTc5NGEifQ" } ] }, @@ -203,12 +185,12 @@ "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.", "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:eyJzZWxl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TQxNzMxOTQyN2IyOGU1MWI5YTMxOWFkOWRmOTYxNWY1MjhjZWJlYTA1OGIxM2E2NjQ1NjFmMGE3MTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ2MGQzZDg5Y2ZiN2UxYjU5M2FhNjdhMTEwZDlkODZkYzdkMWFjYWIxZDM0NjRjNTU4YTI2NDE3MDdiNTk0MmIifQ" + "resource": "repo://client/src/zeroHub.ts#L1234-L1239", + "version": "repo-lines-v1:sha256:58c113b17e5fa4e33a20e7d7fdfe7fe5ab391905a6f90b1fca3967a04940738d:eyJzZWxlY3RlZExpbmVDb3VudCI6NiwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZTVhODgxODY1ODhkMzlmY2YyODYxZTUxYWUwNmY5Mzc3ZWVlOWFmZTc0ZTk3ZTJjNTdjMDYwNzhmYTBjZDA1MyIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiMmNlYjA1MGZkZGVlZTY4MTJkM2IwOGJiNjAzNTQwZTU3ZGFhOGJkMTQ5ZDgyNzA3MjkwOTQzZWM4MDYzYmE1MiIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiMGM1MmZlY2NlMWVlOGJjZjEyOGM2ZWM1ZTkxMTZjMTQ0OWI3ZjM3Y2I5YmJkNDMwODQwZjY5MTlkOTFmMmQ1NyIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNjM1MGY1OGM2Zjk5Y2Q4NGVmMWM4NzY0ZTU3NGEyMzg3OWIwMGRhZjg3N2NjMGJiMDczYzM3OGMyYWY3MzAyNyJ9" } ] }, @@ -217,36 +199,38 @@ "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).", "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:eyJzZWxlY3RlZExpbmVDb3VudCI6NDYsIm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hYzJjNDA5ZTIyNmQyMGFmYThmNzczMjM0OGUwZjciLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFkNTlkYzgyNzhlMjU2NDgyZTVmNTIzNGViYzc2MGNhMmQ4OGUzNzI2ODg5Y2YxMDNlNmU2MjcyODBlNjRlZWMifQ" } ] }, { "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 (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.", "evidence": [ { - "resource": "repo://client/src/zeroHub.ts#L148-L176", - "version": "repo-lines-v1:sha256:82232e5ec39333afcdfd0319b8d74fba25ca7b3a9a1af2b10b918426886576d9:eyJzZWxlY3RlZExpbmVDb3VudCI6MjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImVlNzExMjdmN2Y1ZjE3MTdiOTZlN2U5NzY5MGE3ZDE4MWE1MDcyMzdmY2FkMTg4NDBiYmIwOTM0MDIyYTkyMGIiLCJsYXN0U2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zaCI6IjdiMTYyNWY2OGFiOWFmZmQyNDVhMzNmMzQ1Y2NkZjY1MDQzYTYzYWY0ZjdjOGViZjVlMDVlYzI0ZmJiNjc1ZjUifQ" }, { - "resource": "repo://client/src/zeroHub.ts#L464-L499", - "version": "repo-lines-v1:sha256:62bb837f3dd5161b94972df843f1a0a513b9186118340507257b5dea89634f92:eyJzZWxlY3RlZExpbmVDb3VudCI6MzYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjhmMDliMjYxNDlhNzI0Y2E5ZGQ0ODJkOGZhMTc4YThiOGZhMDA0NzAzMjBhOGVlY2Y0YzRlZDU4Njk5ZTExNTAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjliNjJmNjBkODU5MGE1NzljZjQ2ZjhkNjczNzhjNGM1NzJiOTYyY2VjY2RiOTBjN2E1ZjdiNDJiOTYwNzgyYTQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImY5YjkwNTMxZjllOWE2ODFlNDAzZDRlMzk0OGVmZjE0NDM0OTM4ZWFmNGQxNTFmZDdhZjYzMDk0ZjA3Y2M4MGUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImI1YzRjZDNkZWJlZjg5MDc2ZDNmOTU3OWFkNDIzNDcxMTAxYjM4ODY2N2UzMWViOTg2OWMzM2JkOTk4MjE1NzAifQ" + "resource": "repo://client/src/zeroHub.ts#L856-L899", + "version": "repo-lines-v1:sha256:a7f8e1dc97c0724979fd6eddb4596437d2b784a155c2f2fb793a4eaf9caf643a:eyJzZWxlY3RlZExpbmVDb3VudCI6NDQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjkyZGVkNzc1YTRhNjUwYjFhZjYwNjljMmUyMTllOTNmODg1NTBiNzNlNzIxOWFkMWU1ZDFjMWYzNzExNGI0YjciLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijg4MDA1ZDU3MTA2YTM2MmViMDAwZGFmM2RhNDY3NGM4MmI1MThmZjVhMmUyZjY3ZWU4ZTc1N2EzMzNjMmFmNjYiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImQyMDA1MjI4NWFlN2ExNTYzNDM5MTNhM2U0NjIwYjQ1ZDc2OTA0MDhmNTRhZjhlMGRkODY1MzgxODAyYTkwYmYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjNhNmUyNWE0N2EyOWE4NTMyMWNiN2IxYjk0ZDIxNTZlOTNkMzZmODdmNDRjY2QyMGM4ZmMwOTk1YTYxZjVkMGUifQ" + } + ] + }, + { + "id": "claim_cb1d17319f134e2d84b96a4ed0c5feda", + "statement": "connectToZeroHub resets the manual-disconnect flag (isDisconnected = false), cancels any queued same-host retry timer, and clears the reconnectAbandoned latch before dialing, so a client that previously called disconnect() — or whose reconnection was exhausted — can be reused cleanly from any entry point. It deliberately does NOT reset the same-host attempt counter (the budget refills only when a connection is confirmed by hub info) and preserves pending ICE-candidate timeouts so an in-flight offer/answer send survives the reconnect.", + "evidence": [ + { + "resource": "repo://client/src/zeroHub.ts#L1201-L1232", + "version": "repo-lines-v1:sha256:2cd9b789a4617a04c14baca6d98062af4291d3c3ee967e16eb83b94f9f6de6a1:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjlmMzcwZTFkOGE3YjU2OTU3NGNkZjc2Y2I1NDY0OWQzNTcwM2YwNzY4ZjUwM2VlZGRlMGIyNmU1Yjg2MjA0MjIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijg5Njc1MjBiODgxNmU5Yjk4ZGFkMmQyMjU0YzIwZGI3NDBhMGEwZGI3N2JmMzcwMzY1MDk4M2NjOTU3ZWM0YjYiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImI3ZTY5Y2NmZDcwN2MzODY3YzQ2ZWYxYTZmODU5NGIwZGExMDk0YjFmMDE2YTk2MDZlMDViZjJmMGM2MDJiOGUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImI0YWUwZWU0OTEwMTU1NDQ3YjkxZDBmNDRhYTIxZjE2MzI5YTNlNTk4ZGIwNTdkZjE2MWVkYTQ2MDZiYzYyMWIifQ" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T15:09:12.940Z" } } diff --git a/openwiki/.claims/subsystems/server-signaling.json b/openwiki/.claims/subsystems/server-signaling.json index d91bacb..e4c9b9a 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:98cbb4940e4957cfe32aa59d9f472f3125cc4294d346ed1ca1b81fb90f2adb5a", "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 independent ZeroHub instances (zeroHubStatic, zeroHubRandom, zeroHubIP) via a shared newZeroHubOrPanic constructor that panics on 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:eyJzZWxlY3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ZDI2MTA3MjJlZmFkNjA5ZTk1NTJlODU0NzhkOGQ0NDM4YiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiN2EzZjc5YmE2MmYyZTg0NGIxOGM1ZWUzMTBkOGQwZmFkMTIwOGFjMDdiMzNlNjVkZDlkNDg3MzBmMWFjNjllNCJ9" }, { - "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 via godotenv and unmarshaled with go-env; key vars are APP_ENVIRONMENT (default dev), 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:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW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GVkZDczMmI3ODAzNzdiYzk4NmQ5NjUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjcyNTgxYmMxYzdjNDljOWJiZjI1OTZhNDJmZmQ2MDdkY2NmOWYzMTg1ZDJmNmQ0MjI1ODg3MDAwNDdiOTA4ZWEifQ" } ] }, @@ -31,56 +31,68 @@ "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:eyJzZWxlY3RlZExpbmVDb3VudCI6MTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjE5MmQ4ZmQ2NzA0ODBjYTA1MTE4YWFlYzM0YzM0OTg4NTNlY2E5YTY0OGY0NjMxZDUxMmYzNDRhYjNhOWQ1ZjUiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjZiMDU3NTUxMDA4ZDUxNzI2NDYwMjQ1NWIwMGU5YmFlZGIwZjlkZjQ3ZGMwZWFkZGQwODg5OWM1NjNkNmU4N2IiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6Ijc2YjYzMWQ0NGRiYWUyODRjZmI5NTc5MzA5MGU4ZDM1MzVhY2Q5YzBlNDYwN2Y5NzZlNTQ0ODA0NzMxNzFlNDgifQ==" + "resource": "repo://server/pkg/handler/handler.go#L155-L168", + "version": "repo-lines-v1:sha256:2947573de4270d3c8eacbf28d620c59408701070d5be0820837c238de7e47bf0:eyJzZWxlY3RlZExpbmVDb3VudCI6MTQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZhOWEwMDI2OTVhY2JmNjViMTU3ZDY1NzlmNjQyNzkxYWQ4NDgwMWU3ZGE4MjY2OTU5MzcxMjg5NTA1MzMzMDEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmN2FmODVhOTk1ZWY1YmY3ZWQ5MmIxMGJjOWM4Y2I3ZWJkYjBkZjQ4NzEzYzM0NDg5MjI5ZTBiNjc4OTliMTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImIzNmI0MGIxYTY4YTUzNjJlYTk5ODNlNGM3ZjZjMmQwYWQwMTJhMzc3YWQ5N2I5MTg1Mzc2NDk3NGZlMWFkYjcifQ" } ] }, { "id": "claim_c946b125db0f4af0b34cfffeef5d5f23", - "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.", + "statement": "ZeroHub.GetOrCreateHub and CreateHubIfAbsent share the getOrCreateHubLocked read-then-write under a sync.Mutex so concurrent create and join-or-create calls for the same hub ID collapse to a single hub instead of orphaning one; GetOrCreateHub returns a created flag so callers can decide whether rolling the hub back on a failed upgrade is safe.", "evidence": [ { - "resource": "repo://server/pkg/zerohub/zerohub.go#L109-L124", - "version": "repo-lines-v1:sha256:ebd3f7b0a5c85305f8544fa8b90283564ddcb08152dfc3a29174153c880a1791:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2Vs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NmQwZWRlZjc5MjdlYzcwMGRmYTc0MWQ0ZDMxYWJlOTkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImJjZjM0NWZmZjk4YmYwMzRiYWE5MDk0YzgyNjEyOTBkNTU4ZjhmYWUwZGUwOTYwMTlhNWYxMzA0ZjBmMGMzZGMifQ" } ] }, { "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), rejects the join once the hub's closing flag is set, then stores it in PeerStorage, broadcasts a PeerJoinedMessage to the other peers, and sends the new peer a HubInfoMessage.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L70-L107", - "version": "repo-lines-v1:sha256:d33adcb3c4e73afa73f1bb759ba76426f5d59d436c2ebdf0790d85e6ab4c7743:eyJzZWxlY3RlZExpbmVDb3VudCI6MzgsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6Ijc3MjdiMzdhYmJhNjRhOTZlMTJkNmUxODIyNGNkMjJlM2M2ZGI4OWNjMmZlZThmMjI1MzhkM2VhNzkyZDIxYjgiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjhjMzZlY2Y2NmY3ODE0YWNjOWRjODE2OGE2ZDVjNWMwY2E2ZjhlMDAzODdiNzRiMjcyZTZlNzg1NTQzNzcwNzgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjAwZjFmMjEyNzYxMjFhY2UyNzJjNmYwNGM2NTU1ZDE2ZmUxYzk2YWVjNTRlMmI1YmY1YmUyZTExZGU0ZWRkNTcifQ" + "resource": "repo://server/pkg/hub/hub.go#L99-L171", + "version": "repo-lines-v1:sha256:f26e757f59106578f4cd70f5aeeae01afefe70d76a9a54f34fe534f63b7b274c:eyJzZWxlY3RlZExpbmVDb3VudCI6NzMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjJiMTQ5NDZhZDNiODJmNmJlMjE1NTg0MDRhNWY3MTQ2YTM4YTE3ZDRmNzUwZWQzZGZmNzI4Nzk3YTY4YWRhODkiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjM3NTQ5MjYyZjJiYjUyYTNhMmNhMTVlZWE5YzM0ZDk0MDVkMzUwOTBiOGI3NWZlODM1ZjlmMjZlNDkxZTliODkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImRhZmJlZTkxNzJmODJjMjg3MDI3Y2U3ZTcyMTc4YmNhOTU5ZjA4YWUwNDIwNTMyNDRkYjU5YmE1Y2Q0MDY1ODMifQ" } ] }, { "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(peer.GetId(), zh.HubStore())) and a fallback right after hub.HandleMessage returns. Both call the idempotent RemovePeerIfLast, which removes the peer and deletes the hub from storage only when it was the last peer and the hub is not permanent; a duplicate removal is a no-op that broadcasts nothing, so the PeerDisconnectedMessage and hub deletion are never doubled. A keepalive goroutine pings the peer every idleTimeout/4, closes the socket after WSIdleTimeout (60s) of inactivity, and is joined before the upgrade callback returns so fasthttp can safely recycle the hijacked connection.", "evidence": [ { - "resource": "repo://server/pkg/handler/websocket.go#L40-L65", - "version": "repo-lines-v1:sha256:0de8a393816f422eee7dd91accc6f1cd60a4ac1037df9c5b6a40f30099938565:eyJzZWxlY3RlZExpbmVDb3VudCI6MjYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVmMjliYmE4NDFkMWYzOTUyYTVlNTA1YzE5OWVlYjE5MGZiNDQyZTI5MmVhZDdmOGVkMDZjMDg3ODJmNmJiYTMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY0ZWZjNDk0MThkMjZkY2YxMjliMjJhNmFhMjExMDhjZWVjMzc2NzdhMzJkMDhlOWQ1ZmVlMzVkZGE2NmJiOWQiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjA0MzczMzc5OTgyNWFiNGMwNjdkMTc0M2E4YjQxNmMwZDA3MDY0NTA5YzFkNzJjNzNkM2U5ZTUxYTIwOTNjZDEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQ5NTE3YWUwZGE3N2NhZDcyNjg3NjFjZGQ3M2U4NzM0OGZhNTBhMTI5ZDIyOGJlMGNiYmVkOWZlYWNkYTJmZGEifQ" + "resource": "repo://server/pkg/config/consts.go#L22-L35", + "version": "repo-lines-v1:sha256:441239b22399667f13c57c7f83df67211a956721f3abb2bbf69b9cec6af864ba:eyJzZWxlY3RlZExpbmVDb3VudCI6MTQsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZkZDdlNGVjZDBjOTJiOTZhMGRmYzA5ZGEzZjk1NTcyNGFlMWUxNWUwN2Y3NjU4YTk0YmU3YzcyYzljYWM0YjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQ0MWZkMmJmNzAyYWNkMzE5ZDdjNzBhN2RlZDQ3YTIyMTgwNDY2NWE3ZmUyYWQ0YjI1ZWY2OGE1YmRkZGQyZDAiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjQzYzc1MGZkODY3MzYxNzY0MWE5OTYxYjI1MjI4NWM2NzFlMmIzYWI2NTI2NmU5OTA4ZmI5MTUxMmMxMzQxYjkiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjIyYTI4NWY5MjkxYWQ4MGJlODY5NjE2ZTM1ODU3MTQwNzExNDI0OWE4M2UwOTk3MDFmZDZlMGJjNDZlNzA4M2QifQ" }, { - "resource": "repo://server/pkg/hub/hub.go#L106-L109", - "version": "repo-lines-v1:sha256:15265520480f53f84eaf4f5e487468864693bfef626ad8137a4e6bbdd81e7888:eyJzZWxlY3RlZExpbmVDb3VudCI6NCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiYzcxNGFjY2Q1MDllNGJkNmMwYjk1Nzg4NTc4MDE4ZTg0ZWM0OTI4ZmIzOWQzZmI0NDU3YzRlMjg1NTA3MjU0NyIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiZmY2ODY1MDlmNjcxNWFhZjQxY2JiMmQ3MjRiNWI5NzI3NjE5Zjc2YTBkOGEzOWUwMTRiNjE2ODE1YTRiYzA0MCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiMjkxZTg4ZTdlY2YyODkyYjI3NWJmMDgxZTg1OTVjNTFlNTUyMmMyMzZlMTE5YzhkZDBlMWY0YjM2YjJlY2NlNiJ9" + "resource": "repo://server/pkg/handler/websocket.go#L145-L234", + "version": "repo-lines-v1:sha256:143343642877147119e8ebcd2fcc4e5efe1e5eff8e45be88bcd39538858c36aa:eyJzZWxlY3RlZExpbmVDb3VudCI6OTAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI1MDQyMWQ2MjE5YjE3MTVhOGM4ZGMyZDkyZDRhMTZhYmMyNjVjYzQ5ZGYyZWM0YWI4YzI2YjU4MmVkODMyYmQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImI0M2U1ZGI4YjFlMWMxMzhjMDA3YWRhYzE1NGM4YmM2MGNhZDUzNWQ3YjZmOTE1OGNiYjQ2ZTY5YmNiYTEwYjIiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVmMmExYWNjYjFkYjZkYTAzOTdmNjBhMDRiMjdlMjNjNjA4YmY1MGZhYmJhODdhZmUyN2FlYWE5ZjRjNGMxNDgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQ5NTE3YWUwZGE3N2NhZDcyNjg3NjFjZGQ3M2U4NzM0OGZhNTBhMTI5ZDIyOGJlMGNiYmVkOWZlYWNkYTJmZGEifQ" + }, + { + "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 applies an in-package token-bucket rate limiter (rateLimitMiddleware in pkg/handler/ratelimit.go) at 60 requests/minute with continuous refill, answering 429 to excess requests; keys idle longer than 2 minutes are reclaimed by a sweep running at most every 32s. It is keyed by the socket peer address (IP:port, unspoofable) 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 separate clientIP() helper, which drops the port so all connections from one client IP share a hub, 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.", "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:eyJzZWxlY3RlZExpbmVDb3VudCI6NTMsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImIzODA5ZDUyMzI5OTc0MjcyMDMxNTBkZmNkY2VhZWIxNjYwYzM3ZWVjNjE1M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dpbmdDb250ZXh0TGluZUNvdW50IjoxLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEifQ" + }, + { + "resource": "repo://server/pkg/handler/ratelimit.go#L10-L25", + "version": "repo-lines-v1:sha256:707c423dbd277e37948aa356f9bcc92b5b062c7dced667099ae51b6619ea35a4:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImQwZDk4NmIwZGY3ZTljNDdhYTc4MmIwNjYwOTQ2OWJjOGVlY2E0NzYxMmI4MzhjZjgyOWRkYTRiY2RkZDMzMjkiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImZhZmJhMDUyN2MzOTUzYzRiNmUwZTViNTczOWJhODM2MTJmODA1M2JjZGM5NDY2NzMwMTkzY2QxZDU5MGI0MDgiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNmNWM4MTI2OTkyYmRiZjM1MjQyOGM3ODE4N2RmZjQyM2FlMDAxNDc0MTJhYjM3NGJlYjYxYTk0NWQ1OGVkZDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ1NzkxMzAxMjU2NTQ5YjgxNzZjMzE5MTQyOTYxYWJlZjc0NzYxMGI0OGJlYzdhNTQ2NzdjZGEyNGVhMzg3MjcifQ" }, { - "resource": "repo://server/pkg/handler/join_or_create_hub_ip.go#L16-L22", - "version": "repo-lines-v1:sha256:931f7a4a8f3b00bc368d95200ea9249bd69fc104890935a4f567e5c4f950d4d5:eyJzZWxlY3RlZExpbmVDb3VudCI6NywiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMjI3OTNiYmU3MDFjN2Y4YWI0MTFl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bmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, @@ -89,12 +101,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:eyJzZWxlY3RlZExpbmVDb3VudCI6NDIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjZhNzA1ODIxYzNhYjhjZjgyNTBhMmIxZDlhZmY4MzYxMGMxYWFjYmViZmIwNmZiNzM4YzgwZDFiMDMyNTdkYTAiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjQ1NTA2MmViNGM2M2FkNTE5NTI2ODQwNDU5YWZhZjdkNWY1OTM3MTIxYjcxNWRmZmRkMzQ1M2VjYjc5YmU1MzYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoxLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjAxYmE0NzE5YzgwYjZmZTkxMWIwOTFhN2MwNTEyNGI2NGVlZWNlOTY0ZTA5YzA1OGVmOGY5ODA1ZGFjYTU0NmIifQ==" + "resource": "repo://server/pkg/handler/migrate.go#L131-L171", + "version": "repo-lines-v1:sha256:dbbbd4fac8312d1feb73e67668086551b1958a728e14da9dc391754781034878:eyJzZWxlY3RlZExpbmVDb3VudCI6NDEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjIwZDc4NzcwYWMxOTBhNWE2NjQ3ZjIxOWIxMWNiMTlkOGFhY2I4N2NhMDY4N2IyOTRiNDIwNGRlZDczYzk4NzMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6Ijg0M2ZiODZlNTlmNmQzNGRmOWZiZWE5MjM2YzJiY2Y5MTgwYjBmYWQ3MGNjMjYyYWM2NGY5YWEzZTc1ZTVlY2MiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + }, + { + "resource": "repo://server/pkg/handler/migrate.go#L27-L58", + "version": "repo-lines-v1:sha256:25c4fe50355c2b330abb396e45bbb7fe563dcf54345deb8431d94c2beddf775a:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQ4YmFmMmYwYzMzNjMxYTg3MThiZmQ5OTdhOGRkZmJjOTgyYzM2ZTQxOThmOTgwMWIwZTkzZTQyZTZjMWJiMjEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGR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M1ZWYxNDNiYzhjMGMwMTAifQ==" + "resource": "repo://server/pkg/handler/migrate.go#L60-L98", + "version": "repo-lines-v1:sha256:7bf88b7164614246a8b87c3a40cb13f76ca4b4e473bc86d6c9939d974d526310:eyJzZWxlY3RlZExpbmVDb3VudCI6MzksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY5MDRhZDYxMTcwZjY2OTk4MDBmN2Y3MzRkNjQ1OWU0MTg4MzkzNzY1ZWMxMDdjMTIyMTU5Njc0OTAxNGRkZDYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjE2MzFiNmUyY2EwN2Q4YmFmMGViNDRlNzQ5ZGJmNDkwYjM5MmUzYTUzNGVmNjEwMjI3NzExNDZjZGY5YWYxYTIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjFmNGZlMjA3YzY4MjkxOTZkYzkzZjMzMTcxYjlhYTM2Y2IzYTBiNmYzZjUwMWRmMTFmZDAwNjdiZTYxMDAzNTYifQ" } ] }, @@ -104,21 +120,21 @@ "evidence": [ { "resource": "repo://server/pkg/storage/gache.go#L17-L28", - "version": "repo-lines-v1:sha256:9c965382e8ae0c8887680fa7f8dc948ac5e90dc9c824665b71feb760af6f5285:eyJzZWxlY3RlZExpbmVDb3VudCI6MTIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNkYTI1NTZiZjY1YjllMGRkZjAyOGZmYzIzZDI2MGI3MTI0MGEyOTM0ZDg0Y2JiN2E0MmFiODE4Yjg0OTc1ZjUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1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iZmRhMDllOGJiNThjNzY5MjAxZDQifQ" } ] }, { "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 checks PeerStorage.Get(id) first and is a no-op for a missing peer; for a present peer it deletes the entry under the hub's peer-mutation lock, broadcasts the disconnect signal to all other peers, and deletes the hub from the provided hubStorage when the peer was the last one and the hub is not permanent. TestRemovePeerIfLastIdempotent and TestRemovePeerIfLastLastPeerTwice pin this duplicate-teardown behavior.", "evidence": [ { - "resource": "repo://server/pkg/hub/hub.go#L106-L135", - "version": "repo-lines-v1:sha256:cca966e1fff7f1bb8916646f19e93f86630eff51469ab8b1e7444b356f96a320:eyJzZWxlY3RlZExpbmVDb3VudCI6MzAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImM3MTRhY2NkNTA5ZTRiZDZjMGI5NTc4ODU3ODAxOGU4NGVjNDkyOGZiMzlkM2ZiNDQ1N2M0ZTI4NTUwNzI1NDciLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImZmNjg2NTA5ZjY3MTVhYWY0MWNiYjJkNzI0YjViOTcyNzYxOWY3NmEwZDhhMzllMDE0YjYxNjgxNWE0YmMwNDAiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ5OTJjOWM1ZmVkMjkzYTEwNmQyM2E2NmEwMTc1OTI4MzRiMDY0MWNkYTQ2NjY1MWZjMDRmZjI3OGY0NDg4NjcifQ==" + "resource": "repo://server/pkg/hub/hub.go#L181-L249", + "version": "repo-lines-v1:sha256:e8d3750a08fae50073d932a233ef6a8da3ba54eea741a19fcbbf75fb7e761dde:eyJzZWxlY3RlZExpbmVDb3VudCI6NjksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImY3NThmMGQ2MTA1OGM4MjczZjFjZjI4YzY2MjMzZWVmMmZjYmUxYWI0YTQ4YzQ2NWRmYWU3MmMxMzdiNjFmOWUiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImMxNjFmYWM1M2I1NjQ3NDJhMTliMGI2MjcwNDU1YTVlNmQxN2JhYWY3OWFjMzQwMmQxM2U0NjVlZGIwNTRiMDEiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImQ5OTJjOWM1ZmVkMjkzYTEwNmQyM2E2NmEwMTc1OTI4MzRiMDY0MWNkYTQ2NjY1MWZjMDRmZjI3OGY0NDg4NjcifQ" }, { - "resource": "repo://server/pkg/hub/hub_test.go#L148-L184", - "version": "repo-lines-v1:sha256:6548ba734396107b963f998081f9e92761f1ebc4bbb13e8c4094d32acdfb97c8:eyJzZWxlY3RlZExpbmVDb3VudCI6MzcsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjMwZTU2ZjVhZGZlOTg0MTQxOGNkNWIxNzgwNWEzNWYyNjkyYjc2ZmM3YmUwMzNlY2M5YTM1MTUzN2U2ZGZlMmQiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI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mNDU4YTFkNTY0MzVlZDk1M2YwM2E4YWFmNDNjNmE2MDliZWJmYzY5ZmYifQ" } ] }, @@ -137,36 +153,94 @@ "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#L7-L28", + "version": "repo-lines-v1:sha256:c51794d6b07f3deb1a52d71f056a69079608765b0827695d32d048e3a75858b5:eyJzZWxlY3RlZExpbmVDb3VudCI6MjIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjNjNTViMmViMzE4YzRhZTE3OTQxYmVjNjExMjQ3NjA2YWMxZTg1ZWYzZmIyMmJjNzNhMzZhM2E4MTRkZWZiZjMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNmNWM4MTI2OTkyYmRiZjM1MjQyOGM3ODE4N2RmZjQyM2FlMDAxNDc0MTJhYjM3NGJlYjYxYTk0NWQ1OGVkZDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" } ] }, { "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, or the up-front peerMetadata rejection that already wrote a 400/413 with responseWritten=true) AddPeer never ran, so the hub holds no peer for this request and is empty; CreateHubByID and JoinOrCreateHubByID therefore pass a rollback to the shared finishUpgradeFailure epilogue that calls 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/413 is returned as nil instead of being overwritten by a 500.", + "evidence": [ + { + "resource": "repo://server/pkg/handler/create_hub_by_id.go#L8-L39", + "version": "repo-lines-v1:sha256:987c7492681e34c87df59ff2c7ede5a95021575420daff4e01a1264befb3c7b7:eyJzZWxlY3RlZExpbmVDb3VudCI6MzIsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImM5MWY2Y2VhMDM3MmVhMmQyYWIyOTM0MjMzNjY5N2FlZjc2MzNkMzMwZGU2MzYxMDE3OTQ4Y2M1MGI5OGNhZmIiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOTY0OGFlNWQ0M2EyYmY4Y2Q2MzQ3ZjgyNjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNmNWM4MTI2OTkyYmRiZjM1MjQyOGM3ODE4N2RmZjQyM2FlMDAxNDc0MTJhYjM3NGJlYjYxYTk0NWQ1OGVkZDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjUyYjE5MjJjZTExMzUyNGEzOWFkZGM5YzY3ZDBlNzBiZTFjNDdlNzNhODE1OTA0YjA3Y2RhZTc4YzU0NTg5YmEifQ" + }, + { + "resource": "repo://server/pkg/handler/join_or_create_hub_by_id.go#L44-L51", + "version": "repo-lines-v1:sha256:88421d0d7728e22f93d5381a0a4110dc4f7a9648cbf0a9bc9d279b4e07980b3a:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMjRjNWFiMWZkZDM4YWIyNmQxOTE0YmUzZTIxMjhkZTQzMTc1YTMxYTkxZmZlNzlkYjlkZGQ3OTdhMDNmMjJlYSIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiZjY3YjlhOThjZTU4MjAxZWNiZjViNTEwNzk0N2JmMGZlNDIwZDQ5OTQxYTQ1NTI4NTZmNjFjZGI5ODc4ZDU5OCIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNTJiMTkyMmNlMTEzNTI0YTM5YWRkYzljNjdkMGU3MGJlMWM0N2U3M2E4MTU5MDRiMDdjZGFlNzhjNTQ1ODliYSJ9" + }, + { + "resource": "repo://server/pkg/handler/join_or_create_upgrade_failure_test.go#L36-L51", + "version": "repo-lines-v1:sha256:43d758688c30b670b79d6bb331c42c6d15b08ec7a165023a5a5949ed73437ce7:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6ImYzYmY4NWM4NWU4YjBkMmY3MDRhOGIwNThhMWM0MThmNmNiMjAyNzkyOTJjODI1ZTA4ZWI5ZTI1MTM5ZWRkOGMiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6ImY3YjI3NmFkNjRlYmQ1OTU4ZDJhOTdhYWM4YzFhYjQ3ZTI4OTIxMjgyYzdmNGFhYjIyYjMxYjQzZWE2OGQ2NDgiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjMyOGE5MDg1OTUxZmI3ZDlmODdhYzQ4MTFkMjA4MjZhZmQ4NzhjYWFhMWY3M2E1NDExOGJmOWUzZWY1YmQwMzQiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImYyOTY0MDc5YzNjNWM4MTUyMGVmMzNhMmI5ZDJlMTVhMWI4NGQ3MjgwZGI4NTkwZGNkNjU3NDdlM2UwMTJhNDAifQ" + }, + { + "resource": "repo://server/pkg/handler/websocket.go#L247-L265", + "version": "repo-lines-v1:sha256:fe7da2a377544cb54499153052c34cf9b6ed514a1910d1f8c88e189cd02cb423:eyJzZWxlY3RlZExpbmVDb3VudCI6MTksImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjJkMWU3ZmIyZDY3ODA5NjhhMWExMDI1MGUxODdlODhjNmIxNjNjN2Y0NjdkZTBmNzgyMGRiYWZmYmEwYjdjZWYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImQzNmEwMTBkMjNmYmEwY2ZhNzVlZTdlZTA2ZTgwNzFmYmEyZTFiZmVhZjU5MzU0MWVlODFmYjA4ZjIzNjM0ZmUiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + } + ] + }, + { + "id": "claim_4063cb79728f43ad84f353f173038657", + "statement": "The WebSocket upgrader's CheckOrigin (sameOriginOrAllowed) accepts requests with no Origin header, any full Origin value in the APP_ALLOWED_ORIGINS allow-list including the * wildcard (ZeroHub is intentionally operated as a public signaling service and this support must not be removed until the official developer portal ships), and Origins whose host equals the request Host case-insensitively; unparseable Origins are rejected. After the upgrade, ws.SetReadLimit(WSMaxFrameSize) caps inbound frames at 1 MiB so an oversized frame gets a 1009 close instead of exhausting memory.", "evidence": [ { - "resource": "repo://server/pkg/handler/create_hub_by_id.go#L61-L75", - "version": "repo-lines-v1:sha256:3aa3fcae530ce3355e47153679505a20a797e86eec1d697ca9f89b67c46b22fb:eyJzZWxlY3RlZExpbmVDb3VudCI6MTUsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI0YzVhYjFmZGQzOGFiMjZkMTkxNGJlM2UyMTI4ZGU0MzE3NWEzMWE5MWZmZTc5ZGI5ZGRkNzk3YTAzZjIyZWEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOTY0OGFlNWQ0M2EyYmY4Y2Q2MzQ3ZjgyNjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImY2N2I5YTk4Y2U1ODIwMWVjYmY1YjUxMDc5NDdiZjBmZTQyMGQ0OTk0MWE0NTUyODU2ZjYxY2RiOTg3OGQ1OTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjUyYjE5MjJjZTExMzUyNGEzOWFkZGM5YzY3ZDBlNzBiZTFjNDdlNzNhODE1OTA0YjA3Y2RhZTc4YzU0NTg5YmEifQ" + "resource": "repo://server/pkg/config/config.go#L39-L44", + "version": "repo-lines-v1:sha256:c67150ec03f4820a0b7ba2c5b06f20808e73f6697724b3b3563f23a030ad0237:eyJzZWxlY3RlZExpbmVDb3VudCI6NiwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNTUwNTZjNWRlNDRkOGYxOTQ2ZmNmNDk1MzA0MTQ0NDViMzU2OTg0OTZmMDQ0NmQzMmZiN2UzYmQ2MzRmZDlhNSIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiOTQ4NjMzMmM3ZGNiN2JiMGI2Mjc1OGY3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E1OTA0YjA3Y2RhZTc4YzU0NTg5YmEifQ" + "resource": "repo://server/pkg/config/consts.go#L36-L46", + "version": "repo-lines-v1:sha256:e33936044893c8739e0ffc7497fb4a14a01ab1394fcbcd52ab47edb580dfa691:eyJzZWxlY3RlZExpbmVDb3VudCI6MTEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjcyYzU5Mzc0M2VkNTM4M2I0YmJhNzQ5ZGEzNTRjNzY4ZGQ4YTFlNDRiM2Q3ZDI5MTBhMWNhMTNhMzk3ZmZiNjYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjVmZWQyYzVjN2E4OTBjYjU1NzZmN2NmMGFkMDIyNzhmYjIzMTYxZjQ4ZWNmZGFmNDg3OGU3NTg2YTMxODRmOTAiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjVkMDA5OWJhZTdmM2EyOTk4N2I2NWJiOGY3OTMwOTY5MmI0ZjU1NDg2ZDhlNWY4MzkzZDBjYjM5MDg0NDViY2QiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjoxLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImZhZmJhMDUyN2MzOTUzYzRiNmUwZTViNTczOWJhODM2MTJmODA1M2JjZGM5NDY2NzMwMTkzY2QxZDU5MGI0MDgifQ" + }, + { + "resource": "repo://server/pkg/handler/websocket.go#L107-L114", + "version": "repo-lines-v1:sha256:6533ef29a9af0375e34c5465db2791b8b810f986f38789298c38ba70d81efcce:eyJzZWxlY3RlZExpbmVDb3VudCI6OCwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiMDQ1N2YzMTQyZTg3MWUyYTI3ODViZmViNzYwZmEwODcyOWUzZDU3OGU2OTY4YjM1ODBhZWUzYzMwYmUyZmU2NiIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiOWYxMmMxOGJiM2UxOGFlODEzYjEzMTY2M2RkZTAxND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ZWIyYmM3ZDYzZTYifQ" + } + ] + }, + { + "id": "claim_498f6aafbe3d491abad6788579b06ceb", + "statement": "Every user-chosen-hub-ID path (CreateStaticHub, CreateHubByID, JoinOrCreateHubByID) holds h.hubIdCrossModeMu across the shared claimHubForCreate/claimGetOrCreateHub helpers, which probe the sibling hub modes' storage and claim the ID under one lock, answering 409 when a sibling already holds the ID; generated IDs (random UUID, IP FNV hash) also take the lock, but their probe always misses so the guard is a no-op there.", + "evidence": [ + { + "resource": "repo://server/pkg/handler/claim_hub_for_create.go#L13-L43", + "version": "repo-lines-v1:sha256:2976e2b93581e27c3093b88950dcda975c2a9ff63522558e7bf7a0f69bee0b80:eyJzZWxlY3RlZExpbmVDb3VudCI6MzEsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgxMWFhM2FlNmMxOTc1NmM5MDVhZWZiMTQ1OGZlYjg5YjM4MWFjODQ3MmYxMDM2ODZlNDAzZjJkYzMwYTBiZTYiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjQxMmNhMzQ1Y2NmNzViZjljMDgwNmJjZTY5NWJlOGRlODA4Yjc5OTg0MjUxYTdhNTRkMjAyY2Y2MTAxZGQ0NTEiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6IjNmNWM4MTI2OTkyYmRiZjM1MjQyOGM3ODE4N2RmZjQyM2FlMDAxNDc0MTJhYjM3NGJlYjYxYTk0NWQ1OGVkZDIiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjowLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6ImUzYjBjNDQyOThmYzFjMTQ5YWZiZjRjODk5NmZiOTI0MjdhZTQxZTQ2NDliOTM0Y2E0OTU5OTFiNzg1MmI4NTUifQ" + }, + { + "resource": "repo://server/pkg/handler/handler.go#L110-L129", + "version": "repo-lines-v1:sha256:eb603d35be316e68c2f66b0be7ee5f9f24ad5799c574e54264e64085f7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zaCI6IjI1MGM0ZjkxYTU3NGIzNjEyZjAwMWRkNWYyZWNmOGM5MDZkYjliNzFkMGUxMDQ2YzI5NzE1ZWY5ZDc4MzgyNWYiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjRkNzFjNjJlOWRjODBkNDRlMWYxOGM4MjBiMDljMjRlYTEyNmFkZGUzN2VhNDc4M2U3YTZhYzc4YzNjYzE4YzkifQ" + } + ] + }, + { + "id": "claim_d1a45c77e3f6413b9d1f09550465782b", + "statement": "Plain-HTTP requests that arrive while the server is migrating (/v1/static-hubs/create, /v1/status) are answered with a 301 whose body carries {status: migrating, backupHost} via migrateHTTPResponse, because ForwardMigrate requires a WebSocket handshake and would surface a 503 to an out-of-band HTTP client; no hub is created while migrating.", + "evidence": [ + { + "resource": "repo://server/pkg/handler/create_static_hub.go#L24-L32", + "version": "repo-lines-v1:sha256:96542a0f520a019fc7345dd5bb66c7f2ce7e82c14a99f41bfb46193655fe602b:eyJzZWxlY3RlZExpbmVDb3VudCI6OSwiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiNzIzNTlmY2VhMTcwOThiMDZhMDM2MWJkZDA0ZTk1ZmVjNTAxZjNiODVlMmVkMGZlNTNiYzRmMWViNDYyNzUzOCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiMTg2YzU5OWRjMjQzMWRjZTI0ZjcwNmNhNWNiYTFmMjgxZjU5NTk1NzFhZmEwNGMyMWI2ZjU1ZTkyYzUyMGQ4MiIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiZWVhYWZlYjdmNGNiYjVmY2JlNzY1ZDk0OWRhMjc3M2ZiOTMwNTA0M2IzZTM2OTg0MTY2MTk2ZTYyNWRlZGEzOCJ9" }, { - "resource": "repo://server/pkg/handler/join_or_create_hub_by_id.go#L32-L51", - "version": "repo-lines-v1:sha256:1556d9148daf5c51d8b11c094c59abb768d8d43de6c072ed83dd1bd1d9123c5a:eyJzZWxlY3RlZExpbmVDb3VudCI6MjAsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjI0YzVhYjFmZGQzOGFiMjZkMTkxNGJlM2UyMTI4ZGU0MzE3NWEzMWE5MWZmZTc5ZGI5ZGRkNzk3YTAzZjIyZWEiLCJsYXN0U2VsZWN0ZWRMaW5lSGFzaCI6IjY3Y2RhODJkYTYwNjIzOGUwNWU2MjM5OTU2OWM1ZWUwMzk5MzQxOTY0OGFlNWQ0M2EyYmY4Y2Q2MzQ3ZjgyNjMiLCJwcmVjZWRpbmdDb250ZXh0TGluZUNvdW50IjozLCJwcmVjZWRpbmdDb250ZXh0SGFzaCI6ImY2N2I5YTk4Y2U1ODIwMWVjYmY1YjUxMDc5NDdiZjBmZTQyMGQ0OTk0MWE0NTUyODU2ZjYxY2RiOTg3OGQ1OTgiLCJmb2xsb3dpbmdDb250ZXh0TGluZUNvdW50IjozLCJmb2xsb3dpbmdDb250ZXh0SGFzaCI6IjUyYjE5MjJjZTExMzUyNGEzOWFkZGM5YzY3ZDBlNzBiZTFjNDdlNzNhODE1OTA0YjA3Y2RhZTc4YzU0NTg5YmEifQ" + "resource": "repo://server/pkg/handler/migrate.go#L100-L115", + "version": "repo-lines-v1:sha256:e880561d49c330c8f36522e69d69cf9ed1db4ebabd2ea31a4a9047c64cc498cd:eyJzZWxlY3RlZExpbmVDb3VudCI6MTYsImZpcnN0U2VsZWN0ZWRMaW5lSGFzaCI6IjgyZTUzMzVkNmE0NmY2ODY5YWI2MDAxMzY5OGRhNDM4ZGUyOTcyZGM4OWE3MGZlNDI3MzVlY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pbmdDb250ZXh0SGFzaCI6IjkwMzI4Zjk3OTVhMjkzYTI4NGNkNTczYTc3ZDRmNTAxMmIzZmM2MzExZDA2OTY4YzlhMDU0NDQxNzNmMmU3YzAifQ" + "resource": "repo://server/pkg/handler/status.go#L23-L25", + "version": "repo-lines-v1:sha256:276b85bd8f3604af11c17b3f21fcc42f1b827c863e89e685640a3bdbed521764:eyJzZWxlY3RlZExpbmVDb3VudCI6MywiZmlyc3RTZWxlY3RlZExpbmVIYXNoIjoiZjJlZTQxNTgzNzRiNzcyNTliYzg3MTlhZTgxNDUyZTNlNTQ1ZDEyZWNiNzM0Y2M4NDIxNGRhNjliMDBiNDFmZCIsImxhc3RTZWxlY3RlZExpbmVIYXNoIjoiNjdjZGE4MmRhNjA2MjM4ZTA1ZTYyMzk5NTY5YzVlZTAzOTkzNDE5NjQ4YWU1ZDQzYTJiZjhjZDYzNDdmODI2MyIsInByZWNlZGluZ0NvbnRleHRMaW5lQ291bnQiOjMsInByZWNlZGluZ0NvbnRleHRIYXNoIjoiODM5YmMxYzYzNzk3ZWU5OTc3OGU5NTJkMjc3ZWNiOGFjNmZmMTMzOGIwNTM4ZmQxZDlhMmU4YTZkNmVkMGE1MSIsImZvbGxvd2luZ0NvbnRleHRMaW5lQ291bnQiOjMsImZvbGxvd2luZ0NvbnRleHRIYXNoIjoiNGE4ZjEzZGRhZGVmNjgzM2Y5ODhjZThlYTgxNDFkNGNiYTg0OWIzMWJjMTYzNTE2YjM5YjUxNmQyNTg5ZTg5ZCJ9" } ] } ], "verification": { "by": "openwiki/0.6.0", - "at": "2026-10-14T09:24:33.856Z" + "at": "2026-11-20T15:09:12.940Z" } } diff --git a/openwiki/.last-update.json b/openwiki/.last-update.json index 9c03939..57adb03 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-20T19:56:37.091Z", "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..3a279e8 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:e9db173c388e72be8c0b253d786fe2b53fa5d7f314a263fe701e47e187481398", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "ce317b43-7dde-47c1-87e1-938392a159e3", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/architecture/signaling-protocol.md": { - "pageVersion": "sha256:fcebf6ee6c88427db464195a4f7993cbff73e8fd1b71f794f5cfff68621cd711", + "pageVersion": "sha256:d163eb51d54a69283dc907799e29306ae58efe22135e7574246485a18ebbe7a3", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "ce317b43-7dde-47c1-87e1-938392a159e3", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/operations/development-testing.md": { - "pageVersion": "sha256:51c83b77aea8ca74345876cf4d42f42bf74828ffb21cc22879929437b5054f27", + "pageVersion": "sha256:25aed5e762c87c1ef262de1d2333450a438e198d97d001157b355b083ac2c90d", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "ce317b43-7dde-47c1-87e1-938392a159e3", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/quickstart.md": { - "pageVersion": "sha256:94bd773e020290bf3102e695603cbadb5482c9d2e9e8788017ac64e7c6a9a4b3", + "pageVersion": "sha256:b7b0a5bb668206318b939146dde62f60bf4efec366c71a5366aed2ae07bcc716", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "ce317b43-7dde-47c1-87e1-938392a159e3", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/subsystems/client-sdk.md": { - "pageVersion": "sha256:50521a05b8c690b969a2f6027245e965d4e08e0b8ca6c066819b62b892bc0ce8", + "pageVersion": "sha256:1d9852ca4b2464a2a66fff67f85b6a16c988b2bbaf85b3d3525633df764d628a", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "ce317b43-7dde-47c1-87e1-938392a159e3", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" }, "/openwiki/subsystems/server-signaling.md": { - "pageVersion": "sha256:26c75352cfd51f969b3a5ef4af09647a05a9e3ce67ac235b91ce826abd9a8730", + "pageVersion": "sha256:98cbb4940e4957cfe32aa59d9f472f3125cc4294d346ed1ca1b81fb90f2adb5a", "completedBy": "hermes", - "completedRunId": "611e8b51-91e5-4185-b428-8687804d1f17", - "gitHead": "ca4d570d5b17bea0960c3c3e6235f1b825949a78", - "sourceFingerprint": "sha256:980020afce175db8faeb725c817723976b3ae054455eff2f2417dfcbe7525b46" + "completedRunId": "ce317b43-7dde-47c1-87e1-938392a159e3", + "gitHead": "6e8eceda77cd2ea7d3266fa1238293995a65198b", + "sourceFingerprint": "sha256:cecef9b96f8c3b95dcbe4b1e2a57a2eaf7f19501aad3477cbd3377ad79ef8729" } } } diff --git a/openwiki/architecture/overview.md b/openwiki/architecture/overview.md index 4694d62..e5f0e02 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-20T15:09:12.940Z 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,8 @@ 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-b985a45eeefdba7d9abbac00 resource: repo://server/pkg/handler/validation.go - id: openwiki-source-3fcd30e2964f43d36d37064d @@ -27,7 +29,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-20T15:09:12.940Z" } --- # Architecture Overview @@ -45,8 +47,9 @@ 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: a plain-TypeScript harness (bundled with esbuild) + driven by Playwright specs, plus a vitest unit-spec suite that runs the + client SDK in an in-page unit harness, against two live server instances. - **`docs/`** — an Astro-based documentation site. ## The three layers @@ -54,7 +57,7 @@ components plus shared wire-format definitions: ``` Browser / Node client Go signaling server Wire ────────────────────────────────────── ──────────────────────────── ──── -ZeroHubClient ──createHub/joinHub──▶ fasthttp handler ──upgrade──▶ WebSocket +ZeroHubClient ──createRandomHub/joinRandomHub──▶ fasthttp handler ──upgrade──▶ WebSocket │ (HTTP GET, query params) (hub routing) (protobuf) │ │ └── ServerMessage ◀──── hub/peer broadcast ◀┘ @@ -69,26 +72,33 @@ 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 named and never expire, random hubs get a +server-minted uuid, and IP hubs key off the client address. 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` -primitive, so concurrent creates of the same ID collapse to a single hub -(race winners create, the rest get `409`) instead of orphaning one. +A client calls one of the connection entrypoints — `createRandomHub`, +`joinRandomHub`, `joinStaticHub`, or `joinOrCreateIPHub` — each opening a +WebSocket to a mode-typed path (`/v1/random-hubs/create`, +`/v1/random-hubs/join`, `/v1/static-hubs/join`, `/v1/ip-hubs/join-or-create`) +with `id`, `peerMetadata`, and `hubMetadata` as query parameters. (Static hubs +are additionally created out-of-band by an admin over plain HTTP at +`/v1/static-hubs/create` — a JSON response, no WebSocket upgrade.) The handler +authenticates where needed and validates the query params up front via the +shared `validateHubCreateParams` helper — an empty/whitespace `id` or non-JSON +metadata is rejected with `400`, an oversized param with `413` — before the +handshake. It 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 under a cross-mode collision lock, so concurrent +creates of the same ID collapse to a single hub (race winners create, the rest +get `409`) instead of orphaning one. On upgrade (`handler.Upgrade`), the server wraps the socket in a `peer.Peer`, calls `hub.AddPeer`, and starts `hub.HandleMessage` — a read loop @@ -100,7 +110,7 @@ All frames on the WebSocket are protobuf. The server sends `ServerMessage` (oneof: `hub_info_message`, `peer_joined_message`, `peer_disconnected_message`, `offer_message`, `answer_message`, `ice_candidate_message`); the client sends `ClientMessage` (oneof: `send_offer_message`, `send_answer_message`, -`send_ice_candidate_message`, `update_peer_metadata_message`). +`send_ice_candidate_message`). When a peer joins, the hub assigns it a monotonically increasing numeric ID, broadcasts a `PeerJoinedMessage` to existing peers, and sends the newcomer a diff --git a/openwiki/architecture/signaling-protocol.md b/openwiki/architecture/signaling-protocol.md index 89e6faa..2a2a269 100644 --- a/openwiki/architecture/signaling-protocol.md +++ b/openwiki/architecture/signaling-protocol.md @@ -4,18 +4,22 @@ 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 resource: repo://proto/zerohub/v1/client_message.proto - id: openwiki-source-62e06788e589f96b4e0f6c7b resource: repo://proto/zerohub/v1/server_message.proto + - id: openwiki-source-3fcd30e2964f43d36d37064d + resource: repo://server/pkg/handler/websocket.go - 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-20T15:09:12.940Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T15:09:12.940Z --- # Signaling Protocol & Peer Lifecycle @@ -38,8 +42,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` | **ServerMessage (server → client)** @@ -50,7 +53,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` | `Peer` is `{ id, metadata, join_time }` — a string ID plus a JSON-serialized metadata string (the client parses `metadata` with `JSON.parse`). @@ -119,25 +122,27 @@ 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 - `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. -- 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. +`sendOffer`/`sendAnswer` both delegate to the shared private helper +`armSendOnIceReady(peerId, rtcConn, sendOnce)`, which flushes the local SDP +and **trickles individual ICE candidates** to the remote peer: + +- The `onicecandidate` handler forwards **every** candidate to the signaling + socket via `sendIceCandidateToWebsocket` (relayed to the target peer as + `send_ice_candidate_message` → `ice_candidate_message`), including + candidates that arrive after the SDP has already gone out. The first + candidate-bearing event also flushes the SDP immediately. +- The candidate-less `onicecandidate` event (gathering complete) fires the SDP + send exactly once if it has not gone out yet. +- A `setTimeout` of `waitIceCandidatesTimeout` (default **2000 ms**, from + `DEFAULT_CONFIG`) fires as a fallback: if no candidate event has arrived, it + flushes the current SDP anyway so negotiation is not blocked forever. +- All three paths share a single `isSent` guard inside the helper, so the SDP + is sent exactly once even if a candidate event and the timer race; + candidates keep trickling independently after the SDP is out. +- Pending ICE timeout handles are tracked per peer in `iceTimeouts` and + cleared on `disconnect()` and when a peer is torn down via `removePeer()`, + 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 @@ -162,8 +167,9 @@ Beyond the happy path there are three terminal/abnormal states: the status change, 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()`. + ZeroHub WebSocket and tearing down every peer. No peer can be restored + until the client reconnects via `createRandomHub()` / `joinRandomHub()` / + `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..856a3c0 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-20T15:09:12.940Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T15:09:12.940Z --- # Development & Testing @@ -49,13 +49,15 @@ The root `Makefile` is the primary orchestration point. Key targets: | Target | What it does | |---|---| -| `server-serve` | Run the server (`APP_CLIENT_SECRET=client_secret go run ./cmd/server.go`) | +| `server-serve` | Run the server (`APP_CLIENT_SECRET=client_secret APP_ALLOWED_ORIGINS=null go run ./cmd/server.go`) | | `server-serve-2` | Run a second server on `APP_PORT=8081` | | `server-test` | `go test -v ./...` in `server/` | -| `e2e-test` | Kills ports, spawns two servers on 8080/8081, waits, runs `test/`, kills servers | -| `test-all` | `server-test` + `e2e-test` in parallel (`-j3`) | +| `client-typecheck` | `tsc` typecheck in `client/` | +| `client-test` | Runs `client-typecheck`, then the client vitest suite (`npm run test`) | +| `e2e-test` | Kills ports, spawns two servers on 8080/8081, waits, runs `test/`, kills servers, and exits with the Playwright status | +| `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` (the `hub`/`peer` mocks were removed as dead) | | `kill-server` | Kill whatever is LISTENing on 8080/8081 | ## Protobuf regeneration @@ -98,52 +100,59 @@ changes in `pkg/zerohub/zerohub.go`, `pkg/hub/hub.go`, or `pkg/peer/peer.go`. ## 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 whose E2E specs drive a +plain-TypeScript harness (`test/harness/index.ts`, bundled with esbuild to +`test/dist/harness.js`) 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), - `data-channel.spec.ts`, `concurrent.spec.ts`, `disconnect.spec.ts`, - `migrate.spec.ts`, `multihosts.spec.ts`, plus thirteen `unit-*.spec.ts` specs +- **Specs** (`test/tests/`): seven E2E specs — `connect.spec.ts` + (create/join + peer status), `data-channel.spec.ts`, `concurrent.spec.ts`, + `disconnect.spec.ts`, `multihosts.spec.ts`, `static-hub.spec.ts` (out-of-band + admin HTTP create + `joinStaticHub` WebSocket against the live `:8081` backup + server), and `zz-migrate.spec.ts` (named last so its one-way migrate latch on + `:8080` runs after every other spec) — plus 23 `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-manual-answer-handling.spec.ts`, `unit-migration-redirect.spec.ts`, - `unit-permanent-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 - instance-tagged and records `close()` codes, so specs can detect a leaked - or orphaned socket) — no live server or real WebRTC stack required. The - 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 - `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. + `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`, bundled to `test/dist/unit-harness.js`) with a + mocked `RTCPeerConnection` and a `MockWebSocket` installed on `globalThis` + (each mock socket is instance-tagged and records `close()` codes, so specs + can detect a leaked or orphaned socket) — no live server or real WebRTC + stack required. The 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 `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 + static-hub-endpoints spec pins that `joinStaticHub` dials + `/v1/static-hubs/join` with the correct `id`/`peerMetadata` query params + (static-hub create is deliberately NOT on the SDK — it is an admin-gated + plain-HTTP endpoint), 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. -- 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`. + directly. `npm test` triggers `pretest`, which runs the `tsc` typecheck + **and** `build:harness` (`test/dist/harness.js` for the E2E harness) **and** + the unit-harness bundle (`test/dist/unit-harness.js` for the unit specs), + both built via esbuild. Invoking Playwright directly makes the specs fail + with ENOENT on their missing harness bundles. +- The Playwright config runs **serially**: `workers: 1` and + `fullyParallel: false` are always pinned (locally and on CI), with a 10s + per-test timeout on Google Chrome only. `retries` is `2` under `CI=1` and + `0` locally. The suite must stay single-worker because the specs share two + live server processes and `zz-migrate.spec.ts` permanently latches one of + them. - **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. diff --git a/openwiki/quickstart.md b/openwiki/quickstart.md index 8d1c66e..472bade 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-20T15:09:12.940Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T15:09:12.940Z --- # 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 an esbuild-bundled TypeScript harness), 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 | @@ -107,12 +111,16 @@ client.onPeerStatusChange = (peer) => { } }; -// Connect and establish the mesh. -client.createHub('my-hub', { name: 'Alice' }); -// ...or client.joinHub('my-hub', { name: 'Bob' }); +// Connect and establish the mesh: the server generates the hub id, +// which this client learns through onHubInfo. +client.createRandomHub({ name: 'Alice' }); +// ...a second peer joins that hub by its id: +// client.joinRandomHub('', { name: 'Bob' }); ``` -For a second peer, call `joinHub` with the same hub ID. The two clients +For a second peer, call `joinRandomHub` with the hub ID from the first +peer's `onHubInfo` callback (or `joinStaticHub` for a named, never-expires +hub created out-of-band by an admin). The two clients negotiate over the server and establish a direct WebRTC data channel. > Manual SDP handling: set `autoAnswer: false` / `autoAcceptAnswer: false` to @@ -122,8 +130,9 @@ 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 join it by hub ID (`createRandomHub` / + `joinRandomHub` for random hubs, `joinStaticHub` for named, never-expires + hubs, `joinOrCreateIPHub` for IP-keyed hubs). - **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 +145,11 @@ 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 + E2E + client vitest): + `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 - `npx playwright test` directly). +- **Run E2E tests**: `cd test && npm test` (the `pretest` step type-checks and + builds both the E2E harness and the unit-spec harness via esbuild before + invoking Playwright; 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..cf11bea 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-20T15:09:12.940Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T15:09:12.940Z --- # TypeScript Client SDK @@ -44,7 +42,12 @@ signaling server, drives SDP offer/answer negotiation, and hands the resulting - `topology` — the connection strategy (default `MeshTopology`). - `ws` — the active WebSocket (binary `arraybuffer` frames). - `isDisconnected` — manual-disconnect flag. -- `iceTimeouts` — per-peer pending ICE candidate timers. +- `iceTimeouts` — per-peer pending ICE candidate timers; `webRtcRecoveryTimeouts` + — per-peer pending P2P-drop recovery timers. +- Reconnect state: `reconnectAttempts` / `reconnectTimer` (same-host retry + budget and queued timer), `reconnectRound` (wraparound sweep counter), + `isInitialConnection`, `inConfiguredHosts`, `reconnectAbandoned` (terminal + latch set when every host is exhausted; cleared by a new entry-point call). - Callbacks: `onZeroHubError`, `onHubInfo`, `onPeerStatusChange`, `onPeerError`, `onOffer`, `onAnswer`. - `logger` — a `ZeroHubLogger` honoring `logLevel`. @@ -63,27 +66,30 @@ 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 +| `createRandomHub(peerMetadata?, hubMetadata?)` | `/v1/random-hubs/create` | create a random hub with a server-minted uuid | +| `joinRandomHub(hubId, peerMetadata?)` | `/v1/random-hubs/join` | join an existing random hub by id | +| `joinStaticHub(hubId, peerMetadata?)` | `/v1/static-hubs/join` | join a static (never-expires, named) hub; creation is an admin-gated plain-HTTP endpoint (`/v1/static-hubs/create`) deliberately NOT exposed on the SDK, because the browser WebSocket API cannot send the `Authorization` header | +| `joinOrCreateIPHub(peerMetadata?, hubMetadata?)` | `/v1/ip-hubs/join-or-create` | IP-keyed join-or-create; the hub id is derived by the server from the caller's IP | + +All entry points return `Promise` — they resolve when the signaling +WebSocket opens and reject when the connection attempt fails. The older +`createHub`/`joinHub`/`joinOrCreateHub` (named-hub) and +`createPermanentHub`/`joinPermanentHub` entry points no longer exist: named +hubs are now "static hubs" and creating one is not a client-side operation +(browser WebSocket clients cannot carry the admin `Authorization` header). +The `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. +resolve to an IP hub. Use `joinOrCreateIPHub` instead. ## WebSocket lifecycle & message dispatch -`connectToZeroHub(url)`: +`connectToZeroHub(url)` returns a `Promise` that resolves when the +WebSocket opens and rejects on a connection `error` or an abnormal `close`: -- **Resets state** for reuse: sets `isDisconnected = false` and clears - `iceTimeouts`, so a client that previously called `disconnect()` can be - reconnected cleanly. +- **Resets state** for reuse: sets `isDisconnected = false`, cancels any + queued same-host retry timer, and clears the `reconnectAbandoned` latch, so + a client that previously called `disconnect()` — or whose reconnection was + exhausted — can be reused cleanly. - **Tears down a leaked socket**: calls `closeActiveSocket()` to close any socket left open by a previous entry-point call that did not go through `disconnect()`, nulling all handlers before `close(1000)` so the replaced @@ -91,17 +97,24 @@ resolve to an IP hub (the endpoint always returned 404). Use time for a single logical failure) or `onZeroHubError`. - Opens `new WebSocket(url)` with `binaryType = "arraybuffer"`. - `onmessage` — decodes the frame with `ServerMessage.decode(...)` and routes - it through `handleZeroHubMessage`. -- `onerror` — logs and fires `onZeroHubError`, but does **not** reconnect: - per RFC 6455 a network failure fires `error` and then `close` with code - 1006, and reconnecting in both would advance `hostIndex` twice for a single - failure (skipping two hosts). All reconnection happens in `onclose`. + it through `handleZeroHubMessage`. A corrupt frame or a throwing dispatcher + callback is caught, logged, and surfaced via the isolated `onZeroHubError` + path instead of escaping the handler and wedging the receive loop. +- `onerror` — logs and fires `onZeroHubError` (via `reportZeroHubError`, which + isolates a throwing user handler), then rejects the connect Promise for a + dial that failed before it ever opened. It does **not** reconnect: per RFC + 6455 a network failure fires `error` and then `close` with code 1006, and + reconnecting in both would advance `hostIndex` twice for a single failure. + All reconnection happens in `onclose`. - `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` (abnormal / + internal error) and `1012`/`1013` (service restart / try again later — + transient outages, not protocol failures) reconnect without settling the + Promise (the auto-reconnect path owns the outcome); any other code is a + protocol-level failure that fires `onZeroHubError` **and** rejects the + connect Promise. `handleZeroHubMessage` branches on the `ServerMessage` oneof: @@ -139,16 +152,25 @@ 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 + `onconnectionstatechange` (marks `Connected` on `connected`; schedules P2P-drop + recovery on `disconnected`) and `oniceconnectionstatechange` (schedules P2P-drop + recovery on `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 and + P2P-drop recovery timers, 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). +P2P-drop recovery: when a live peer's `RTCPeerConnection` reports +`disconnected`/`failed` while the signaling socket is still up, +`scheduleWebrtcRecovery` defers a re-negotiation (`WEBRTC_RECOVERY_DELAY_MS`, +default 500 ms, so a naturally recovering connection wins the race) and the +topology layer re-offers for that peer — this is what restores a P2P link +after a network blip instead of leaving the data/media channel silent forever. + `safeParseJson(raw, fallback)` (module-level helper) `JSON.parse`s the raw metadata string and returns the parsed value on success, or `fallback` when the input is missing or malformed. The client's private wrapper warns only on @@ -159,52 +181,84 @@ message dispatcher. ## Reconnection with host failover -`reconnect(currentURL, newHost?)`: - -- Returns immediately if `isDisconnected` (manual disconnect). -- If `newHost` is supplied (the 1001 going-away redirect case), 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. +`reconnect(currentURL, newHost?)` runs when an abnormal close occurs (from +`onclose`). It is driven by two budgets, both in `DEFAULT_CONFIG`: +`maxReconnectAttempts` (default 10) same-host re-dials and `maxReconnectRounds` +(default 2) full sweeps over the configured host list, with exponential backoff +starting at `reconnectBaseBackoffMs` (default 250 ms, doubling per attempt via +`reconnectBackoffDelayMs`). + +- Returns immediately if `isDisconnected` is set (manual disconnect) or if the + `reconnectAbandoned` latch is set (the terminal "all hosts exhausted" error + already fired — a later abnormal close on a leftover socket must be a no-op, + not a re-fire or re-dial; only a fresh entry-point call clears the latch). +- **Migration redirect (`newHost` supplied):** the 1001 close *reason* is first + validated as a well-formed host by `isWellFormedHost` (client/src/utils.ts — + a bare hostname or `host:port`, no scheme/path/userinfo, port 0..65535; it + mirrors the server's `validateBackupHost` and deliberately accepts the + non-canonical-but-valid spellings the server emits — uppercase hostnames, + uppercase IPv6 literals, zero-padded ports/octets). Because `1001` is a + generic RFC 6455 code, 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 **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`, points `hostIndex` at the + redirected host when it is in the configured list (tracking + `inConfiguredHosts`), resets the same-host retry budget and the sweep round, + clears the initial-connection phase, and re-dials. +- **Same-host retry:** on a normal abnormal close (no redirect), if the client + has already confirmed a connection at some point (`!isInitialConnection`) and + the current host still has retry budget (`reconnectAttempts < maxAttempts`), + it re-dials the *same* host on a backoff timer (`scheduleSameHostReconnect`). + Same-host retries leave `hostIndex` untouched, preserving the "a single + logical failure advances `hostIndex` exactly once" invariant pinned by + `test/tests/multihosts.spec.ts`. The initial connection (`isInitialConnection`) + skips same-host retry and fails over immediately. +- **Host failover:** when the current host's budget is spent and it is not the + last configured host, `hostIndex` advances to the next configured host, which + gets a fresh retry budget. +- **Wraparound:** when the last configured host's (or a redirected out-of-list + host's) budget is spent and `reconnectRound < maxRounds`, the sweep wraps back + to the first configured host instead of giving up after one pass, so a + transient outage that partially clears mid-sweep recovers. Each host in the + next pass gets a fresh budget; the round advances so the terminal error stays + reachable. +- **Terminal:** when every host's budget is spent on every allowed sweep, the + `reconnectAbandoned` latch is set and the terminal failure + (`ALL_HOSTS_EXHAUSTED_ERROR_MESSAGE` = "all ZeroHub hosts are not working, + please check the ZeroHub hosts") is surfaced through `onZeroHubError` with no + further automatic retry. ## Disconnect & reuse `disconnect()`: 1. Sets `isDisconnected = true`. -2. Clears all pending `iceTimeouts`. +2. Cancels any queued same-host retry timer and resets the sweep round + (`clearReconnectRetryState()` + `reconnectRound = 0`), clears all pending + `iceTimeouts`, and clears all pending `webRtcRecoveryTimeouts`, so no timer + can fire after teardown and dial a stray socket or re-negotiate a dead peer. + (`isInitialConnection` is deliberately *not* reset: a reused client has + already connected once, so a later dial failure is treated as a reconnect, + not an initial failover.) 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. + open by a previous connection entry point.) +4. Transitions every peer to `Disconnected` and tears it down via `removePeer`, + which closes each `RTCPeerConnection`, clears its timers, nulls its state + handlers so a stale ICE event can't call `restartIce()`, and 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. +throws if called while disconnected, when no socket exists, or when the socket +is present but not yet `OPEN` (a `CONNECTING`/`CLOSING` socket) — without that +last guard `ws.send()` would throw a raw `InvalidStateError` that could escape +the calling event handler. ## SDP send/receive @@ -222,20 +276,35 @@ throws if called while disconnected or when no socket exists. - `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 -`this.iceTimeouts[peerId]`. - -ICE timeout handles are tracked in `iceTimeouts[peerId]`; a prior handle is -cleared before arming a new one, and all handles are cleared on disconnect. +`sendOffer` and `sendAnswer` both delegate to the private shared helper +`negotiateWithPeer`, which validates the socket, merges per-call options into a +fresh local object, applies any `rtcConfig`, runs the exchange (create + set +local description for an offer; set remote offer + create answer + set local +for an answer), reports + re-throws exchange failures through `onPeerError`, +and arms the ICE-candidate wait-and-send. Because options are **spread into a +fresh local object** (`{ ...config.rtcOfferOptions, ...rtcOfferOptions }`) +rather than mutated on the shared config, per-call options can never leak into +the stored `config.rtcOfferOptions`. + +`armSendOnIceReady(peerId, rtcConn, sendOnce)` (private, shared by `sendOffer` +and `sendAnswer`) wires the peer's `onicecandidate` handler plus a +`waitIceCandidatesTimeout` fallback so the SDP `sendOnce` is invoked **exactly +once** while ICE candidates keep trickling: + +- Every `onicecandidate` event that carries a candidate is forwarded to the + signaling socket via `sendIceCandidateToWebsocket` (trickle ICE — including + candidates that arrive after the SDP has gone out), and the first such event + also flushes the SDP. The candidate-less event (gathering complete) fires the + SDP send if it has not gone out yet. +- A `setTimeout` of `waitIceCandidatesTimeout` (default 2000 ms) fires as a + fallback: if no candidate event has arrived, it flushes the current SDP + anyway so negotiation is not blocked forever. +- All three paths share a single `isSent` guard, so the SDP itself is sent + exactly once even if a candidate event and the timer race; candidates + continue trickling independently afterward. +- Re-arm clears the prior pending handle for `peerId` (so `disconnect()` cannot + miss it) and records the timer in `this.iceTimeouts[peerId]`; all handles are + cleared on `disconnect()` / `removePeer()`. ## Manual offer/answer handling @@ -265,13 +334,26 @@ Two built-ins: - **`MeshTopology`** (default) — full mesh. On `Pending`, it sets up data channels and media via the shared helpers, then sends the offer **only if - it is the offerer** (`parseInt(peer.id) > parseInt(myPeerId)`). + it is the offerer** (`parseInt(peer.id) > parseInt(myPeerId)`). On + `WebRTCDisconnected` (P2P drop with the signaling socket still alive), the + offerer re-sends an offer over the existing `RTCPeerConnection` — the + renegotiation refreshes the ICE/DTLS transport while the established data + channels and transceivers persist, so no duplicate channels or tracks are + created. - **`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, or "10" would beat "2"). The SFU offers to every client; non-SFU peers only connect to the SFU, so bandwidth scales better - for larger groups at the cost of a single point of failure. + for larger groups at the cost of a single point of failure. When the + implicitly-elected SFU leaves the hub, the topology **re-elects** the + numerically lowest *remaining* peer and rebuilds the star around it + (`reElectSfu`); the `lastElectingSfuId` dedup guard makes duplicate or + delayed departure events for the same departed peer no-ops instead of + running a second election. An explicitly configured SFU + (`new SFUTopology(id)`) is never re-elected — it logs a warning and waits + instead. P2P drops follow the same pattern: only the SFU side re-offers to + the dropped client. Both topologies delegate the per-peer WebRTC wiring to the shared helpers in `client/src/topology/peerSetup.ts` — `setupDataChannel` (offerer creates @@ -298,6 +380,7 @@ Both topologies treat `ZeroHubDisconnected` and `Disconnected` as no-ops. `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`. diff --git a/openwiki/subsystems/server-signaling.md b/openwiki/subsystems/server-signaling.md index 3781385..bbb885d 100644 --- a/openwiki/subsystems/server-signaling.md +++ b/openwiki/subsystems/server-signaling.md @@ -7,22 +7,32 @@ sources: resource: repo://server/cmd/server.go - id: openwiki-source-41f21ee88395963644de9448 resource: repo://server/pkg/config/config.go + - id: openwiki-source-0d6410746f8812b1a6d372ba + resource: repo://server/pkg/config/consts.go - id: openwiki-source-fe532a441d6120850e1025f4 resource: repo://server/pkg/handler/auth.go + - id: openwiki-source-9ef7bf558ea5a77d41c4fa0b + resource: repo://server/pkg/handler/claim_hub_for_create.go - id: openwiki-source-b539b60065144e2cf7f200e7 resource: repo://server/pkg/handler/create_hub_by_id.go + - id: openwiki-source-91c8b5702e75b83f8531a612 + resource: repo://server/pkg/handler/create_static_hub.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-bff77f666959548dd6f06610 + resource: repo://server/pkg/handler/join_or_create_upgrade_failure_test.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-b985a45eeefdba7d9abbac00 + resource: repo://server/pkg/handler/validation.go - id: openwiki-source-3fcd30e2964f43d36d37064d resource: repo://server/pkg/handler/websocket.go - id: openwiki-source-46ad56ef17cb17e8c9ebaae3 @@ -33,10 +43,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-20T15:09:12.940Z" } verified: - by: openwiki/0.6.0 - at: 2026-10-14T09:24:33.856Z + at: 2026-11-20T15:09:12.940Z --- @@ -54,94 +64,119 @@ 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 WebSocket origin allow-list). 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 + failure, so each hub mode has an isolated hub registry and its own peer/expiry semantics. 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. +admin endpoints 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/migration state; 301 + backupHost while migrating | | `/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/random-hubs/create` | `CreateHubRandom` | random | server picks ID | -| `/v1/random-hubs/get` | `GetHub` | random | | +| `/v1/static-hubs/create` | `CreateStaticHub` | static | admin-gated **plain HTTP** (no WebSocket upgrade); never-expires hubs; cross-mode collision-checked | +| `/v1/static-hubs/join` | `JoinHub` | static | | +| `/v1/random-hubs/create` | `CreateHubRandom` | random | server picks a UUID | +| `/v1/random-hubs/get` | `GetHub` | random | metadata only | | `/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/ip-hubs/join-or-create` | `JoinOrCreateHubIP` | IP | hub ID = FNV-1a hash of the client IP | Unknown paths return 404; other handler errors return 503 — **except** `errAdminUnauthorized`, which `CheckAdminAuth` has already rendered as a 401 and which is returned without overwriting the response. -Create/join-or-create handlers that are migration-gated first check -`isMigrating.Load()` and, if migrating, call `ForwardMigrate` instead of -creating. +While `isMigrating` is set, WebSocket create/join-or-create requests are +forwarded via `ForwardMigrate` (a 1001 close carrying the backup host), and +plain-HTTP requests (`/v1/static-hubs/create`, `/v1/status`) instead get a 301 +with `{"status": "migrating", "backupHost": ...}` (`migrateHTTPResponse`). +A `JoinHub` for a hub that does not exist also forwards to the backup host +while migrating. ## Hub & peer lifecycle - **`zerohub.ZeroHub`** (pkg/zerohub) is the hub registry. `CreateHubIfAbsent` - performs the read-then-write under a `sync.Mutex` so concurrent - create calls for the same ID collapse to a single hub: the race winner - creates and the rest receive `ErrHubAlreadyExists` (mapped to `409`), - instead of orphaning one. `GetOrCreateHub` does the same for - join-or-create: concurrent calls always return the same hub instance. - `GetHubById` / `RemoveHubById` wrap the underlying `HubStorage`. + and `GetOrCreateHub` share the atomic `getOrCreateHubLocked` read-then-write + under a `sync.Mutex`, so concurrent create and join-or-create calls for the + same ID collapse to a single hub: the race winner stores it, + `CreateHubIfAbsent` losers get `ErrHubAlreadyExists` (mapped to `409`), and + `GetOrCreateHub` returns the existing instance plus a `created` flag that + callers use to decide whether rolling the hub back on a failed upgrade is + safe. `GetHubById` / `RemoveHubById` wrap the underlying `HubStorage`; + `HubStore()` exposes the storage so the WebSocket teardown path can hand the + hub its own storage to `RemovePeerIfLast`. - **`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. -- **`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. + 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), rejects + joins once the hub's `closing` flag is set (a hub being deleted by + `RemovePeerIfLast` cannot gain a new peer even if the joiner already fetched + the hub object), then stores the peer under the peer-mutation lock, + broadcasts the join signal to the other peers, and sends the new peer a + `HubInfoMessage`. `RemovePeerIfLast(id, hubStorage)` removes the peer and, + **only when that peer was the last member and the hub is not permanent**, + deletes the hub from `hubStorage` — the removal, the emptiness check, and + the hub deletion all happen under the same lock, so a racing join can never + orphan into a just-deleted room. It is idempotent: a missing peer is a no-op + with no broadcast. `SendOfferToPeer`, `SendAnswerToPeer`, and + `SendIceCandidateToPeer` all relay through one shared `sendToPeer` + lookup-and-send helper. `HandleMessage` is the per-socket read loop; it + relays offer/answer/ICE-candidate messages and ignores self-targeted sends. **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()` + `hub.RemovePeerIfLast`), and a fallback right +after `hub.HandleMessage` returns (fires when the read loop exited before the +close handler ran, e.g. a read error). Both paths are safe to race because +`RemovePeerIfLast` is idempotent — the second call sees the missing peer and +broadcasts nothing. A keepalive goroutine pings the peer every +`idleTimeout/4`, closes the socket after `WSIdleTimeout` (60s) of inactivity, +and is joined before the upgrade callback returns so fasthttp can safely +recycle the hijacked connection. **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`. +wrote a `400` for malformed JSON or `413` for an oversized value). `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 route the failure through +the shared `finishUpgradeFailure` epilogue with a rollback that calls +`zh.RemoveHubById` on that hub, 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; when `responseWritten` is true the already-written 400/413 is returned +as nil instead of being overwritten by a 500. `JoinHub` never creates a hub +and passes no rollback. + +## Cross-mode collision guard + +Each hub mode keeps its own `ZeroHub` instance with its own storage and lock, +so a same-mode create is atomic on its own — but a user-chosen ID could still +be claimed concurrently in two different modes, fragmenting the room under +one public ID. Every user-chosen-ID path (`CreateStaticHub`, +`CreateHubByID`, `JoinOrCreateHubByID`) therefore holds +`h.hubIdCrossModeMu` across the shared `claimHubForCreate` / +`claimGetOrCreateHub` helpers, which probe the sibling hub modes' storage and +claim the ID while still under one lock, answering 409 when a sibling already +holds the ID. Generated IDs (random UUID, IP FNV hash) take the lock too, but +their probe always misses and their ID can never collide, so the guard is a +no-op there. The WebSocket upgrade (and any failed-upgrade rollback) happens +**after** the lock is released: the critical section only covers the +hub-identity claim, and the claim stays valid because the stored hub outlives +the lock. ## Pluggable storage @@ -157,34 +192,53 @@ 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** (`rateLimitMiddleware`, pkg/handler/ratelimit.go) at +**60 requests/minute** with continuous refill; excess requests get a 429. +Keys idle longer than 2 minutes are reclaimed by a sweep that runs at most +every 32s, so the per-key map cannot grow unbounded on a long-running server. +The limiter is keyed by: -- the **socket peer address** (`ctx.RemoteAddr()`) by default — unspoofable; or -- the **outermost `X-Forwarded-For` IP** when `APP_TRUST_PROXY` is set. +- the **socket peer address** (`remoteAddrKey`, IP:port) by default — + unspoofable, and each TCP connection gets its own DoS budget; or +- the **outermost `X-Forwarded-For` IP** (`forwardedIPKey`) 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. +header to defeat the per-client DoS throttle. The limiter key is +**deliberately different** from the `clientIP()` helper that derives the hub +ID for IP-keyed hubs (`JoinOrCreateHubIP`): `clientIP` drops the port so all +connections from one client IP share one hub — the same-network grouping IP +hubs exist for — whereas the limiter keeps the port so each socket gets its +own budget. -## Input validation & CORS +## Input validation & origin checks -Before any WebSocket upgrade the handler rejects malformed query params with -`400` (once upgraded, no HTTP status can be sent): +Before any WebSocket upgrade the handler rejects malformed query params +with `400`/`413` (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). + IDs (UUID for random hubs, FNV-1a hash for IP hubs). - **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; `validMetadataSize` + answers an oversized `id`/`hubMetadata`/`peerMetadata` with 413 before the + JSON shape is checked. These values are stored in hub/peer state and + re-broadcast to every peer, so without a cap (4 KiB, `MaxMetadataSize`) a + single oversized value is amplified O(N) across the hub. + +The upgrader's `CheckOrigin` (`sameOriginOrAllowed`) accepts requests with no +`Origin` header (non-browser clients), any `Origin` whose full value is in +the `APP_ALLOWED_ORIGINS` allow-list — including the `*` wildcard — and +Origins whose host equals the request `Host` (case-insensitively); +unparseable Origins are rejected. Wildcard support is required: ZeroHub is +intentionally operated as a public signaling service so frontend developers +can deploy WebRTC apps from any origin, and it must not be removed until the +official developer portal ships. After the upgrade, +`ws.SetReadLimit(WSMaxFrameSize)` (1 MiB) caps inbound frames — an oversized +frame gets a 1009 close instead of being buffered into memory (OOM DoS). `/v1/status` is a public, read-only health/migration endpoint, so it answers with a static `Access-Control-Allow-Origin: *` plus `Vary: Origin` — a @@ -195,13 +249,15 @@ the endpoint is open to all origins anyway). The exposed data ## Admin auth & migration -- **Admin auth** (`CheckAdminAuth`): the `Authorization` header is - base64-decoded and compared against `APP_CLIENT_SECRET` using +- **Admin auth** (`CheckAdminAuth`, pkg/handler/auth.go): the `Authorization` + header is base64-decoded and compared against `APP_CLIENT_SECRET` using `crypto/subtle.ConstantTimeCompare`, which closes the timing side-channel a 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` (auth runs before the + migration check so unauthenticated requests get 401, not a WebSocket close + whose reason is the internal backup host). - **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 +265,22 @@ 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 - unit: `isMigrating` implies `backupHost != ""`. + `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, + while existing sessions drain naturally. Plain-HTTP requests instead get a + 301 with the backup host (`migrateHTTPResponse`), because `ForwardMigrate` + requires a WebSocket handshake and would surface a 503 "websocket + handshake" to an out-of-band HTTP 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. -- 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`). +- The fasthttp server enforces `MaxRequestBodySize` (4 KiB) for plain-HTTP + requests; the WebSocket upgrader applies `HandshakeTimeout` (5s) and + read/write buffer sizes (4 KiB) from config, caps inbound frames at 1 MiB + (`WSMaxFrameSize`), and a liveness probe closes half-open signaling + connections after 60s of silence (see Hub teardown).