Skip to content

armgit / Piik

Public Imported from GitHub
0

Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。

docs(deploy): record access and routing rollout (#63)

AAA320007a12b61
diff --git a/README.md b/README.md
index acf6a9b6..ae20ebb4 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Screener is a private, low-latency screen-sharing project for one game player an
The first measurable Web proof of concept is implemented. A host captures a screen, window, or browser tab and shares a numeric room code. Rooms default to a private fragment invitation whose capability authorizes only one room; a Host may explicitly choose public watching by room code. During a share, the host can change between three ceiling profiles without reopening the source picker: 1080p60 at 8 Mbps, 1080p30 at 5 Mbps, and 720p30 at 3 Mbps. The host can also temporarily pause the picture or switch sources. Rooms are random and temporary by default. A Host-protected deployment can optionally use SQLite-backed room numbers starting at `1`, reusable links, and a waiting state after sharing stops. Default routing gives each viewer an independent direct WebRTC connection; the exact-room controller can instead use bounded peer descendants and LiveKit SFU roots. The default room capacity is eight viewers and deployments may configure 1 through 16, but that admission limit is not a performance promise.
-This is not yet a broadly validated production release. Production runs `89e6d76` with room-scoped Viewer access, bounded SFU diagnostics, and initial-connect recovery; it uses self-hosted STUN-only ordinary ICE plus a separate LiveKit SFU/UDP domain. Real cross-network media, game audio, a sustained 1:8 room, mobile browser lifecycle behavior, and latency targets still require the documented manual test matrix.
+This is not yet a broadly validated production release. Production runs `d4bc421` with room-scoped Viewer access, neutral anonymous entry, initial-connect recovery, and exact-room quality reparenting; it uses self-hosted STUN-only ordinary ICE plus a separate LiveKit SFU/UDP domain. Current source also contains a no-go Native v2 candidate with no production runtime gate. Real cross-network media, game audio, a sustained 1:8 room, mobile browser lifecycle behavior, and latency targets still require the documented manual test matrix.
## Run locally
diff --git a/docs/deployment.md b/docs/deployment.md
index 03620180..af83feab 100644
--- a/docs/deployment.md
+++ b/docs/deployment.md
@@ -14,12 +14,12 @@ current controller's automatic final media fallback. This capacity is dormant un
the peer-assisted experiment, or required STUN discovery. It is configured with
ICE/UDP only; the candidate has no ordinary TURN or media-TCP configuration.
-Production `89e6d7649169` runs this candidate for exact room `1` on the existing
-shared public IP. The immediate `bbe4654a7a9b` code rollback uses the current v2
-database and `HOST_ADMISSION_PASSWORD` environment. Only the deeper pre-access
-`9610032fc5f5` rollback may restore the matching v1 database and old environment.
-Coturn relay also remains rollback-only. This is a bounded production smoke, not
-clean-port or broad-rollout acceptance; the media procedures below still apply.
+Production `d4bc421828c4` runs this candidate for exact room `1` on the existing
+shared public IP. Immediate rollback to `05f98d10ecd1` uses the current v2
+database and environment. Rolling back the admission-policy cutover requires
+`89e6d7649169` plus the environment backup recorded below; only deeper
+pre-access `9610032fc5f5` may restore matching v1 state. Coturn relay remains
+rollback-only. This is a bounded smoke, not broad-rollout acceptance.
## Topology and prerequisites
@@ -286,6 +286,43 @@ bare `systemctl is-active` treated the expected stopped state as an error under
strict shell and caused an immediate healthy rollback; no new application had
failed. The later explicit `ActiveState` sequence completed successfully.
+The admission-policy and anonymous-entry cutover deployed between
+2026-08-20 11:13:42 and 11:13:43 +08 on exact
+`05f98d10ecd174427fc969f3ba2d510f12c74eb3`; its artifact SHA-256 is
+`FF938E8D59428F08B3F162DEA6DCF842A4705A94D3153967814CCE9AD6CBD94D`.
+The full gate passed 25 test files/369 tests before the atomic code/environment
+switch. Health and the built asset returned 200; SQLite v2 with four rooms
+including room `1` and zero Screener/LiveKit restarts were preserved. Chrome
+kept all four anonymous entry routes neutral until authorization; the current admission key returned 200,
+while the former and an incorrect key returned 401. Rolling this cutover back
+requires exact `89e6d7649169` together with its environment backup at
+`/etc/screener/backups/05f98d10-precutover-20260820T110654+0800`.
+
+One failed validation assertion printed the stateless admission cookie only in
+the operator's private test output. It did not enter the repository, service
+logs, shell history, release artifact, browser profile, or temporary files. No
+value is retained here; the cookie has no server-side state and expires within
+12 hours.
+
+Local quality reparenting deployed between 2026-08-20 11:41:22 and 11:41:23
++08 on exact `d4bc421828c4b74f55195723aace290ffc0e5f9d`; its artifact SHA-256 is
+`3F8CF25F8D989CBDF38DBBCAC4A261C349E44B72D274A944B877540056171A08`.
+The immutable release is `/opt/screener/releases/d4bc421828c4`, its upload is
+`/opt/screener/uploads/screener-d4bc421828c4.tar.gz`, and the pre-switch target
+record is `/opt/screener/backups/current-before-d4bc421828c4.txt`.
+The gate passed 25 test files/378 tests, typecheck and both builds. The 760ms
+code-only switch kept health and `index-YdNLg2E8.js` at 200, SQLite integrity
+and four rooms including room `1`, Screener/LiveKit restarts at 0/0, and
+environment/nginx/LiveKit hashes unchanged. Its immediate rollback is
+`05f98d10ecd1` with the same environment and SQLite v2. A pre-cutover inode gate
+caught two internal esbuild hard links; hash-equal copy replacement broke them
+before the switch, so no running or rollback release was affected.
+At 11:44:15 +08 Screener and LiveKit were still active/running with zero restarts,
+used 39,198,720 and 79,269,888 bytes, and had no error-priority journal entries
+or cgroup high/max/OOM events; host available memory was 373,469,184 bytes.
+No quality/reparent log or real-room trigger appeared, so this verifies the
+deployed code and containment, not reparenting behavior.
+
Enabling persistence does not migrate rooms that existed only in memory. The
deployment restart invalidates those temporary links; the first subsequently
created persistent room receives ID `1`.
diff --git a/docs/project-memory.md b/docs/project-memory.md
index 47d9797d..df8fb91f 100644
--- a/docs/project-memory.md
+++ b/docs/project-memory.md
@@ -39,18 +39,18 @@ Last updated: 2026-08-20
## Current Implementation
- The repository is one npm package using Node.js 24, React, TypeScript, Vite, native WebRTC, `ws`, Zod, Vitest, and separate coturn.
-- Production `89e6d7649169e43276a604c36fe681ebbed384dc` deployed at 2026-08-20 09:40 +08 to `https://share.bonfire.icu`. It enables peer/SFU routing only for persistent room `1`; unlisted rooms remain ordinary P2P. Initial-connect recovery and bounded SFU diagnostics are active, while `bbe4654` is rollback-only.
+- Production `d4bc421828c4b74f55195723aace290ffc0e5f9d` deployed at 2026-08-20 11:41:22 +08 to `https://share.bonfire.icu`. Persistent room `1` alone enables peer/SFU routing and C+B-correlated local quality reparenting; unlisted rooms remain ordinary P2P. Immediate rollback is `05f98d10ecd1` with the current v2 DB/env.
- Ordinary ICE is process-wide STUN-only. Room `1` may use one LiveKit publication feeding at most two roots while retaining peer descendants; real 1/2-root media and game quality remain unverified.
-- Production requires an independent `HOST_ADMISSION_PASSWORD` only for creation/Host role. Default private fragment grants and explicit public-watch authorize Viewers; signaling is role-bound and there are no accounts/JWT/session rows. SQLite v2 stores Host and nullable Viewer-grant digests; all four rooms, including room `1`, survived the stopped migration.
-- Production uses nginx, Node.js 24.19.0, coturn 4.17.2 for STUN/rollback, and pinned LiveKit 1.13.5 on UDP 7882 with TCP fallback disabled. Screener and LiveKit report `NRestarts=0`; local/public health and `index-2HASsWrj.js` return 200, while `/rtc`, `/rtc/validate`, and unauthenticated `/rtc/v1` return 404 outside the SPA. Public TCP 7880/7881 is blocked; LiveKit has a 192/256 MiB cgroup boundary and no automatic restart.
-- Old TURN parser/signer/refresh/UI/SNI artifacts are absent; coturn and the old release are rollback-only, not candidate media.
+- Production requires an independent `HOST_ADMISSION_PASSWORD` only for creation/Host role. Default private fragment grants and explicit public-watch authorize Viewers; four anonymous Chrome routes stayed neutral until authorization. There are no accounts/JWT/session rows; SQLite v2 still contains all four rooms, including room `1`.
+- Production uses nginx, Node.js 24.19.0, coturn 4.17.2 for STUN/rollback, and pinned LiveKit 1.13.5 on UDP 7882 with TCP fallback disabled. Screener/LiveKit `NRestarts` remain 0/0; health and `index-YdNLg2E8.js` return 200. They used 39,198,720/79,269,888 bytes with zero cgroup high/max/OOM events at 11:44:15. No real room triggered quality reparenting. Public TCP 7880/7881 stays blocked; LiveKit keeps its 192/256 MiB cgroup boundary and restart disabled.
+- Old TURN artifacts remain absent. Rolling back admission policy requires `89e6d7649169` plus the recorded environment backup; only pre-access `9610032` pairs with v1 SQLite.
- ADR-0005 is configured with exact `PEER_ASSISTED_ROOM_IDS=1`; unlisted rooms use ordinary P2P. `screener-v2` is the only deployed signaling literal; there is no v1 parser or translator.
-- Production logs show two root participants and two short Host participants with no service restart or retained track. Their timing is consistent with, but does not directly prove, one fresh-grant retry and Peer failback. The Host exposes only the local current-revision failure stage (`connect|source|video-publish|sender-config|audio-publish|transport`) and uploads no raw error or endpoint data. Browser relays still re-encode; native sharing remains outside product code.
+- Production logs show two root participants and two short Host participants with no service restart or retained track. Their timing is consistent with, but does not directly prove, one fresh-grant retry and Peer failback. The Host exposes only the local current-revision failure stage (`connect|source|video-publish|sender-config|audio-publish|transport`) and uploads no raw error or endpoint data. Browser relays still re-encode; native capture/hardware remains outside validated production behavior.
- The retained v1 backup is the only schema rollback path. A failed artifact attempt exposed unsafe hard-linked dependency reuse; the successful immutable release has zero shared regular-file inodes with rollback, and future releases preserve that boundary.
- Chrome 151/LiveKit localhost A/B cut failure-to-active/render from 1.481/2.257 seconds to 0.200/0.320; 31 new frames and 25 ms sampling kept host edges at two. It is headless synthetic 720p30 and includes SDK/network prewarm, not public-network evidence.
-- Native drafts remain experiments: one WebCodecs object is not hardware proof; stock GCC+RTX is no-go.
+- Source `main` at `f5d48ed` includes a memory-only Native v2 candidate, but production predates it and has no Native runtime gate. Render, hardware, two-edge/FIFO and TURN evidence remain absent.
- Chrome 151 synthetic topology/quality-control runs kept fanout 2/1 and all viewers decoding; one relay close recovered in 5.32 seconds. This is control evidence only.
-- Room 1 publishes `HIGH+LOW` with Dynacast off and subscriber `HIGH` ceilings. It is unverified; test zero-child leaves, then root evacuation before broad rollout.
+- Room `1` publishes `HIGH+LOW` with Dynacast off and subscriber `HIGH` ceilings, and now has bounded local quality reparenting. Both remain unverified on real media; test zero-child leaves and calibrated C+B loss before broad rollout.
- Generation-bound C+B needs three hard-bad windows; parent samples are one-use per connection. Pending SFU binds intent/guard. Stale/successful peer work releases quality exclusion; real failure may take it over. No metadata/topology classification.
## Provisional Quality Targets
diff --git a/docs/status.md b/docs/status.md
index 6401e18e..542aa4ed 100644
--- a/docs/status.md
+++ b/docs/status.md
@@ -4,36 +4,38 @@ Last updated: 2026-08-20
## Phase
-`https://share.bonfire.icu` runs `89e6d7649169e43276a604c36fe681ebbed384dc`
-since 2026-08-20 09:40 +08 as a shared-IP production smoke. It includes
-room-scoped Viewer access, bounded SFU diagnostics, and initial-connect recovery.
+`https://share.bonfire.icu` runs `d4bc421828c4b74f55195723aace290ffc0e5f9d`
+since 2026-08-20 11:41:22 +08 with neutral anonymous entry, initial-connect
+recovery, and local quality reparenting.
Ordinary ICE is STUN-only process-wide; persistent room `1` alone enables the
automatic peer/SFU-UDP controller with at most two SFU roots. The old
-`bbe4654a7a9b` is the immediate code rollback and keeps the current v2 DB/env.
-The v1 DB/old env pair is only for the deeper pre-access `9610032` rollback.
+`05f98d10ecd1` is the immediate rollback with the current v2 DB/env. Crossing
+the admission cutover requires `89e6d7649169` plus its recorded old environment;
+only deeper pre-access `9610032` may restore v1 state. Source `main` at `f5d48ed`
+also contains a no-go Native v2 candidate, but production does not run it.
## Current Snapshot
-- Capture precedes room creation; live source/quality changes preserve peers and picture pause keeps audio/connections. Quality defaults to `maintain-resolution` with balanced/fluid options.
+- Capture precedes room creation; source/quality changes preserve peers and pause keeps audio/connections. Quality defaults to `maintain-resolution` with balanced/fluid options.
- Production requires `HOST_ADMISSION_PASSWORD` only for creation/Host role and uses `screener-v2`, default private fragment grants, explicit public-watch, and generation-bound rotate/revoke. Viewers never need the Host secret; there is no account/session table or old parser.
- SQLite v2 keeps Host and nullable Viewer-grant digests in one checked `STRICT` row. The stopped migration retained four rooms and locked each old room private without minting a raw grant.
-- Native v2 rooms are memory-only, reclaim 300s after Host disconnect, obey `ROOM_TTL`, and leave SQLite/Web unchanged.
+- Source-only Native v2 uses memory-only rooms, 300s post-disconnect reclaim and `ROOM_TTL`; it has no production gate.
- PR #44's exact-room STUN-only/SFU-UDP router is enabled only for production room `1`: host/SFU roots <=2, browser relay <=1, bounded failure. HTTPS/WSS stays TLS/TCP.
- Fallback prewarm is token-free and limited to room `1`; mobile/iPad viewers are leaves and healthy edges stay sticky.
- After an answer, a generation-bound 15s initial-connect deadline enters ICE restart; success/replacement/disposal cancels it. It is deployed but not mobile-verified.
- Room `1` can publish exactly `HIGH+LOW` with Dynacast/backup codec off and subscriber `HIGH` ceilings; it has no retained real media frame.
-- Exact-room quality reparenting is candidate-only: three C+B hard-bad pairs reuse peer/SFU/failure and one room cooldown; single-side reports do nothing. Thresholds need game/mobile calibration.
+- Room `1` quality reparenting needs three C+B hard-bad pairs, reuses peer/SFU/failure and has one room cooldown; single-side reports do nothing. Thresholds need calibration.
## Verified Evidence
-- `89e6d76` passed 369 tests/builds and a code-only atomic switch. Health recovered in 1.09s; `index-2HASsWrj.js`, DB v2/four rooms/room `1`, access env, nginx and LiveKit remain healthy. Its artifact SHA-256 is `39B62039FCFB05281F78FCF85C964C520E2BB2FE5661ADA4758D598A7DF6CEC1`; new and rollback releases share zero regular-file inodes.
-- A rejected artifact reused hard-linked dependencies; its permission change made rollback unreadable for 3m11s and restart attempts peaked at 52. Restoring ownership recovered `9610032`; the successful artifact has zero shared regular-file inodes. Immutable releases now forbid this reuse.
-- On the 960 MiB host, idle LiveKit peaked near 16 MiB with no cgroup high/max/OOM event under `MemoryHigh=192M`, `MemoryMax=256M`, swap disabled and restart disabled. This is containment/idle evidence, not media capacity.
+- `d4bc421` passed 25 files/378 tests, typecheck and builds. The 760ms switch preserved 200 health/`index-YdNLg2E8.js`, SQLite v2/four rooms/room `1`, 0/0 service restarts, and unchanged environment/nginx/LiveKit hashes. Artifact SHA-256: `3F8CF25F8D989CBDF38DBBCAC4A261C349E44B72D274A944B877540056171A08`.
+- The `05f98d1` access cutover passed 25 files/369 tests; four anonymous Chrome routes stayed neutral, the current key returned 200, and former/incorrect keys returned 401. Exact rollback and the contained assertion-output incident are in `docs/deployment.md`.
+- At 11:44:15 Screener/LiveKit used 39,198,720/79,269,888 bytes; cgroup high/max/OOM and error journals were zero. No real room triggered reparenting, so this proves deployment only.
- Chrome 151 synthetic `1/3/5/8` and 720p30 quality-change runs kept 2/1 fanout and decoding; slowest first frame was 1.05 seconds and one relay close recovered in 5.32 seconds. This is control evidence only.
- A mobile-network room-1 run produced two root participants for about 4.6 seconds and two short Host participants (about 0.46/0.27 seconds), all client-requested leaves, with zero service restarts and no retained track. This is consistent with the code's one fresh-grant retry and Peer failback, but logs cannot prove those transitions. The deployed Host now shows only the local failure stage.
- Host A+B and authenticated P2P Viewer C are sanitized, generation-bound, read-only, and fail closed for stale, ambiguous, or SFU-fed evidence; no raw media metadata is retained.
- SVC is `no-go-web-svc-cross-path-hardware-contract`: no direct/peer selection, cross-PC shared encode, or portable hardware proof; pinned screen share is `L1T3`. No browser run was warranted.
-- HTTPS/WSS, Host admission, room/WebSocket authorization, renewal, and public STUN checks pass. Current media has no TURN credential wire; coturn relay evidence belongs only to rollback.
+- HTTPS/WSS, room/WebSocket authorization, renewal, and public STUN pass. Current media has no TURN credential wire.
- Draft #16/#18/#22/#23/#25/#28 passed isolated experiments only. ADR-0006 reached host setup/one encoder output, then timed out before viewer 1 decoded/rendered.
- Access focused tests pass protocol/config/HTTP/storage/RoomStore/SQLite/signaling, including commit-first teardown, persistence-failure continuity, relay/SFU retirement, grant bounds, and v1 migration rollback.