Commit Graph
148 Commits
  • refactor(core): centralize state changes and persistence outcomes
    Keep channel time explicit, room binding transitions owned by their records, and shared limits checked against Core. Persist the actual changes before delivery, preserving expiry and the original requester on failure. Include the verified receiving-route, cache-clear, tooltip and native appearance corrections from this integration phase.
  • fix(files): separate original media types from preview support
    Preserve a valid MIME essence in attachment metadata, signed history and file
    plans. Readers offer a generic download for formats they do not preview.
    Recognized raster bytes retain their original MIME and thumbnail behavior
    even when File.type is absent or wrong.
    
    Thumbnails keep their own raster, binding and budget validation independently
    of the original format. Historical inline originals still require the exact
    size and digest and a case-insensitively equivalent MIME type. Existing image
    decoders and retained original bytes are unchanged.
    
    Core SQLite passes 354 tests; Web TypeScript, 826 focused checks and 32 fresh
    WASM consumer checks pass. Real Chrome 156 exercises signed history, atomic
    restore/reopen and cross-frame file storage with the same WASM. The first
    browser harness bundle needed its dynamic module kept separate; the complete
    fixture then passed without product-source changes. The beta.62 missing-image
    report remains unlocated.
  • feat(protocol)!: use product versions for Domain and App admission
    Declare major and minor once at admission and preserve each session's numbers
    beside its signing key. Equal majors admit different minors; incompatible
    majors reject before consuming launch authority and identify the older side.
    App discovery, Native readiness and Web diagnostics keep that direction.
    
    Resolve build identity before compilation. Browser values and displayed version
    share the same build input; the Node SDK reads its actual WASM version. Remove
    the two private wire identifiers without aliases for obsolete internal builds.
    
    Basis: the accepted compatibility rule in Versioning and ADR-0017. Validated
    Core, Web/WASM, Windows reader and App discovery controls. Real packaged SDK
    3.0 and 3.1 each completed signed conversation and private-room history against
    the other Linux Server minor. Browser/App mixed-artifact acceptance remains open.
  • feat(protocol)!: separate App creation inputs and extensible readers
    Create room policies at the authenticated writer from allocated IDs and user
    settings. Confirm typed opened results; cancel reservations only on a definite
    settings rejection. Ignore harmless App extensions without retiring unrelated
    requests, while keeping stored rows strict at their consuming boundary.
    
    Let text participants select a conversation snapshot at Join, and repair an
    unsupported host turn through the existing synchronization owner. This replaces
    the private App open request and result shape; matching internal artifacts are
    required until the first public contract is frozen.
    
    Basis: ADR-0017 and the interface extension contract; same-connection App,
    SQLite/WASM, signed history and standalone Server controls. Combined Web tests,
    focused Native tests, and TypeScript checks passed after correcting obsolete
    fixtures. The affected App storage-collision integration cases were not rerun.
  • feat(protocol): unify Domain outcomes and selected history parts
    All Domain terminal results use one correlated reply carrier; observer notifications cannot settle waiters. Hosted storage keeps its internal completion until commit, and unknown registration outcomes do not cancel possibly committed rooms. History requests select inline images before page budgeting and replies report actual coverage, so text-only consumers save transfer without erasing cached images. The exact staged tree passed complete Core SQLite checks (341 plus one release-only ignore), fresh-WASM Web checks (2567 tests), Windows Native and Server builds and 17 runtime controls. Chrome IndexedDB controls separately verified selective paging and clearing. Private aliases and extra capability flags were not retained.
  • feat(protocol): distinguish signed outcomes from observer notices
    Read authenticated address and request/record/notice role before concrete kind. Unknown commands return unsupported; unknown requester records settle only their own operation as unconfirmed; notices never settle a waiter. Keep original signed payload forwarding and current writer/binding/read-floor authority. Independent review corrected body-object validation and unknown-outcome presentation. The exact staged tree passed fresh-WASM Web checks (2563 tests), complete Core SQLite tests (339 plus one intentionally ignored), capture-enabled Native/Server compilation and five signed runtime controls. This replaces the private room-carriage shape without an old-reader adapter.
  • refactor(chat): confirm the complete stored message in one record
    The signed send receipt now carries the existing stored message and reaction revision. Remove its extra reaction snapshot record, preserve newer reactions when merging history and expose the same complete result to Node retries. The real WASM build, Core conversation/SQLite controls and 746 focused Web tests passed; Browser acceptance fixtures now inspect the current single history page shape. No historical private wire adapter is retained.
  • refactor(history): keep Browser index fields out of page projection
    Only the IndexedDB reader drops roomId, nonce and retryKey before passing a live row to the Core page builder. They remain in storage and archives. A 50-row synthetic control reduces serialized input by 7450 bytes with identical output. Real Chrome IndexedDB baseline and candidate controls retain page limits, images, nonce deduplication and archive restoration. No wire or storage schema changes.
  • feat(profiles): represent unnamed members across room surfaces
    Use an empty stored name for unnamed members and one localized formatter for guest labels and same-list duplicates. Full member IDs retain authority; archived empty names remain distinct from unknown live profiles. Reuse the profile editor for an owner-controlled optional nickname prompt and remember dismissal per site and member. The current private Domain 55 phase carries the setting; existing stored headers default it off. Core, Browser, SDK and archive controls passed, including an actual two-browser hosted-room skip and reentry check.
  • feat(rooms): clear hosted media without removing conversation
    The selected host clears its owned image renditions and managed local file cache while retaining text, members, policy, metadata and saved downloads. Writer commits publish a signed cutoff so delayed pages cannot restore cleared thumbnails; newer messages and selected original files survive. Native hosts also cover dormant local databases and report post-commit compaction separately. Reuse the existing More menu, dialog and inline confirmation. Private Domain protocol 55 includes the new record. SQLite, IndexedDB, Native dormant-room and live dual-browser checks passed; physical-device acceptance is separate.
  • fix(input): validate escaped text against the actual command budget
    The editor could clear 2048 quote characters although escaping exceeded the Native 4096-byte command budget. Measure the complete command before sending and retain oversized text. Core, Native and Browser use the 8192-byte UTF-8 carrier bound; independent queue budgets keep their own names. Static Browser values are compared with compiled Core, with no new WASM hot-path dependency. Real WebCrypto boundary probes, Native compilation and all 2521 Web tests pass.
  • fix(channel): discard retired browser host commands before execution
    Carry the existing binding and socket predicate into the serialized BrowserRoomHost turn. Queued work from an old carrier no longer reaches Core or starts an IndexedDB transaction; already-started commits retain their existing lifecycle. Real Chrome/WASM/IndexedDB controls observe zero Core calls for retired queued work and successful current work. No password-rate policy is introduced.
  • refactor(core): expose shared recovery and data framing rules
    The Browser consumes Core recovery and frame limits through the existing WASM boundary, and delegates Watch-frame classification using two scalar header bytes. Static startup schemas remain synchronous and one compiled-Core comparison verifies their six mirrored values, replacing source-text parsing. WASM, current Session controls and Web validation pass; no protocol value or preparation deadline changes.
  • feat(sdk): answer direct mentions in the Piika support example
    Extend the existing room participant example with one quoted FAQ reply for a structured mention or notified reply. The example preserves report commands and subscription cleanup, links to the matching 3.0 guide, and adds no Bot-specific authority or service. Fourteen offline handler and SDK controls and TypeScript pass; no online messages were sent.
  • fix(examples): use the chat renderer supported by the support bot
    The production message renderer intentionally leaves Markdown headings as literal text. Use a plain title in the existing support reply, preserving the copyable code template, reply target and underlying SDK behavior. Rendering was checked without changing the system clipboard.
  • fix(sdk): settle signed receipts during connection close
    A real local WebSocket control reproduces chat confirmation arriving after reconnect starts its close handshake but before socket close. Accept a matching in-flight signed reply until the existing close handler retires its pending owner; still discard live broadcasts while closing. All six text-participant tests and the SDK typecheck pass. Genuinely lost receipts keep their unknown outcome and explicit same-nonce retry.
  • refactor(sdk): share the writer-result classification
    Use the same result-kind predicate for request deadlines, binding retirement and signed completion. This removes a repeated condition without changing any deadline or externally visible outcome. Existing SDK and lifecycle tests pass.
  • refactor(chat): share committed reply and broadcast selection
    ConversationOutcome owns the direct replies and optional live broadcast for both room writers. Browser retains current-binding checks and reads current recipients after direct completion; Native retains its local-session filter. Deletion keeps recipients captured by the committed removal.
    
    Removes per-record Browser JSON/WASM classification without changing wire records or stores. New WASM and IndexedDB controls, Native two-reader WebSocket delivery, SQLite deletion and focused SDK tests pass; the integrated Browser package and types were rebuilt.
  • fix(sdk): complete conversation work from its writer outcome
    Apply the existing signed conversation boundary to the Node participant: transport acknowledgements and live observer records do not finish pending writer work, and a contradictory signed terminal fails that request without emitting a false confirmation. Reuse the existing pending expectation rather than another operation registry.
    
    The public deletion control reproduces the prior room_reply rejection on a real loopback WebSocket with Core WASM. All nineteen SDK and lifecycle tests pass and source types remain valid.
  • fix(sdk): commit room selection when its receipt is accepted
    Node ws can dispatch Browse success and the first signed message in one network read. Commit the selected room and ready event in the existing correlated request completion so the valid message has its room scope. Reuse the pending request resolver; no delayed-message branch or global WebSocket scheduling change.
    
    Real WebSocket before/after controls and nineteen SDK lifecycle checks pass, including rejection, late timeout replies, both close/receipt orders and replacement bindings. Integrated frontend and SDK type checks pass.
  • refactor(web): use the canonical channel entry
    Remove the duplicate channel-preview route and move its launcher, owner-link, acceptance and documentation callers to the existing root URL. Query and invitation fragments retain their meaning. App launcher and component preview routes stay separate. Route, session and built-server protocol checks pass.
  • refactor(conversation): deliver one signed history page
    The writer already produces a bounded complete page and readers publish it atomically. Remove the per-message/reaction envelopes and Browser/Node reassembly, retaining request, binding, transaction and live-change owners. The mixed-page component control cuts serialized bytes by 47.4% and signatures from 101 to 1. Advance private Domain wire to 51; stored formats are unchanged. Core, actual IndexedDB, Server, Node and protocol checks pass.
  • merge(review): consolidate private room contracts and their readers
    Take Claude C2 at 53bea0a6 and the reviewed private contract batch. Viewer audience owns failure; invitation payloads use correlated replies; Core owns fixed observation limits; HostInput requires hosting mode; invitation digest derives from its retained key. Domain wire49, room SQLite11, IndexedDB9 and room archive4 refuse old private formats without mutation; unrelated formats retain their generations. Core/Native/Server, rebuilt WASM, five live protocol cases and 2388 Web tests pass; actual Browser storage checks pass. Broader media acceptance found a separate relay-unwatch decode stall and remains blocked; no runtime workaround or release is included.
  • perf(browser): return only forwarding fields used by the client
    The only JavaScript consumer already declares and reads pairs, files and watchBytes plus commands and capacity. Seven paired emitted-WASM runs over 200 updates and 20 identities reduced active return bytes by 88.0 percent and idle bytes by 98.9 percent; consumed outputs match across forwarding-limit transitions. Real WASM compilation, focused Core checks, TypeScript and 701 client tests pass. This measurement is serialization cost, not end-to-end media throughput.
  • fix(room-host): report a newer stored version as unsupported
    IndexedDB rejects opening the room store at a lower version than the one
    already saved with a VersionError. The store passed that DOMException on
    as is, so a database saved by a newer build reached the page as a raw
    browser message and fell through to the generic "could not complete the
    action". The store already names an older schema
    unsupported_storage_version, which the interface explains with the
    existing saved-data version message and help entry. A newer schema is the
    same fact seen from the other side and now carries the same code.
    
    Verified: tsc -p prototype/channel-browser/tsconfig.json passes. The
    Browser room check gains a case that opens a store at a newer version;
    running it locally failed before the page loaded because Chrome could not
    start in this environment, so that case is not yet observed.
  • feat(forwarding): make Server forwarding an operator-controlled fallback
    The owner decided how a Server forwards. Forwarding spends the operator's
    bandwidth, so the operator offers it and it is off by default. Once offered,
    rooms use it without a second switch, a room manager can decline it, and the
    service ranks after participant paths (canon: P2P first, load is shared, the
    same rule for every node, automatic).
    
    a. Operator switches. PIIK_CHANNEL_SERVICE_TRANSIT is the master switch, off
    by default. PIIK_CHANNEL_SERVICE_TRANSIT_SCREEN, _VOICE and _FILES default to
    true and each turns one kind off. Files include original video forwarded for
    watching together. With the master switch off nothing is offered. The offer
    reaches room hosts with the service socket. The room removes the service from
    the relays of a kind it does not offer, and the channel rejects a projection
    that gives the service such a kind as site transit. A service that offers no
    kind reads as unavailable.
    
    b. A new room allows the service. Creation paths apply only an explicit
    choice, so Browser, App and Server-hosted rooms and room copies take the
    default, and a stored false stays false. The setting reads as declining a
    default, and its note says the site forwards only the kinds its operator
    offers, in all five locales.
    
    c. The planner names the service as the fallback. When a route is assigned it
    first extends the tree with participant relays only, then lets the service
    reach the receivers still waiting. It keeps that tree unless the joint tree,
    where the service may take a scarce output, serves more receivers, so ties go
    to participants. A strict participant-first pass could spend the source's
    outputs on direct listeners and leave those reachable only through the
    service unserved; a test reproduces that. The ranking among participants is
    unchanged.
    
    The rule applies when a route is assigned. A receiver already served through
    the service keeps that route until it fails or demand ends, even if a
    participant path appears later. A screen viewer can still make the usual move
    to a direct path from the person sharing.
    
    Left open: in a public room the service's session has ordinary read access,
    so a modified room host can list it as a plain participant relay, without the
    transit view that carries the room's choice and the operator's kinds, even
    when forwarding is off. Closing it needs the channel to recognise the
    Server's own session by identity in rooms that session does not host.
    
    Tests added in channel-core: a participant wins over the service; the service
    serves only receivers no participant path reaches; the service takes a scarce
    source output when that serves more receivers; a moved child takes a ready
    participant before the service; the service carries only the kinds its
    operator offers; a service that offers no kind reads as unavailable; a new
    room uses the offered service until its manager declines. Expectations
    changed for the new default in host_review, service_transit, stored_room and
    the first test of tests/service-transit-wasm.test.ts.
    
    Verified on the lane: cargo test for piik-channel-core with and without
    sqlite, cargo check for channel-server and channel-browser, the
    room_creation_policy test, a rebuilt WASM package, tsc -b, the whole vitest
    suite and the docs check. The channel-native suites were not run.
  • fix(files): retire attachments by their content identity
    Match retained reads, saved results and in-flight downloads by size and SHA-256. Conditional IndexedDB deletion keeps an old tab from removing newer bytes or receipts at the same room attachment address. Explicit room and message cleanup retain their existing scope.
    
    The real Browser room restore and dual-tab FileStore controls reproduced stale content and cache removal before the change. Focused attachment, save-result and conditional-delete regressions pass.
  • fix(history): bind reading positions to restored history
    Keep a durable history lineage at each room writer. Ordinary rebinding preserves it; a full restore installs a fresh lineage in the same storage transaction. Scope reader positions to that lineage and keep passive queued projections from replacing another tab's saved reading progress.
    
    Private Domain protocol 47, SQLite 10 and Browser room IDB 8 replace the prior internal formats. Room archives and App wire are unchanged. Validated with the Rust/Web-WASM/protocol gate, real Browser writer restore and cross-tab read-marker controls. Local reading hints remain best-effort when a lagging tab is actively read across successive restores.
  • perf(wasm): transfer delivery bytes without JSON expansion
    Return FileDelivery and WatchDelivery effects in their existing order with owned Uint8Array payloads. Serialize only metadata through the original JSON path, retaining its integer semantics. Switch all attachment and watch consumers together, including failures and projection; no Cargo dependency or wire-format change.
    
    Validation: matched release-WASM controls measured 64 KiB Watch at 2.60 to 1.13 ms and 1 MiB File at 27.73 to 3.90 ms median local CPU. Actual Chrome production consumers verified OPFS/Watch hashes and a terminal outcome for a range beyond JS safe integers. The integrated 700 consumer tests and TypeScript passed. Compressed WASM grew 4146 bytes; no remote-throughput claim.
  • refactor(profile): derive updates from the shared command type
    Use the set_profile command as the parameter type for Browser actions, the Session, Node participant, profile editor and guide preview. Remove five copies of the same optional name and nullable avatar fields with no new generation dependency or change to runtime validation.
    
    Validation: both TypeScript projects compile; existing avatar set/clear and profile response controls passed.
  • fix(protocol): validate terminal results at their waiting operation
    A matching room reply must carry the outcome expected by the original operation. Browser and Node reject unknown results locally while ignoring observers and wrong-room IDs. Preserve invitation payload events followed by done, and distinguish joining Watch from leaving it. Core dispatch explicitly matches its current result variants.
    
    Validation: corrected three old Watch mocks that returned watch_ready to a leave operation; all 617 Browser/Node tests passed independently. The integrated delivery and interaction consumer run passed 700 tests and both TypeScript projects compiled. No new wire field or enum generator is added.
  • fix(storage): request durable commits for browser room writes
    Request strict IndexedDB durability for room creation, binding, policy/history mutation and final archive installation. Keep temporary archive staging, reads and participant file caches on their existing policy. Confirmation still follows transaction completion.
    
    Actual Chrome/WASM tests observed strict transactions, completion before confirmation, and abort without confirmation followed by same-nonce retry. Thirty-two interleaved messages per mode measured 1.75 ms strict versus 0.90 ms relaxed end-to-end medians on this machine. Durability is a browser hint; no physical power-loss claim or persistence-permission flow is added.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.