Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Sep 28, 2025

Summary

  • add an in-memory DocumentsAdapter and provider wrapper so the demo can construct a Self client with stubbed adapters
  • persist generated mock documents into the catalog and surface a success summary, updating the home menu to unlock register/prove actions when a document exists
  • extend the Jest setup and tests to exercise the new persistence flow and verify the gated buttons unlock after storage

Testing

  • yarn workspace mobile-sdk-demo test

https://chatgpt.com/codex/tasks/task_b_68d9adc96bfc832db33256f0cdc4ab23

Summary by CodeRabbit

  • New Features

    • Dynamic home menu that reflects available documents; actions are disabled until a document exists.
    • Generate Mock Data now saves to a document catalog and updates the selected document; Register and Prove flows use the selected document.
    • Back to Menu returns to home and refreshes the catalog.
  • Improvements

    • App bootstrapped with providers for safe area and client context to ensure consistent behavior.
  • Tests

    • Added end-to-end tests covering catalog creation, UI gating, navigation, and full Generate/Register/Prove flows.

* clean onboarding camera screens

* remove remaining aesop artifacts. fix tests
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 28, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Implements a SelfClient provider and in-memory documents adapter, rewires the app to load/manage a document catalog, updates UI navigation to gate features by catalog state, replaces GenerateMock flow to persist documents and catalog metadata, wraps the app with providers, and expands tests/mocks to support the new client-driven flows.

Changes

Cohort / File(s) Summary
App integration and navigation
packages/mobile-sdk-demo/App.tsx, packages/mobile-sdk-demo/index.js
App now consumes SelfClient via new provider, loads catalog/selected document on mount/refresh, derives dynamic menu with disabled states, guards navigation based on catalog presence, adds back-to-menu refresh; entry wraps App with SafeAreaProvider and SelfClientProvider.
Mock generation and persistence
packages/mobile-sdk-demo/src/GenerateMock.tsx
Generates mock, computes content hash, saves document, updates catalog metadata, sets success UI, invokes onPersist; replaces onGenerate with onPersist and uses useSelfClient.
SelfClient context and adapters
packages/mobile-sdk-demo/src/selfClient/Provider.tsx, packages/mobile-sdk-demo/src/selfClient/inMemoryDocumentsAdapter.ts
Adds SelfClientProvider/useSelfClient; introduces in-memory DocumentsAdapter supporting load/save catalog, save/load/delete document, deduplication, and selectedDocumentId handling; stubs other adapters for demo.
Testing and mocks
packages/mobile-sdk-demo/__tests__/App.test.tsx, packages/mobile-sdk-demo/jest.setup.js
Tests wrap App with SelfClientProvider, capture client, drive end-to-end flows, and validate catalog/document hashing; jest setup adds richer mocks for picker, @selfxyz/common (hashing/helpers), @selfxyz/mobile-sdk-alpha (createSelfClient, events), safe-area, and ethers.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant App
  participant SelfClientProvider
  participant SelfClient
  participant DocumentsAdapter as InMemoryDocumentsAdapter

  User->>App: Launch app
  App->>SelfClientProvider: useSelfClient()
  SelfClientProvider-->>App: SelfClient instance
  App->>SelfClient: loadDocumentCatalog()
  SelfClient->>DocumentsAdapter: loadDocumentCatalog()
  DocumentsAdapter-->>SelfClient: Catalog (documents, selectedId)
  SelfClient-->>App: Catalog
  App->>App: Compute screenDescriptors (hasDocuments)
  Note over App: Menu buttons enabled/disabled based on catalog
Loading
sequenceDiagram
  autonumber
  actor User
  participant App
  participant GenerateMock
  participant SelfClient
  participant DocumentsAdapter as InMemoryDocumentsAdapter

  User->>App: Tap "Generate Mock Data"
  App->>GenerateMock: Render with onPersist/onBack
  User->>GenerateMock: Press Generate
  GenerateMock->>SelfClient: saveDocument(...)
  SelfClient->>DocumentsAdapter: saveDocument(...)
  DocumentsAdapter-->>SelfClient: { id, metadata }
  GenerateMock->>SelfClient: loadDocumentCatalog() / saveDocumentCatalog(updated)
  SelfClient->>DocumentsAdapter: load/save catalog
  GenerateMock-->>App: onPersist()
  App->>SelfClient: reload catalog
  App->>App: Update menu (now enabled)
  User->>GenerateMock: Back
  GenerateMock-->>App: onBack()
  App->>App: Navigate to menu
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • shazarre
  • aaronmgdr

Poem

New client in the wings, the catalog takes flight,
Buttons wake from gray to green-lit night.
Hashes hum softly, documents align,
In-memory shelves keep IDs in line.
Tap, persist, return to home—
A tidy demo’s polished roam.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/implement-lightweight-documents-adapter-and-provider

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd8d425 and 0f802f5.

📒 Files selected for processing (7)
  • packages/mobile-sdk-demo/App.tsx (4 hunks)
  • packages/mobile-sdk-demo/__tests__/App.test.tsx (2 hunks)
  • packages/mobile-sdk-demo/index.js (1 hunks)
  • packages/mobile-sdk-demo/jest.setup.js (2 hunks)
  • packages/mobile-sdk-demo/src/GenerateMock.tsx (7 hunks)
  • packages/mobile-sdk-demo/src/selfClient/Provider.tsx (1 hunks)
  • packages/mobile-sdk-demo/src/selfClient/inMemoryDocumentsAdapter.ts (1 hunks)

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 and usage tips.

@transphorm transphorm changed the base branch from dev to codex/review-mobile-sdk-demo-app-for-polish-suggestions September 28, 2025 22:11
@transphorm
Copy link
Member Author

opened against wrong branch

@transphorm transphorm closed this Sep 28, 2025
@transphorm transphorm deleted the codex/implement-lightweight-documents-adapter-and-provider branch October 1, 2025 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants