Skip to content

SELF-2469: SDK Distribution: Hosted URL loading + native shell publishing#1938

Open
jcortejoso wants to merge 19 commits into
devfrom
self-2469/sdk-distribution
Open

SELF-2469: SDK Distribution: Hosted URL loading + native shell publishing#1938
jcortejoso wants to merge 19 commits into
devfrom
self-2469/sdk-distribution

Conversation

@jcortejoso

@jcortejoso jcortejoso commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

Three URL constants and test fixtures still referenced https://self-app-alpha.vercel.app after the SD-01/SD-02 migration to https://verify.self.xyz/v1/:

  • SelfWebViewHost.defaultRemoteBaseURL (iOS) — internal fallback used when no URL is passed to the host directly; SelfSdkConfig was already updated but this constant was missed
  • SelfWebViewHostTests (iOS) — three tests asserting against the stale default (testReleaseBuildUsesRemoteOrigin, testAllowedNavigationAcceptsRemoteAlphaOrigin, testBridgeTrustAcceptsRemoteRejectsDidit)
  • AndroidWebViewHostSecurityTest — three tests using self-app-alpha.vercel.app as explicit remoteBase for navigation-policy behavior tests (navigation allows remote didit and debug origins, didit on non-443 port is rejected, bridge trust accepts remote rejects didit and arbitrary origins)

Note: packages/kmp-sdk still contains stale references — out of scope for this PR (separate package).

Test plan

  • iOS: existing SelfWebViewHostTests suite updated and passing
  • Android: existing AndroidWebViewHostSecurityTest suite updated and passing
  • CI green on all workflows ✅

Native Consolidation Checklist

  • CONTRACTS.md reviewed - no unintended contract changes
  • Layer 1 bridge contract tests pass (cd app && yarn jest:run / yarn workspace @selfxyz/rn-sdk-test-app test)
  • Layer 3 builds pass (app iOS, RN test app iOS, RN test app Android)
  • Layer 4 manual smoke test signed off (if consolidation PR)
  • No new native business logic added (logic belongs in TypeScript)

@vercel

vercel Bot commented Apr 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
self-webview-app Ignored Ignored Preview Apr 8, 2026 1:37pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds CI workflows for publishing Android SDK and deploying WebView; introduces Android/iOS SDK packaging and docs; updates WebView app build/hosting (basename, Vite base, Vercel rewrites/headers); and changes default SDK remote base URLs from the alpha host to https://verify.self.xyz/v1/.

Changes

Cohort / File(s) Summary
CI / Workflows
​.github/workflows/publish-android-sdk.yml, ​.github/workflows/webview-deploy.yml
New GitHub Actions: publish-android-sdk (dispatch, version validation, Gradle build/publish with dry-run) and webview-deploy (on main for webview-related packages and dispatch; builds and deploys to Vercel).
Android packaging & docs
packages/native-shell-android/README.md, packages/native-shell-android/build.gradle.kts
Added README describing Gradle/GitHub Packages consumption; added maven-publish config publishing xyz.self.sdk:native-shell-android:0.1.0 to GitHub Packages with env/property credential fallbacks.
Android runtime defaults & activity
packages/native-shell-android/src/main/kotlin/.../SelfSdkConfig.kt, packages/native-shell-android/src/main/kotlin/.../webview/AndroidWebViewHost.kt, packages/native-shell-android/src/main/kotlin/.../webview/SelfVerificationActivity.kt
Default remoteWebAppBaseUrl updated from https://self-app-alpha.vercel.apphttps://verify.self.xyz/v1/.
Android tests
packages/native-shell-android/src/test/kotlin/.../AndroidWebViewHostSecurityTest.kt
Test expectations updated to use https://verify.self.xyz variants.
iOS packaging, docs & ignore
packages/native-shell-ios/.gitignore, packages/native-shell-ios/README.md, packages/native-shell-ios/SelfSDK.podspec
Added .gitignore, README with SPM/CocoaPods instructions, and Podspec for SelfSDK v0.1.0 (iOS 15.0+, Swift 5.9).
iOS runtime defaults & tests
packages/native-shell-ios/Sources/SelfNativeShell/API/SelfSdkConfig.swift, packages/native-shell-ios/Sources/.../WebView/SelfWebViewHost.swift, packages/native-shell-ios/Tests/.../SelfWebViewHostTests.swift
Default remoteWebAppBaseURL updated to https://verify.self.xyz/v1/; tests adjusted to expect new host/path prefixes.
WebView app build & hosting
packages/webview-app/package.json, packages/webview-app/scripts/prepare-hosted.mjs, packages/webview-app/src/App.tsx, packages/webview-app/vercel.json, packages/webview-app/vite.config.ts
Added build:hosted script and staging script; router basename derived from env; Vite base now from VITE_BASE_PATH; Vercel rewrites/headers added including /v1/:path* and cache headers for assets and index.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title is clear and directly describes the main changes: publishing native SDKs and updating hosted URLs for the distribution migration.
Description check ✅ Passed Description provides clear summary, specific test plan with passing results, and demonstrates consolidation checklist adherence with only non-applicable business logic item checked.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch self-2469/sdk-distribution

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.

