Skip to content

Give both web demos a photos surface and register their browser suites - #34

Merged
LucaCappelletti94 merged 3 commits into
mainfrom
feat/r69-web-photos
Sep 19, 2026
Merged

LucaCappelletti94 merged 3 commits into
mainfrom
feat/r69-web-photos

Conversation

@LucaCappelletti94

@LucaCappelletti94 LucaCappelletti94 commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Both web demos now speak photos. Their workers boot with photos in the upstream subscription set and a content namespace, their dashboards gained a photos panel that stages a picked jpeg or png through the tab-to-worker protocol with the photos row inserted in the same transaction, watches content_state arrive as available through replication, and renders the image from the resolved signed URL, refetching the resolve rather than caching the URL because tickets expire. The tab now splits a TabContent half off its transport before the connection, which is the same seam the wasm-smoke suites use.

Getting the demos onto the browser stack surfaced a real coupling this PR now makes explicit. The connection handshake compares a hash of the schema SQL text, so a demo whose schema.sql merely means the same thing as wasm-smoke's is rejected at connect with SchemaOutdated, which is exactly how the first draft of this branch failed. Each demo's schema.sql is therefore now a byte-identical copy of examples/wasm-smoke/schema.sql including comments, and the first test of each new suite is a plain orders insert observed through the demo's own boot path, a permanent drift detector that fails at the handshake the instant the two files diverge, so no header comment can be added to the schema files and none is warranted, the guard belongs in the suites and is commented there. The demos gained policies.sql verbatim from wasm-smoke, and owner_id is carried by every insert, add_order and staging closure alike, because the stack's reader role is a non-superuser and its RLS is genuinely enforced. Both demo suites are registered in the browser stack's default discovery, so they run in CI and not just in a local invocation. The one file touched outside the two demo workspaces and the registration is examples/wasm-smoke/Cargo.lock, where a build moved windows-sys forward from 0.52 to 0.61, that stays, per the no-holdback rule the graph moves forward.

Verification, yew suite 2 passed 0 failed and dioxus suite 2 passed 0 failed on the live browser stack under the stack port lock, the dioxus run re-executed after a post-review rsx fix to the panel, stable and nightly clippy clean for both demo workspaces for wasm32 and for the harness workspace, fmt clean across all three, and zero warnings from cargo check --all-targets in each demo. The plan row, the R69 section prose and the chapter status line now record E as built with the desktop demo as the only open surface.

Summary by Sourcery

Equip both web demos with replicated photo upload and display flows, enforce their schema and row-security alignment, and run their browser suites by default.

New Features:

  • Add photo upload and display surfaces to both the Yew and Dioxus web demos, including replicated availability state and signed-URL rendering.
  • Add end-to-end browser suites covering schema alignment and photo staging, replication, resolution, and download for both demos.

Bug Fixes:

  • Ensure demo writes include owner identities so row-level security is enforced correctly for non-superuser readers.
  • Prevent stale signed photo URLs from being reused after their tickets expire.

Enhancements:

  • Split tab content transport from the main connection so demos can use the browser content protocol.
  • Generate demo replica schemas and policy mappings from shared SQL inputs and add content-aware worker boot configuration.
  • Make the demo schemas match the wasm-smoke schema for reliable handshake version agreement.

CI:

  • Register the Yew and Dioxus browser suites in the default browser-stack discovery so they run in CI.

Documentation:

  • Update the file-handling architecture and implementation plan to mark the web-demo photo surfaces as complete while leaving the desktop demo open.

Tests:

  • Add first-test schema drift guards and live browser coverage for order alignment and complete photo round trips in both web demos.

Chores:

  • Advance the wasm-smoke lockfile dependency versions required by the updated dependency graph.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @LucaCappelletti94, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 2 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: LucaCappelletti94/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 09ede9a5-8da2-45dd-8436-63c267edf89e


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T09:47:45.101485Z 8e3b222 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai

sourcery-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Both Yew and Dioxus demos now support authenticated, owner-scoped photo staging and display through the worker/tab content protocol, with policy-aware replicated schemas, end-to-end browser coverage, default CI suite registration, and corresponding project-status updates.

Sequence diagram for demo photo staging and display

sequenceDiagram
    actor User
    participant Dashboard
    participant TabContent
    participant Worker
    participant Replica
    participant FileServer

    User->>Dashboard: Pick image file
    Dashboard->>TabContent: stage(blob, MimeClass::Jpeg, client, closure)
    TabContent->>FileServer: Stage content
    TabContent->>Replica: closure transaction
    Replica->>Replica: Insert orders and photos with owner_id
    Dashboard->>Worker: replay_pending()
    Worker->>FileServer: Commit staged content
    FileServer-->>Replica: Replicate content_state available
    Dashboard->>TabContent: resolve(file_id)
    TabContent->>FileServer: Resolve signed URL
    FileServer-->>Dashboard: Remote URL
    Dashboard-->>User: Render photo
Loading

Entity relationship diagram for owner-scoped photos

