Commit Graph
731 Commits
  • fix(native): process state through one async frame
    Pass the current retirement set straight to the state owner instead of retaining a full Snapshot in an additional awaiting wrapper. The redundant layer overflowed the Windows Native main-thread stack during the real competing-process room admission check.
    
    Validation: the original integration executable and corrected Native CLI passed all 12 real-session tests; 20 capture-enabled Native session tests also passed. No larger thread stack, heap wrapper or retry was added.
  • fix(update): retain the installation while another App uses it
    A Windows App holds a read-only directory lease while it may load bundled resources. Replacement cannot move that installation out from under another profile. On failure the helper requests the old App restart and records the result before showing the existing dialog, without killing other instances.
    
    Validation: the capture App built and 12 update checks passed. Isolated signed product-helper controls preserved old resources and both profiles while a second App ran, then updated after it exited. The actual owned failure dialog appeared after result.json was written; restart readiness may follow it. Protection applies to instances that include this lease, not previously released executables.
  • fix(storage): isolate rooms with ambiguous local records
    Discover managed SQLite rooms by their durable identity and refuse an ambiguous target before offline deletion or restore installation. Healthy rooms and new room creation survive unrelated file failures. A resumed writer retires its known binding even when the operator cannot read that room; Core accepts retirement from the current authenticated owning session while still rejecting stale outputs.
    
    Validation: 20 Windows Native and four Server checks cover actual SQLite locks, duplicate/repaired stores, offline restore and hidden rooms. Sixteen Core room-access and seven service-transit controls verify resumed HostStop without accepting the stale socket, another session, wrong binding or unregistered HostOutput. All six source files match the validated v4 candidate. Public directory deletion retains its existing independent authority.
  • fix(conversation): return refused replies to their waiting reader
    After validating the current writer, signed scope and visible recipient, deliver permission-gate refusals through the existing room-scoped reply. Use room_busy while the read floor is pending and preserve room_access_required for confirmed denial. Existing client request owners ignore observer copies and cross-room IDs; the Node pending request records its room scope.
    
    The deterministic SQLite control previously left a committed chat retry waiting while the refusal went only to the writer. Core SQLite passed 316 checks with one separate release-capacity check ignored; 612 Browser/Node checks and Node type checking passed. Browser explicit same-draft retry retained its nonce. This adds no wire field or authority queue; the independent Browser interaction handshake remains open.
  • test(browser): run Windows servers from an owned build copy
    Snapshot a Cargo Server before starting Windows acceptance so later relinking cannot collide with its executable lock. The build caller explicitly identifies custom Cargo output with --built-server, and the second domain reuses that snapshot. Packaged input stays at its supplied path.
    
    Validation: five protocol checks passed. An isolated Windows control reproduced EBUSY on direct execution and successful rebuild with an unchanged snapshot hash. The actual runner timeout path retired both Servers and removed its directory; no additional wait or retry was needed.
  • fix(watch): retire obsolete webpage selection grants
    Retire a prepared reader when its candidate resource changes or disappears, using the existing projection lifetime. Ignore replies to requests whose receiver has already closed before any selection side effects. A failed or expired replacement retains the active source; page event limits share their existing named owner.
    
    Validation: independent lifecycle review and 23 Windows capture-enabled checks, including deterministic closed-receiver selection and owned HTTP range/redirect credential controls. The boundary-constant consolidation compiled and its two focused regressions passed. No change to the accepted direct-URL fallback.
  • fix(session): keep draining peer events while retiring a reader
    Route watch-reader revocation through the existing await_peer owner, as registration and the other awaited Driver operations already do. The Session must continue consuming peer output while its bounded command send is pending.
    
    A controlled dispatch gate observed zero events on the old handler and one on the corrected handler. The 35 Native Session checks include the existing saturated Driver regression and reader retirement. This does not claim a field reproduction of both queues filling during revocation.
  • refactor(capture): give each pending source an explicit phase
    Replace separate commit, lease and candidate fields with preparation, external readiness, prepared lease and submitted commit phases. Derive a prepared candidate ID from its lease while the submitted phase retains the ID owned by the pending host result. Room acknowledgement and active source ownership remain in their existing handlers.
    
    Validation: independent lifecycle review, 35 capture-enabled Native Session tests, 13 Server library checks and a control-WebSocket preparation-failure/cancellation check; the Windows capture App built. Update the three existing WHIP fixtures to the same phase representation. Physical source switching was not part of this check.
  • fix(native): admit video from the representations a receiver can use
    Integrate Claude 151f6601 with independent allocator and supply corrections. Reserve each optional flow minimum and its audio before distributing surplus; preserve standalone voice. Compute admission rates and forwarding from the same receiver-compatible supply, including reversed RID costs and H264 profile constraints.
    
    Evidence: the observed 187043/121722/53370 budget case and four reproduced failures in simultaneous optional admission, zero video budget, inverted RID costs and High-only forwarding. Corrected Windows capture checks passed 32; no-capture Native passed 195 with two hotkey checks skipped; all 125 Server checks passed. The original full capture run had two readiness timeouts that passed the same-binary serialized control. No physical-network or capture-device claim.
  • fix(native): give video admission one owner
    The allocator admitted an optional trial with a positive grant below every
    representation of its source, and the video Input then deactivated it
    silently. The flow was neither waiting nor rejected, so the route owner saw an
    admitted trial that sent audio and never video. The same split disabled a
    selected flow on a relay that cannot re-encode once the estimate fell below its
    only representation.
    
    The supply now reports a deliverable floor: the cheapest full or temporal
    representation, unknown before a complete observation and zero while idle. An
    output that the producer's encoder can serve in an accepted format has a zero
    floor, because any positive grant is usable. The allocator owns admission: an
    optional trial whose known floor exceeds its budget waits or is rejected,
    including when no selected incumbent is present. Established selected video
    keeps its floor when the estimate falls below it, which is charged before
    optional work, so floors beyond the estimate admit no optional load. Startup
    without feedback and unknown floors keep the existing bootstrap. This follows
    the shape of libwebrtc's allocator, which gives an enforced-minimum stream its
    minimum when the total is too low and pauses the others explicitly:
    https://webrtc.googlesource.com/src/+/refs/heads/main/call/bitrate_allocator.cc
    
    The Input keeps layer selection and keyframe readiness only. A positive grant
    that no longer fits after planning carries the cheapest representation until
    the next plan; Paused and a zero grant still deactivate it.
    
    Allocator tests cover the observed 187,043/121,722/53,370 bps case, exact and
    below-floor trials, unknown and idle sources, startup, the branch without an
    incumbent and selected floors above the estimate. Fixture tests whose subject
    is RTP identity or source lifetime now hold their second flow as selected media
    or give it a fixed estimate instead of relying on optional admission against
    the loopback estimate.
  • fix(app): commit site ownership with the accepted navigation
    Keep the current local-room origin while another site is only pending.
    Commit its local/site origin together when the matching document begins loading,
    so a failed navigation does not prematurely strip the existing overlay owner.
    
    The Windows capture-enabled product tests cover pending and accepted navigation,
    site verification and bookmark authority separation. Full WebView failed-load
    interaction remains a distinct runtime check; no bookmark or permission role changes.
  • fix(sdk): retire failed connections before returning to callers
    Handshake and initial room selection share one acquisition boundary. On failure,
    terminate the owned WebSocket and await its existing close cleanup before
    returning the original error. The participant keeps its signer for a retry;
    stop remains its terminal owner.
    
    Real loopback WebSocket controls confirm immediate retry after both rejection
    points. Existing stop and SDK tests pass; no parallel request teardown is added.
  • fix(app): use native window activity for attended actions
    WebView can retain document focus after another Windows application becomes
    foreground. Project each Piik window's actual activation into its document
    and share that fact across message feedback, read markers, shortcut ownership
    and remote-input reset. Keep media visibility and room grants independent.
    
    The same real foreground-window transition reproduces silence and premature
    read advancement on beta.53, then triggers cues and preserves unread position
    on the candidate. Returning to Piik advances the cursor. Audio output was
    muted in the experiment; oscillator execution and completion were measured.
    All 2315 Web tests, TypeScript and the Windows capture-enabled App check pass.
  • test(server): allocate UDP independently in both browser harnesses
    Use the same OS UDP allocation helper for the primary and additional test
    Server, with the value scoped to each child's environment. Avoid reusing a TCP
    port that can be reserved for UDP on Windows. Actual protocol checks pass.
  • fix(native): retire a failed reader through its source owner
    A reader panic must deliver the same terminal SourceEnded event as a normal
    return. Keep the existing reader identity and source cleanup so healthy voice
    on the same pair survives, rather than retiring the entire transport.
    
    The full transport module passes 31 tests on Windows, including an actual
    injected video-reader panic with continued sibling RTP. Native without capture
    also compiles. Parent cancellation retains its existing abort-and-join path.
  • test(server): allocate the check Server's UDP port through UDP
    run-browser-check.mjs reserved a free TCP port and let the Server bind UDP
    on the same number. Windows reserves port ranges per protocol, so a free TCP
    port can sit inside a UDP reservation. On a machine where
    `netsh int ipv4 show excludedportrange protocol=udp` lists 52359-52458 and
    the TCP list leaves 52360-52395 free, three protocol checks in a row ended
    with "Bind Server UDP 0.0.0.0:52363 ... os error 10013".
    
    Give the Server its own UDP port, as 3713fc4c did for room_creation_policy.
    Only that child receives it, so the second Server that
    browser-native-acceptance.mjs starts from the inherited environment does not
    try to bind the same port.
  • test(native): capture RTP ownership when stream reuse fails
    The cross-review machine reports fresh-SSRC failures while fixture input keeps
    advancing. On that failure, print both ends' MID/SSRC/track mappings, counters
    and bounded observation histories. Preserve the original error if diagnostic
    queries fail or their bounded collection expires.
    
    The instrumented test compiles and passes once locally without capture. This
    does not explain or dismiss the independently reproduced intermittent failure.
  • test(storage): extend shared history moderation coverage
    Replay moderator deletion, partial clearing, live nonce retries and per-message
    attachment references through the existing SQLite and IndexedDB scenario.
    Both runners verify original identity and content survive a live retry.
    SQLite and actual Browser/WASM checks pass without a new test framework.
  • test(core): require delivery for reachable byte receivers
    Strengthen the bounded demand-sequence scenario so empty plans cannot satisfy
    its assertions. Use distinct high generator bits and the fixture's confirmed
    links and remaining capacity. A deliberately empty projection fails; the full
    SQLite route suite passes with the existing planner.
  • refactor(protocol): share room creation commands with the text SDK
    Browser and Node participants use the same room-settings conversion. Keep
    hosted versus device-owned fields explicit and retain SDK return contracts.
    Existing participant/session tests and TypeScript checks pass.
  • fix(native): drain peer events while checking ended captures
    An actor blocked on its full event output cannot answer the consumer's capture
    query. Share a non-recursive event pump between the session loop and await_peer;
    query-time notifications join the next bounded set of owned publications.
    
    Real Session and Driver tests exercise the saturated 64-slot queue and retain
    active replacement video and audio-only captures. Capture ownership remains in
    the Driver; no duplicate capture snapshot or unbounded queue is added.
  • refactor(audio): normalize capture scope at its authority boundary
    Validate the existing request once after cancelled audio cleanup and capture
    lease checks. Downstream producers consume Off, Source, ExcludeProcessTree or
    RenderEndpoint instead of reinterpreting independent optional fields.
    
    Preserve the current wire shape, required explicit selections and ordinary
    capture warnings. Windows, Linux capture and Android API 29 checks pass;
    a regression preserves capture_not_owned before invalid endpoint errors.
  • test(core): check byte-tree invariants through demand changes
    Extend the existing route scenario with a bounded seeded sequence, pair
    failure and session expiry. Assert matching upstream/downstream projections,
    source reachability and an acyclic business tree while permitting the
    underlying connection graph to contain cycles. Use the current Core runner.
  • test(storage): share moderation scenarios across SQLite and IndexedDB
    Both existing storage test runners consume one fixture for author checks,
    deleted-message retry identity, removed references and history seeking.
    The implementations keep their own transactions and indexes. SQLite and the
    actual Browser/WASM storage run pass the shared scenario.
  • test(runtime): coordinate races and allocate UDP independently
    Use request barriers to select the updater provider instead of millisecond
    sleep races. Allocate the integration test's UDP port through UDP rather than
    assuming the OS accepts the separately allocated TCP port.
    
    Refresh RTP baselines at the actual warm switch and compare modular progress.
    Keep media reuse deadlines and add failing phase/cycle context. This improves
    test causality without claiming the reported intermittent capture failure fixed.
  • fix(app): finish shutdown when the HTTP service ends first
    Both stop and HTTP-return paths await the same cleanup future, preserving
    dependency order and preventing cancellation of partially completed shutdown.
    Controlled Tokio checks cover cleanup before start, during work and after
    completion; the normal Server shutdown tests retain their existing contract.
  • test(native): cover transport failure during session resume
    A real WebSocket control verifies that a dead Driver on resumed admission
    releases the old session and that a fresh Driver can reuse the fixed sockets.
    Keep the transport test lease helper confined to capture-enabled tests.
  • fix(native): isolate individual room storage failures
    Opening or installing one room must not retire independently hosted siblings.
    Handle that failure at the existing room operation, retain global directory
    and identity failures as host failures, and report the failed CLI room ID.
    
    Session and real Server tests cover a locked room, creation installation
    failure, healthy sibling chat/history, recovery after unlocking and a second
    process that cannot steal an existing binding. Invalid global layout still
    ends the HTTP service and leaves the data unchanged.
  • fix(capture): use requested keyframes across native encoders
    Linux and Windows hardware use the shared 3000-frame WebRTC interval. Linux
    caps GOP to the plugin's advertised maximum, keeping unrelated numeric
    properties strict. Windows preserves a usable driver when the optional GOP
    property is unsupported.
    
    Android follows libwebrtc's 3600-second MediaCodec interval, which avoids the
    negative-value initialization failures described in upstream 419344264cfc.
    Existing explicit keyframe requests remain unchanged.
    
    Validation includes real x264 force-key-unit output, a synthetic NVIDIA MFT
    comparison, Linux capture compilation and Android API 29 links on both ABIs.
    Physical Android and other hardware drivers remain in TODO.
    
    Sources: https://webrtc.googlesource.com/src/+/refs/heads/main/api/video_codecs/video_encoder.cc
    https://webrtc.googlesource.com/src/+/419344264cfc7445af3e82024bd285303e17b3d6%5E!/
  • fix(watch): retain confirmed source handoffs across reconnects
    The room retains the original source and current successor for its subscribed
    viewers. Ordinary snapshots project that typed predecessor, including when a
    viewer misses more than one replacement. Local playback and receiving-method
    choices remain with the Browser.
    
    Remove one-shot channel event decoration. Joining, leaving, access loss and
    session expiry retire the room record. A leave for an already-retired screen
    is routed only through that viewer's authorized pending handoff.
    
    Core regressions exercise both cross-kind chains, session recovery, revocation,
    fresh sessions and independent viewer exits. Shared Web schemas and Native
    constructors use the same pending Domain 46 contract. The existing network
    design owns the lifecycle; no persisted-data format changes.
  • refactor(review): integrate the independently reviewed 3.0 queue
    Accept the shared byte-distribution owner, supervised transport retirement,
    distinct random-port probes, software keyframe interval and lazy-load retry.
    Preserve the review branch's commits and authorship.
    
    Use the one-writer cross-review mailboxes. Narrow the proposed lifetime rules
    to demonstrated ownership problems rather than requiring a universal interface
    or a restructure after every repeated fix. ADR-0015 remains proposed.
    
    Use the active prototype as its explicitly scoped pre-cutover base and invoke
    the vcpkg bootstrap by a fixed relative path. Independent trace reviews and
    the queue's recorded controls support these choices; combined checks follow
    with the concrete mailbox fixes on the same development branch.
  • fix(watch): prepare a new player without retiring the active webpage
    Keep a borrowed page and its active media reader alive while the host inspects
    another player. Commit the candidate only after the room accepts it, then retire
    the previous reader through the page owner. The native caption reopens the same
    source chooser without navigating the logged-in page.
    
    Validation: 2298 Web tests, TypeScript, Windows same-page A/B cancellation and
    commit controls, 41 current Windows page tests, Linux page tests and both Android
    ABIs. Two cancellation assertions were updated to expect the released empty slot.
    The ownership and source-selection contract is in channel-network-design.md.
  • fix(capture): send Windows software keyframes on request, not every two seconds
    The Windows software H.264 and VP8 encoders were configured with a
    keyframe interval of twice the frame rate. A static screen was therefore
    re-encoded as a full picture every two seconds, which spends bitrate on
    content that did not change and, under CBR, replaces a converged picture
    with a coarser one each time. The new test shows the real Media Foundation
    encoder emitting that keyframe at frame 20 of a 10 fps static sequence.
    
    Stock WebRTC does not send keyframes on a timer: libwebrtc sets
    keyFrameInterval to 3,000 frames for VP8 and H.264 and passes it to libvpx
    as kf_max_dist, and Chromium's Media Foundation encoder uses
    kDefaultGOPLength = 3000. Recovery and late joiners already use the
    existing force-keyframe path. Use the same 3,000 frames here, from one
    constant.
    
    Not changed, because they cannot be built or run on this host: Linux
    (key-int-max / gop-size, same two seconds) and Android (i-frame-interval
    2). Windows hardware H.264 and macOS set no interval and keep their
    encoder default.
    
    Sources:
    https://webrtc.googlesource.com/src/+/refs/heads/main/api/video_codecs/video_encoder.cc
    https://webrtc.googlesource.com/src/+/refs/heads/main/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc
    https://chromium.googlesource.com/chromium/src/+/main/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
  • fix(native): probe distinct ports in the random UDP search
    The searching side of a random-port preparation sent 512 requests but
    cycled twice over the same 256 ports. Coverage, not the number of requests,
    sets the chance that a probe reaches one of the peer's 256 mappings: with M
    mappings and N distinct targets in a pool of R ports the idealized hit
    probability is 1 - exp(-M*N/R), as docs/research/nat-traversal.md records.
    For M = 256 and R = 64,512 that is 63% at N = 256 and 87% at N = 512, for
    the same packets, pacing and deadline.
    
    A second pass over one set only protects against a lost request, and it
    loses to distinct targets at any loss rate: at 30% loss the repeated set
    covers about 233 ports and the distinct set about 358. The peer signals
    Ready after its mappings exist, so a first probe is not early.
    
    The request budget stays 520 and the pool side is unchanged. Lab evidence
    in nat-traversal.md was taken with 256 targets and is not re-measured here.
    
    Reference: https://tailscale.com/blog/how-nat-traversal-works (birthday
    search against a hard NAT).
  • Merge remote-tracking branch 'origin/feat/channel-prototype' into refactor/claude-review
    room.rs conflicted where the active line added Watch.replace_id beside the
    parents and refused fields that the queue moved into ByteTree. Both are
    kept: Watch carries replace_id and one ByteTree.
  • fix(native): supervise the transport runtime from its Driver
    The transport pump's lifetime had no owner beyond its happy path. The
    ServerUdp lease was a bare flag reset only after the pump loop ended
    normally, so a panicked or aborted pump left the fixed sockets leased
    forever and every later Runtime on that service returned at once, failing
    each call with "transport closed". Nothing above noticed: the Driver only
    saw per-call errors, failed pairs one by one, and replanned into the same
    failure. Runtime had no Drop either, and its engines hold command senders,
    so a Runtime dropped by a panicking Driver kept its pump, sockets and
    readers alive.
    
    The lease is now an RAII guard owned by the pump task, so return, panic
    and abort all release it, and the flag is private to server_udp.rs.
    Runtime aborts its task on Drop, and each socket reader is aborted with
    the Socket that owns it, so an idle reader no longer holds its port after
    an aborted pump. Runtime::stopped resolves when the command receiver,
    owned only by the pump task, is dropped; the Driver's main select ends
    the Driver with an error on it. Retirement still runs once through
    Driver::close on every exit, and a clean close stops the runtime only
    after the loop, so it is not reported as a failure.
  • refactor(core): share one byte-distribution tree between files and watch bytes
    File (file_room.rs) and Watch (room.rs) each kept the same source, parents
    and refused state and each reimplemented refusal validation, refusal
    retention, forwarding_available, failed-pair retirement, waiting detection,
    frontier collection and per-session plan projection. A change to byte
    refusal therefore had to be repeated at about eight sites in room.rs.
    
    routes::ByteTree now owns that state next to activity_parents and
    byte_frontiers, which it wraps. FileRoom keeps one per file and still
    chooses among holders; Watch embeds one and RoomRuntime supplies the
    receiver set, the refusal-retention predicate and the announced source.
    Each family keeps its existing predicates: files retain refusals for
    admitted sessions or the service, watches for routable sessions, and the
    watch-only source and self-refusal checks stay in room.rs.
    
    watch_receivers now borrows only the activity map, so the routing loop
    uses it instead of an inline copy.
    
    No wire, storage or public API change.
  • fix(media): preserve shared encoding through pause and resume
    Read the negotiated codec separately from active allocation so pausing a sender does not permanently disable shared encoding. Refresh native page placement when pixel density changes and refresh selected-source labels when their title attributes change.
  • fix(network): retain PCP lease identity across renewal
    Use the existing gateway mapping when renewing its nonce and selecting its protocol after probe expiry. Align Native, Server and Android to the tested fork revision and associate its crate notices with the complete upstream license text.
  • fix(ui): keep drafts and operation feedback in their room
    Retire quoted content after explicit access revocation without dropping drafts during a room writer restart. Bind a pending file picker to its original conversation, keep room record actions independent, and clarify narrow terminal help and local-network troubleshooting.
  • fix(app): preserve action feedback and software video color
    Keep room deletion failures with their initiating surface and retain room identity after that surface closes. Recover local autoplay guidance when the owner pauses, preserve narrow playback focus, and remove duplicate SDK shutdown cleanup. Declare the software encoder output color from its configured SDR contract.