SD-03: Configure webview-app for Vercel deployment at /v1/ base path.

- Make Vite base path configurable via VITE_BASE_PATH env var
- Add BrowserRouter basename derived from import.meta.env.BASE_URL
- Add build:hosted script producing dist/v1/ directory structure
- Add vercel.json with SPA rewrites, caching headers, and build config
- Add GitHub Actions workflow for Vercel deployment on push to main

Default embedded mode (base: './') is unchanged. Hosted mode activates
when VITE_BASE_PATH=/v1/ is set at build time.

Ref: SELF-2469
Add maven-publish plugin with groupId=xyz.self.sdk,
artifactId=native-shell-android, version=0.1.0.

Verified: publishToMavenLocal succeeds, AAR contains no bundled
web assets, POM includes correct runtime dependencies.

Ref: SELF-2473
- Add GitHubPackages maven repository to publishing block
  (credentials from GITHUB_ACTOR/GITHUB_TOKEN env or gpr.user/gpr.token properties)
- Add publish-android-sdk.yml workflow (manual dispatch with version input)
  - Builds, tests, then publishes release AAR to GitHub Packages

Ref: SELF-2473
Defaults to dry-run (publishToMavenLocal) so the workflow can be
tested safely. Uncheck dry-run to publish to GitHub Packages.

Ref: SELF-2473
SPM, CocoaPods (via Git), and GitHub Packages (Maven) instructions
with credential setup and requirements.

Ref: SELF-2474
…self.xyz

Update default URL in SelfVerificationActivity and test assertions
to match the new hosted URL after rebase onto dev.
@jcortejoso jcortejoso force-pushed the self-2469/sdk-distribution branch from 2b20b0a to 7e80e65 Compare April 8, 2026 06:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/AndroidWebViewHost.kt (1)

136-141: ⚠️ Potential issue | 🔴 Critical

remoteWebAppBaseUrl is no longer an exclusive allowlist.

shouldAllowNavigation() and onPermissionRequest() always trust the default hosted origin even when callers pass a different remoteWebAppBaseUrl or null. A redirect or window.location change can therefore escape a custom-host or bundled-only configuration and keep the bridge plus camera/mic access on an origin the caller did not authorize.

Based on learnings, "Fail closed on security-critical boundaries. Default-deny for protocol compatibility, remote bundle loading, and verification session lifecycle. Reject unknown protocol versions, block remote devServerUrl in production".

Also applies to: 246-253, 346-347


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5fb09f5f-0e30-4e04-9398-4844831a9d4a

📥 Commits

Reviewing files that changed from the base of the PR and between 06a5139 and 2b20b0a.

📒 Files selected for processing (22)
  • .github/workflows/publish-android-sdk.yml
  • .github/workflows/webview-deploy.yml
  • packages/native-shell-android/README.md
  • packages/native-shell-android/build.gradle.kts
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/api/SelfSdkConfig.kt
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/AndroidWebViewHost.kt
  • packages/native-shell-android/src/test/kotlin/xyz/self/sdk/api/SelfSdkConfigTest.kt
  • packages/native-shell-android/src/test/kotlin/xyz/self/sdk/api/SelfSdkLaunchTest.kt
  • packages/native-shell-android/src/test/kotlin/xyz/self/sdk/webview/AndroidWebViewHostTest.kt
  • packages/native-shell-ios/.gitignore
  • packages/native-shell-ios/Package.swift
  • packages/native-shell-ios/README.md
  • packages/native-shell-ios/SelfSDK.podspec
  • packages/native-shell-ios/Sources/SelfNativeShell/API/SelfSdkConfig.swift
  • packages/native-shell-ios/Sources/SelfNativeShell/WebView/SelfWebViewHost.swift
  • packages/native-shell-ios/Tests/SelfNativeShellTests/RemoteNavigationPolicyTests.swift
  • packages/native-shell-ios/Tests/SelfNativeShellTests/SelfSdkConfigTests.swift
  • packages/webview-app/package.json
  • packages/webview-app/scripts/prepare-hosted.mjs
  • packages/webview-app/src/App.tsx
  • packages/webview-app/vercel.json
  • packages/webview-app/vite.config.ts

Comment thread packages/native-shell-android/README.md
Comment thread packages/webview-app/package.json Outdated
Comment thread packages/webview-app/vercel.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/native-shell-android/README.md (1)

16-17: ⚠️ Potential issue | 🟠 Major

settings.gradle.kts sample uses an unavailable API and will break consumer setup.

Line 16 and Line 17 use project.findProperty(...), which is not valid in a settings.gradle.kts context. Consumers following this README will fail dependency configuration.

Suggested fix
 dependencyResolutionManagement {
     repositories {
         google()
         mavenCentral()
         maven {
             url = uri("https://maven.pkg.github.com/selfxyz/self")
             credentials {
-                username = project.findProperty("gpr.user") as String?
-                password = project.findProperty("gpr.token") as String?
+                username = providers.gradleProperty("gpr.user").orNull
+                password = providers.gradleProperty("gpr.token").orNull
             }
         }
     }
 }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6ca82f66-d406-4a20-8396-4058a373c9f4

📥 Commits

Reviewing files that changed from the base of the PR and between 2b20b0a and 7e80e65.

📒 Files selected for processing (17)
  • .github/workflows/publish-android-sdk.yml
  • .github/workflows/webview-deploy.yml
  • packages/native-shell-android/README.md
  • packages/native-shell-android/build.gradle.kts
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/api/SelfSdkConfig.kt
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/AndroidWebViewHost.kt
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
  • packages/native-shell-android/src/test/kotlin/xyz/self/sdk/webview/AndroidWebViewHostSecurityTest.kt
  • packages/native-shell-ios/.gitignore
  • packages/native-shell-ios/README.md
  • packages/native-shell-ios/SelfSDK.podspec
  • packages/native-shell-ios/Sources/SelfNativeShell/API/SelfSdkConfig.swift
  • packages/webview-app/package.json
  • packages/webview-app/scripts/prepare-hosted.mjs
  • packages/webview-app/src/App.tsx
  • packages/webview-app/vercel.json
  • packages/webview-app/vite.config.ts
✅ Files skipped from review due to trivial changes (9)
  • packages/native-shell-ios/.gitignore
  • packages/webview-app/package.json
  • packages/webview-app/scripts/prepare-hosted.mjs
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/SelfVerificationActivity.kt
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/api/SelfSdkConfig.kt
  • packages/native-shell-ios/SelfSDK.podspec
  • .github/workflows/webview-deploy.yml
  • packages/native-shell-android/src/main/kotlin/xyz/self/sdk/webview/AndroidWebViewHost.kt
  • packages/native-shell-android/build.gradle.kts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/webview-app/vite.config.ts
  • packages/webview-app/vercel.json
  • packages/native-shell-ios/Sources/SelfNativeShell/API/SelfSdkConfig.swift

Comment thread .github/workflows/publish-android-sdk.yml
@jcortejoso

Copy link
Copy Markdown
Member Author

@codex review
@copilot review

- README: use providers.gradleProperty() instead of project.findProperty()
  (settings.gradle.kts uses Settings, not Project)
- package.json: restore tsc --noEmit in build:hosted to catch TS errors
- vercel.json: add /v1/ cache header rules for hosted deployment paths
- publish workflow: add version input validation to prevent shell injection

Ref: SELF-2469

@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: 7e80e65bb3

ℹ️ 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 thread packages/webview-app/vercel.json
Comment thread .github/workflows/webview-deploy.yml

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown

@codex review
@copilot review

Reviewed all changes. Found one stale reference missed during the SD-02 migration: SelfWebViewHost.defaultRemoteBaseURL was still https://self-app-alpha.vercel.app while SelfSdkConfig was already updated. Fixed in 03fc4f8 along with three iOS tests that asserted against that old default (testReleaseBuildUsesRemoteOrigin, testAllowedNavigationAcceptsRemoteAlphaOrigin, testBridgeTrustAcceptsRemoteRejectsDidit).

Other observations (no code changes needed):

  • Path construction with trailing slash: makeEntryURL trims slashes before joining (trimmingCharacters(in: "/")) and Android uses trimEnd('/'), so https://verify.self.xyz/v1//v1/tunnel/tour/1 with no double slashes. ✅
  • vercel.json SPA rewrite: The rewrite "/(.*)" → "/index.html" is correct for the Vercel Git integration which uses yarn build (non-hosted). The hosted deployment via the GitHub Actions workflow will need --prebuilt added to the vercel-args to use the pre-built dist/v1/ output; without it Vercel re-runs the buildCommand from vercel.json anyway.
  • amondnet/vercel-action@v25: Uses a mutable tag — pinning to a SHA would follow CI hardening best practices.

Copilot AI changed the title feat: SELF-2469 — SDK Distribution (hosted URL loading + native shell publishing) fix: correct stale defaultRemoteBaseURL in SelfWebViewHost and aligned iOS tests Apr 8, 2026
@jcortejoso

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 93f1966d-bf61-48e9-8516-5663bbb60fc8

📥 Commits

Reviewing files that changed from the base of the PR and between 7e80e65 and 03fc4f8.

📒 Files selected for processing (6)
  • .github/workflows/publish-android-sdk.yml
  • packages/native-shell-android/README.md
  • packages/native-shell-ios/Sources/SelfNativeShell/WebView/SelfWebViewHost.swift
  • packages/native-shell-ios/Tests/SelfNativeShellTests/SelfWebViewHostTests.swift
  • packages/webview-app/package.json
  • packages/webview-app/vercel.json
✅ Files skipped from review due to trivial changes (3)
  • packages/webview-app/package.json
  • packages/webview-app/vercel.json
  • packages/native-shell-android/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/publish-android-sdk.yml

- vercel.json: add /v1/:path* rewrite to /v1/index.html for hosted
  deployment (native shells load from verify.self.xyz/v1/)
- webview-deploy.yml: add common/** to path triggers since
  @selfxyz/common is an explicit build dependency

Ref: SELF-2469
- Fix last self-app-alpha.vercel.app reference in SelfWebViewHostTests
- Add --prebuilt to vercel-args so the workflow uses our build:hosted
  output instead of Vercel re-running its own buildCommand

Ref: SELF-2469
Align WebViewProviderImpl default remote URL and test assertions
with the production hosted URL. Avoids split production behavior
between native-shell-ios and self-sdk-swift.

Ref: SELF-2469
@jcortejoso jcortejoso changed the title fix: correct stale defaultRemoteBaseURL in SelfWebViewHost and aligned iOS tests feat: SELF-2469 — SDK Distribution (hosted URL loading + publishing) Apr 8, 2026
@jcortejoso

Copy link
Copy Markdown
Member Author

@copilot review
@codex review

…ity tests

Agent-Logs-Url: https://github.com/selfxyz/self/sessions/0d67dd0f-cd2d-4aaa-9143-4e25652d681e

Co-authored-by: jcortejoso <5635989+jcortejoso@users.noreply.github.com>

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown

@copilot review
@codex review

Reviewed all 21 files in the PR. Found one remaining issue: three Android security tests (navigation allows remote didit and debug origins, didit on non-443 port is rejected, bridge trust accepts remote rejects didit and arbitrary origins) still used self-app-alpha.vercel.app as the explicit remoteBase variable for navigation policy behavior tests. Updated in f09d761.

The kmp-sdk package also contains stale self-app-alpha.vercel.app references but those are out of scope for this PR (separate package not modified here).

Everything else looks correct:

  • All defaults consistently point to https://verify.self.xyz/v1/ across Android, iOS, and self-sdk-swift
  • Path construction with trailing slash is safe (both makeEntryURL and Android trimEnd('/') handle it)
  • vercel.json has SPA rewrites for both root and /v1/ with correct caching headers
  • webview-deploy.yml includes --prebuilt in vercel-args
  • publish-android-sdk.yml uses env var injection (not shell interpolation) for version validation and sed replacement
  • All CI checks passing ✅

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Copilot AI changed the title feat: SELF-2469 — SDK Distribution (hosted URL loading + publishing) fix: clean up stale self-app-alpha.vercel.app references across native shells Apr 8, 2026

@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: c3f6c71edf

ℹ️ 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 thread .github/workflows/webview-deploy.yml
Comment thread packages/webview-app/scripts/prepare-hosted.mjs
@jcortejoso jcortejoso changed the title fix: clean up stale self-app-alpha.vercel.app references across native shells SELF-2469: SDK Distribution: Hosted URL loading + native shell publishing Apr 8, 2026
- actions/checkout v4.3.1 (34e11487)
- actions/setup-java v4.8.0 (c1e32368)
- amondnet/vercel-action v25.2.0 (16e87c0a)

Ref: SELF-2469
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.

2 participants