erDiagram
    orders ||--o{ photos : contains
    orders {
        UUID id PK
        TEXT owner_id
        BIGINT quantity
    }
    photos {
        UUID id PK
        UUID order_id FK
        TEXT owner_id
        BYTEA content_id
        TEXT content_state
    }
Loading

File-Level Changes

Change Details Files
Add end-to-end photo surfaces to both browser demos.
  • Add photo subscriptions, content namespaces, policy-aware worker boot, and tab content lanes.
  • Stage selected image files and atomically insert owner-scoped order/photo metadata.
  • Observe replicated availability state, resolve expiring signed URLs on availability changes, and render fetched images.
  • Add browser suites covering schema alignment, staging, commit, resolve, and HTTP byte round trips.
examples/yew-web-demo/Cargo.toml
examples/yew-web-demo/build.rs
examples/yew-web-demo/policies.sql
examples/yew-web-demo/schema.sql
examples/yew-web-demo/src/lib.rs
examples/yew-web-demo/src/main.rs
examples/yew-web-demo/tests/photo_flow.rs
examples/dioxus-web-demo/Cargo.toml
examples/dioxus-web-demo/build.rs
examples/dioxus-web-demo/policies.sql
examples/dioxus-web-demo/schema.sql
examples/dioxus-web-demo/src/lib.rs
examples/dioxus-web-demo/src/main.rs
examples/dioxus-web-demo/tests/photo_flow.rs
Make schema and row-level-security coupling explicit and enforce it in the demo test path.
  • Align demo schemas byte-for-byte with wasm-smoke so schema-hash handshakes succeed.
  • Add owner_id to synced rows and pass caller identity on every write for enforced reader-role RLS.
  • Translate policies into replica DDL and configure caller identity and policy tables in workers.
  • Use each suite's initial orders round trip as a permanent schema-drift handshake detector.
examples/yew-web-demo/schema.sql
examples/yew-web-demo/policies.sql
examples/yew-web-demo/build.rs
examples/yew-web-demo/src/lib.rs
examples/yew-web-demo/tests/photo_flow.rs
examples/dioxus-web-demo/schema.sql
examples/dioxus-web-demo/policies.sql
examples/dioxus-web-demo/build.rs
examples/dioxus-web-demo/src/lib.rs
examples/dioxus-web-demo/tests/photo_flow.rs
Register both demo browser suites in default browser-stack discovery.
  • Collect tests from both demo workspaces alongside wasm-smoke tests so CI runs them by default.
crates/connetto-test-harness/src/bin/connetto-browser-stack.rs
Record the completed web-demo photo surface in project documentation and update the lockfile graph.
  • Mark R69 E as built and leave the desktop demo as the remaining open surface.
  • Advance the wasm-smoke lockfile dependency graph after the windows-sys update.
docs/architecture/18-file-handling.md
plans/master-implementation-plan.md
examples/wasm-smoke/Cargo.lock

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e3b222c6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +487 to +490
let mut transport =
MessageTransport::<BroadcastChannel>::with_peer_liveness(&wire, workers::DB_ALIVE_LOCK)
.map_err(|err| JsValue::from_str(&err.to_string()))?;
let content = Rc::new(TabContent::new(&mut transport));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rebind the content lane when the client reconnects

After a worker or leader replacement, with_reconnect uses tab_wire_factory to create a fresh wire, but this TabContent remains bound to the original boot transport. BroadcastChannel sends to that abandoned wire still report success, so resolves wait until timeout and newly staged blobs go to the old channel while their mutations go to the new one, causing the hub to reject or roll back the photo. The content lane needs to be recreated or rebound alongside every reconnect; the Dioxus demo has the same pattern.

Useful? React with 👍 / 👎.

Comment on lines +1252 to +1255
let available: Vec<(rosetta_uuid::Uuid, Vec<u8>)> = photo_rows
.iter()
.filter(|p| p.content_state.as_deref() == Some("available"))
.map(|p| (p.id, p.content_id.clone()))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve pending photos so offline picks remain visible

When a photo is staged while the upstream connection is unavailable, its content_state remains null and TabContent::resolve would return TabResolved::Local; filtering exclusively for available prevents that resolution entirely, leaving the newly picked offline photo as a blank pending row. The resolver also needs to handle and retain an object URL for the local result. The identical filter in the Dioxus surface has the same problem.

Useful? React with 👍 / 👎.

Comment on lines +1322 to +1325
let key: Vec<rosetta_uuid::Uuid> = available.iter().map(|(id, _)| *id).collect();
use_effect(move || {
let _key = key.clone();
let available = available.clone();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Track photo changes inside the Dioxus effect

If the dashboard mounts before any photo is available, this effect runs with an empty captured vector and never subscribes to a reactive signal: _key is only an ordinary Vec, not a signal read. Consequently, the later pending-to-available live-query update does not rerun the resolver and newly uploaded photos keep an empty image cell. Read the live photo signal inside the effect or use an explicit reactive dependency.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.25%. Comparing base (9eb3c26) to head (41e0089).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
- Coverage   83.27%   83.25%   -0.03%     
==========================================
  Files         114      114              
  Lines       25700    25700              
  Branches    25700    25700              
==========================================
- Hits        21402    21396       -6     
- Misses       3073     3079       +6     
  Partials     1225     1225              
Flag Coverage Δ
client 64.16% <ø> (-0.05%) ⬇️
rest 56.00% <ø> (-0.38%) ⬇️
server 48.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
31.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@LucaCappelletti94
LucaCappelletti94 merged commit 4403d10 into main Sep 19, 2026
58 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant