fix: [MR-175] add debug-only custom cr_user_id and local sub-app redirect - #283
fix: [MR-175] add debug-only custom cr_user_id and local sub-app redirect#283janfb-codev wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughDebug builds now support configurable local sub-app redirects, loopback HTTP access, and a custom ChangesDebug development controls
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Developer
participant WebAppsAdapter
participant WebApp
participant LocalSubAppServer
Developer->>WebAppsAdapter: configure debug redirect properties
WebAppsAdapter->>WebAppsAdapter: match and rewrite sub-app origin
WebAppsAdapter->>WebApp: launch local URL with original deployed URL
WebApp->>LocalSubAppServer: load redirected sub-app
WebApp->>WebApp: retain deployed hostname and FTM identity
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@app/src/main/java/org/curiouslearning/container/presentation/adapters/WebAppsAdapter.java`:
- Around line 184-191: Update the URL reconstruction in WebAppsAdapter to add
the container parameters to the query component before restoring the fragment,
rather than appending them after the fragment. Use a URI builder to preserve
existing query values and safely encode the added source, campaign_id,
container_app_version, and cr_user_id parameters, and add coverage for URLs
containing both query and fragment components.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ff6809f0-8107-46eb-b314-8b7d1481810a
⛔ Files ignored due to path filters (1)
.claude/skills/test-subapp-locally/SKILL.mdis excluded by!**/*.md
📒 Files selected for processing (9)
app/build.gradleapp/src/debug/AndroidManifest.xmlapp/src/debug/res/xml/network_security_config.xmlapp/src/main/java/org/curiouslearning/container/MainActivity.javaapp/src/main/java/org/curiouslearning/container/WebApp.javaapp/src/main/java/org/curiouslearning/container/presentation/adapters/WebAppsAdapter.javaapp/src/main/res/layout/language_popup.xmlapp/src/main/res/values/strings.xmllocal.properties.example
Changes
Two debug-only testing tools. Both are no-ops in release builds.
cr_user_id: debug-only field in the language popup to override the device's randompseudoId, so a tester can target a known Firestore doc. Honored by bothWebAppandMainActivity.warmFirestoreDataSync().WebAppsAdapter.maybeOverrideAppUrlForLocalDev()rewrites a matching sub-app URL to a local dev server. Replaces the origin only — path dropped, query/fragment preserved.local.propertieskeys (gitignored), read intoLOCAL_SUBAPP_*on thedebugbuildType. CI has nolocal.properties, so the redirect is inert in the debug APK CI commits for testers — nothing to revert before pushing. Seelocal.properties.example.test-subapp-locallyskill documenting the full rig.How to test
local.properties.example,npm run devin FeedTheMonsterJS (:8080),adb reverse tcp:8080 tcp:8080, run debug from Android Studio, tap FTM. Expect theWebAppsAdapter: DEBUG sub-app URL override: ... -> http://localhost:8080/?...log and the local build loading. Confirm monster-state polling still fires andattribution.hostnameholds the real host, notlocalhost.cr_user_id: debug build → enter a known id in the language popup → launch FTM → payload lands on that doc. Not visible in release.Ref: MR-175
Summary by CodeRabbit
New Features
Documentation