-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS reviewers wanted for partial update PRs #268
Comments
I'll finish up the instructions later, @riderx. cc: |
Hey @ayewo, I do have access to Xcode and the iOS simulator. How do you want me to review it? What are the steps? I see you mentioning 4 repos to test, but how? 😅 |
Hey @rishi-raj-jain I've updated the issue above with plenty of step-by-step info and a few screen shots to help you complete the review. Don't hesitate to ask for help here or in Discord. |
@rishi-raj-jain yes, just keep in mind it's a bit hard for me to remember all tips i have to do so if i miss one tell me :) |
Haha sure thing, I'm hungry anyways. |
From @ayewo,
|
How can I get a AWS account to use in 3.1? @riderx can you share? |
@rishi-raj-jain Alternatively, you could try setting up Minio locally by following the Capgo docs mentioned in footnote [3]:
|
@rishi-raj-jain you can also use R2 instead, it simpler. |
@rishi-raj-jain were you able to make any progress since you started last week? |
commenting to remember myself to help reviewing this 😄 |
Can I try to review this? new to Cap-go, as of now trying to learn this system but based on the above review of 14 pro, I can check this on latest simulator too. I have latest xcode and simulator setup. |
Yes please |
Need help with Supabase local setup. Supautils extension is not getting installed on my local supabase setup. Environment details expand this for log
./node_modules/supabase/bin/supabase start --debug |
@Akki9326 how are you attempting to deploy Supabase? What commit are you using? Since you are not yet familiar with the app, to avoid getting blocked by code drift in the Once you are familiar with the app, you can retest the partial update feature on a more recent branch like |
I'm using feature/partial-update branch from @ayewo's fork. as mentioned in step 3.3 |
@Akki9326 It's hard to make sense of your issue without additional info/context. Looking at the error:
There is no extension with the name |
sure, let me try that. |
this is resolved with main branch, moving on with another setup... |
@ayewo I will be starting the review of your changes |
@ayewo I have come to the conclusion that you have not followed the insurrections given in the main issue. The idea was to upload file by file. Instead you added a fancy filter to remove binary files (assets) from the zip file if the user has already downloaded said assets. This is not at all what we expected. In the initial pr it was said
What I have envisioned is something like this I've attempted to explain this here and although the proposal made in that comment is way to complex the main principal still applies. Instead what you implemented is something like this: Your solution allows a user currently on This could work except when you conciser the downsides:
In fairness your pr does have some value but I don't think it's something that can be implemented in prod. |
I was able to write a simple PoC of my idea. Here is the video. Since I don't think there is any way to get your idea working I will be attempting to implement this. I will write the backend + CLI + migration guide + android plugin. Help on the IOS side would be nice since I don't own a mac 2024-03-10.19-15-14.mp4 |
Thank you so much for the work, everyone! |
/tip $20 @rishi-raj-jain |
/tip $20 @ayewo |
🎉🎈 @rishi-raj-jain has been awarded $20! 🎈🎊 |
/tip $20 @WcaleNieWolny |
🎉🎈 @ayewo has been awarded $20! 🎈🎊 |
/tip $20 @Akki9326 |
🎉🎈 @WcaleNieWolny has been awarded $20! 🎈🎊 |
@Akki9326: You just got a $20 tip! 👉 Complete your Algora onboarding to collect your payment. |
@riderx finally after 1 year, 3 weeks and 4 days :) BTW, what's the purpose of the tip since none of the commenters above committed to do the review on iOS? |
Yea it took eternity! |
/tip $400 @ayewo |
🎉🎈 @ayewo has been awarded $400! 🎈🎊 |
1.0. Support for partial update has been added
I have opened the following PRs, which add support for partial update to Capgo, to close issue #119 and potentially issue #225:
Cap-go/capacitor-updater
repo;Cap-go/CLI
repo;Cap-go/capgo
repo;Cap-go/demo-app
repo.We need 1-2 reviewers with access to Xcode and the iOS simulator to deploy the changes locally and verify that everything works, end-to-end.
1.1. Review expectations
Cap-go/demo-app
;In addition to code review, please document any trouble you encounter while trying out the partial update feature on iOS. This is important because if the steps are not clear to you, then other developers that are the target of this feature will struggle to set it up.
1.2. Payment
Due to the effort required to sign-off on this new feature, I’ve suggested to Martin to pay $801 for your time.
1.3. Todo list
No need to raise the following items in your review as they are on my todo-list:
For the
Cap-go/CLI
repo, the file extension regex for matching binary files2 to be removed from a partial update is not exhaustive. I used a limited set of file extensions to allow me ship v1. It can be trivially updated to include a more complete list of file extensions for image / video / font extensions later.For the
Cap-go/capacitor-updater
repo, Android is not yet done. The port is straight forward to code. I wanted to get to the point where I could get feedback from Martin about my implementation. There's the risk that he might make suggestions that might cause me to rework parts of the solution which is why I deferred updating the Android version of the plugin.For all repos, my branch is a few commits behind
main
. That's to be expected sincemain
is a moving target. I was originally pulling changes frommain
at the start of the work day but a few commits introduced breaking changes that interrupted my work causing me to spend time fixing bugs. Again, once Martin green-lights the solution, I will of course pull in the latest frommain
beforefeature/partial-update
branch across the 3 repos are merged.Please don't dwell on minutiae like local development files
config.json
,localhost.pem
that I added to theCap-go/capgo
repo. They were committed for convenience to keep these instructions short. Of course I will remove them before merging.2.0. Design
To understand how the changes below fit together, you may want to first read the design proposal. It’s >2000 words of prose, the bulk of which are illustrative examples, so it should be a quick read, if you are already familiar with the codebase.
My implementation deviates slightly from the design I proposed so be sure to also read the next section.
2.1. Implementation notes
1. Partial bundles are named
<target_version>-basedon-<source_version>
Capgo encourages devs to use semver to name their bundles e.g. 1.0.0, 1.0.3 etc.
For the partial update feature, I decided to make it easy to tell how a partial bundle was created by using the following format for the file name (which adheres to semver):
where
<target_version>
is the current version to be uploaded e.g. 1.0.3;and
<source_version>
is the version that an end user is currently on e.g. 1.0.2;So a partial bundle will typically be named 1.0.3-basedon-1.0.2.
2. Slight alteration of how the CLI works
I originally wanted to avoid impacting how the CLI currently works, so as part of adding support for partial updating, if the
partialUpdate
flag is set totrue
incapacitor.config.json
, the partial update logic would kick off after a full bundle had been uploaded successfully to the Capgo servers (as you can see in commit 3f528c).It turns out that whenever a developer uses the CLI to upload a bundle, that bundle is marked as the latest version in Capgo. So for instance, if you uploaded version 1.0.0 (aka the built-in version) yesterday then upload version 1.0.1 today, version 1.0.0 will no longer be available for download to end users because 1.0.1 will be marked as the latest version inside the DB (in the
apps.last_version
column).This meant that after uploading a full bundle for 1.0.1, the partial bundle (named 1.0.1-basedon-1.0.0) would be uploaded and marked by Capgo as the latest, which would be incorrect since a partial bundle by design will be missing some files that are in the full bundle.
This is why I had to change the logic to ensure that the upload of a partial update happens-before a full update. In other words, a partial update must first be uploaded before a full upload is made by the CLI, as you can see in the most recent commit 4d392e.
3. No need for a
manifest.json
The realization above had a neat side-effect: it made the final implementation for v1 easier.
In the proposal, I suggested that the CLI would maintain a
manifest.json
to keep track of the contents of different bundle versions locally, but this is no longer necessary.Again, assuming 1.0.0 is the built-in version, once a version 1.0.3 is uploaded (after versions 1.0.0 and 1.0.1), the
https://api.capgo.app/updates
endpoint will always return 1.0.3 as the latest version available for download.Stated differently, a developer can only base a partial bundle on the last version that was uploaded. If the last version that was uploaded is 1.0.2, and the current version about to be uploaded is 1.0.3, then they can only create partial bundle named 1.0.3-basedon-1.0.2. Clients still on version 1.0.1 or on version 1.0.0 (the built-in) will have to download the full bundle when they attempt to update.
Unless the update logic in Capgo is reworked for v2 of this feature, it would be pointless to allow a developer create a partial bundle based on arbitrary versions that are older.
3.0. Deployment
3.1. Cap-go/capgo
Cap-go/capgo
repo and switch to thefeature/partial-update
branch:git clone https://github.com/ayewo/capgo.git 01_capgo cd 01_capgo git switch feature/partial-update
aws-cli
to create an S3 bucket namedcapgo
:aws s3 mb s3://capgo --region us-east-1 # when you are done or if you want to start over, use rb to delete it aws s3 rb s3://capgo --force --region us-east-1
mkcert
(install viabrew install mkcert
):01_capgo/netlify.toml
so that the/api/updates
endpoint can be served over SSL for the iOS and Android plugin:3.2. Cap-go/capacitor-updater
Cap-go/capacitor-updater
repo and switch to thefeature/partial-update
branch:git clone https://github.com/ayewo/capacitor-updater.git 02_capgo_capacitor-updater cd 02_capgo_capacitor-updater git switch feature/partial-update
3.3. Cap-go/CLI
Cap-go/CLI
repo and switch to thefeature/partial-update
branch:git clone https://github.com/ayewo/CLI.git 03_capgo_cli cd 03_capgo_cli git switch feature/partial-update
3.4. Cap-go/demo-app & Cap-go/CLI
Cap-go/demo-app
repo and switch to thefeature/partial-update/1.0.0
branch:git clone https://github.com/ayewo/demo-app.git 04_capgo_demo-app cd 04_capgo_demo-app git switch feature/partial-update/1.0.0
package.json
to use to your local copy of the@capgo/capacitor-updater
package. It's the same package you checked out to02_capgo_capacitor-updater/
in 3.2 above:Or simply run this command:
brew install gnu-sed gsed -i 's/\^5\.2\.14/link:\.\.\/02_capgo_capacitor-updater/g' package.json
Your
package.json
should be updated accordingly (expand).demo-app
and sync the native code for iOS:pn run build npx cap sync ios # for android use: npx cap sync android
04_capgo_demo-app/
folder, use the CLI you built in 3.3. to init and upload a full bundle.Run and follow the on-screen prompts:
Your responses should look similar to the output below (expand).
production
channel (note that the command should fail5):The command failed because the
partialUpdate
flag was set incapacitor.config.ts
(expand).partialUpdate
flag incapacitor.config.ts
then try again:gsed -i 's/partialUpdate: true,/partialUpdate: false,/g' capacitor.config.ts node ../03_capgo_cli/dist/index.js bundle upload -c production
The command should succeed with an output similar to below (expand).
production
channel the default otherwise the Capgo/api/updates
endpoint will respond withCannot get channel or override ee.forgr.demoapp no default channel
even if there is an update:node ../03_capgo_cli/dist/index.js channel set production -s default
The command should succeed with an output similar to below (expand).
partialUpdate
flag back totrue
incapacitor.config.ts
6:gsed -i 's/partialUpdate: false,/partialUpdate: true,/g' capacitor.config.ts
3.5. Cap-go/demo-app
Install Proxyman, a native macOS app that makes it easy to capture, inspect, and manipulate HTTP(s) traffic. Note that once you install Proxyman, it will proxy all traffic on your machine by default though you can toggle this on/off using the
⌥⌘O
keys. Next, follow their docs on how to install their root certificate in the iOS simulator. This step is important to allow the simulator accept the self-signed SSL cert we created in 3.1.7.4Change to the
Cap-go/demo-app
folder and switch to thefeature/partial-update/1.0.0
branch:cd 04_capgo_demo-app git switch feature/partial-update/1.0.0
demo-app
and sync the native code for iOS:pn run build npx cap sync ios # for android use: npx cap sync android
Once the version 1.0.0 of the app launches in the iOS simulator, it should look like this:
In Proxyman, make sure you right-click on the
localhost.proxyman.io:8881
domain to "Enable SSL proxying" so you can see all SSL traffic to the/api/updates
endpoint. Your Proxyman screen should look like this after thedemo-app
has launched in the simulator to check if an update is available:The command should succeed with an output similar to below (expand).
The payload should also indicate that a partial update is available as can be seen in the Proxyman screen:
Send the app into the background then bring it to the foreground so that the partial update is applied.
After the 1.0.1 update is applied, your simulator screen should look like this:
Your simulator output should look similar to below (expand).
feature/partial-update/1.0.2
so that you can create a partial upload for version 1.0.2 of the app. The main image in your app should change to this on your simulator screen.Footnotes
I suggested at least $80 since the review of a pull request is $20 and there are 4 repos: $20 X 4 = $80. If you are available to also test in production, I think an additional payment can be arranged. ↩
Please refer to the design doc for what binary files refer to in this context. ↩
Please see getting started and s3 for information on using Minio in local development. The version of the S3 JS client used by the project didn't seem to work with Minio locally which is why I had to use AWS S3 which worked on the first try. ↩
Three hostnames were added to the self-signed cert
localhost
,127.0.0.1
andlocalhost.proxyman.io
. Note thatlocalhost.proxyman.io
resolves to127.0.0.1
. It easier to monitor SSL traffic on a domain/subdomain than a naked IP address like127.0.0.1
which is why it was added to the self-signed cert. ↩ ↩2This is intentional because a partial bundle is based on the contents of a previous bundle. Since we are setting up our app for the first time in Capgo, the first version to be uploaded to Capgo must be the built-in bundle. Partial update can only be used when there is a previous bundle (that is live i.e. available for download) on which the partial bundle can be based on. ↩
Note that the
partialUpdate
flag is used by both the CLI and the plugin. Setting it back totrue
is necessary for the plugin to enable the partial update logic when checking for bundle update. ↩Tested on version 14.0.1 of Apple Xcode and Simulator using an iPhone 14 Pro running iOS 16.0. ↩
The text was updated successfully, but these errors were encountered: