Repository navigation
Conversation
|
@AatmanAJ is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
@greptileai review |
|
@greptileai review |
|
@greptileai review |
|
@greptileai review |
|
@greptileai review |
|
@greptileai review |
1 similar comment
|
@greptileai review |
| CapRadioRow( | ||
| stringResource(R.string.cap_audience_organization), | ||
| selected = cap.isPublic && restricted, | ||
| onClick = { | ||
| management.setAudience(isPublic = true, LinkAccess.RESTRICTED) | ||
| }, |
There was a problem hiding this comment.
Organization-only choice makes recordings public
The share sheet offers “Only people in your organization” even when the organization has no email restriction. Choosing it for a private Cap publishes the recording. But LinkAccess.RESTRICTED only clears the link override; it does not add an organization check. Without allowedEmailDomain, anyone with the link can watch.
Hide this choice when the server cannot enforce it, or add a server operation that enforces the selected audience.
How this was verified: The organization choice sends a public sharing update, while the viewing policy applies the email check only when the organization has a nonempty allowed domain.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/cap/MoreMenu.kt
Line: 237-242
Comment:
**Organization-only choice makes recordings public**
The share sheet offers “Only people in your organization” even when the organization has no email restriction. Choosing it for a private Cap publishes the recording. But `LinkAccess.RESTRICTED` only clears the link override; it does not add an organization check. Without `allowedEmailDomain`, anyone with the link can watch.
Hide this choice when the server cannot enforce it, or add a server operation that enforces the selected audience.
**How this was verified:** The organization choice sends a public sharing update, while the viewing policy applies the email check only when the organization has a nonempty allowed domain.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| when { | ||
| showsDesignedEmpty -> { | ||
| LibraryEmptyState(Modifier.fillMaxSize()) | ||
| } | ||
| loadedEmpty -> { | ||
| Box(Modifier.fillMaxSize(), Alignment.Center) { |
There was a problem hiding this comment.
Empty libraries hide upload failures
The new empty-library branches skip UploadBanner. A first upload stays hidden while the phone prepares it. If preparation or createUpload fails, the library stays empty and the error stays hidden too. There is no other in-app banner, and notifications can be denied.
Keep the upload banner outside the empty-state branches so the user can see progress and failures.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/home/LibraryContent.kt
Line: 139-144
Comment:
**Empty libraries hide upload failures**
The new empty-library branches skip `UploadBanner`. A first upload stays hidden while the phone prepares it. If preparation or `createUpload` fails, the library stays empty and the error stays hidden too. There is no other in-app banner, and notifications can be denied.
Keep the upload banner outside the empty-state branches so the user can see progress and failures.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| val defaults by settings.recordingDefaults.collectAsState(initial = RecordingDefaults()) | ||
| val appearance by settings.appearance.collectAsState(initial = Appearance.System) | ||
| val shareAnalytics by settings.shareUsageAnalytics.collectAsState(initial = false) | ||
| var confirmSignOut by remember { mutableStateOf(false) } | ||
| val context = LocalContext.current |
There was a problem hiding this comment.
The rewrite removes both the plan refresh on resume and pull-to-refresh. The only remaining call to refreshPlan() runs once when the session starts. Someone who upgrades in the browser and returns still sees Free and the upgrade link until the app restarts or they sign in again.
Restore the refresh on return. It also lets a failed initial plan request recover.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt
Line: 107-111
Comment:
**Settings misses plan upgrades**
The rewrite removes both the plan refresh on resume and pull-to-refresh. The only remaining call to `refreshPlan()` runs once when the session starts. Someone who upgrades in the browser and returns still sees Free and the upgrade link until the app restarts or they sign in again.
Restore the refresh on return. It also lets a failed initial plan request recover.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.…ttings Notification rows drew the stock Material switch, which is a different size and colour from the 44x26 design switch every other settings row uses. They now show CapSwitchTrack. The two switch lines on Recording defaults each drew a top and a bottom hairline, so the rule between them was twice as thick as every other divider.
…oid-recording-engine
Keeps this layer's theme root, which already wraps Root in the picture in picture box.
Stacked on the Live Updates PR (#4762), which sits on the earlier Android PRs. Only the top 18 commits are new here, from "model a recording job and name its segments" onwards (
5a3343fbfto7b1906f1e), then a merge of the Live Updates PR (5270d95dc), two fixes after review (8b18d1242,9965ee960), a second merge of the Live Updates PR (9a37a6b22), three more fixes after review (17a845b4ctof449d3e69), eight more merges of the Live Updates PR (506c8289eto8f34cc454), the media module's lint rule (e40bd7e38), another merge of the Live Updates PR (7905ff75e), a deadline for an encoder that never finishes draining (f7fb783d6) and the pattern recorder keeping what that deadline saves (077ea1786). Once the PRs below merge this shows only its own diff.This PR adds the recording engine: the segment writer that turns frames and sound into fragmented MP4 segments, and the recording job that uploads those segments while a recording is made and completes the Cap. There is no recorder screen yet; the camera recorder follows in the next PR.
What is in it
A port of the iOS recording pipeline. A recording is written as 2 second fragmented MP4 segments, each uploaded as soon as it is closed, so the Cap is close to ready when the recording stops. The job survives a crash or a relaunch and finishes from what reached disk.
Recording.ktmodels a job and names its segments as iOS does (init.mp4, thensegment_001.m4sonwards per track), plans which upload links to ask the server for, and checks a recording before completing it.RecordingUploadscreates the Cap when a recording begins, uploads each segment as it is written, retries what failed, and completes the recording once it has finished and every segment has reached storage. It asks for the Cap once per recording, even when segments arrive while the server is answering or a pump read the job before the Cap was stored. Jobs are saved under the app's no-backup directory, one root per server, so a local server and cap.so never share jobs.addreturns, so a job left unfinished by a crash or a relaunch is resumed at start-up and finished with every segment that reached disk. Signing out discards every job, as on iOS.mediaGradle module holds the writer: a fragmented MP4 writer, an H.264 encoder wrapper onMediaCodecthat picks the best offered profile, an AAC encoder with the iOS silence-fill rules, andSegmentWriter, which cuts both tracks into 2 second segments and reports the first failure's reason fromfinish.RecordingUploadWorkeris long-running WorkManager work with a data sync foreground notification, "Uploading recording" with "Finishing up", built by the shared notifications builder on the uploads channel. It needs a network connection, runs as unique work, and keeps going until no job is unfinished. The app requests it at start when a saved job is unfinished.PatternRecorderActivity, records a generated 720 by 1280 test pattern at 30 fps with a 440 Hz tone for 10 seconds, 2 minutes or 6 minutes, through the real writer and uploads, and shows the job's phase, bytes uploaded, segment count, duration and share link. Start it withadb shell am start -n so.cap.mobile.debug/so.cap.mobile.PatternRecorderActivity --es capApiBaseUrl <server>after signing in to that server.Screenshots
The debug pattern recorder on the API 37 emulator, recording 10 seconds and uploading to a local fixture server. Taken at
13954befa, the screen recorder PR's tip, which contains this PR.ffprobeon the uploaded recording: video H.264 Main, 720x1280, yuv420p, 30 fps, 10.00 s; audio AAC LC, 48 kHz mono, 96 kb/s, 10.01 s. The full output is in ffprobe-pr10.txt.Not captured here: the "Uploading recording" notification, which had already finished by the time the shade was opened, and the share page playing the recording, as no web app was running for this pass.
Where it differs from iOS, on purpose
aHandedOffRecordingIsFinishedByCapOnceis not ported.Tests
:capkit:test: 271 tests, 39 of them new inRecordingTest.kt. RecordingTest (14) ports the iOS model and planner tests, and RecordingUploadTest (25) sends to a loopback storage server: four of the five iOS upload tests, resume after relaunch, completion validation, that discarding the last unfinished job ends the wait for unfinished jobs, and the two review fixes below.:app:testDebugUnitTest: 462 tests on7b1906f1eand 468 on the merge, none new in this PR.:media:testDebugUnitTest: 32 tests, all new: Fmp4WriterTest 10, H264Test 6, VideoTimelineTest 7, AudioTimelineTest 5, SegmentTest 2 and DrainTest 2.Device pass
Pinned to one run at
13954befa, the screen recorder PR's tip, which contains this PR and the two above it. Both emulators ran headless against a local fixture server.cap_cam_37)cap_cam_29)The 3 API 37 failures are the known Cap detail ones, listed separately because they are not in this PR's code:
CapDetailTest.playAndPauseandaShareLinkWithATimeOpensTheCapThere(Compose did not go idle while the emulator decoded the video) andaChosenSpeedIsKeptAfterTheAppIsOpenedAgain(touch input could not be injected). The skipped tests are all inCameraCaptureTest, which skips what the emulator's cameras cannot do: two cameras, a flip, or the frame rate it asks for. The crash buffers were empty after every suite.Fixed after review
setForegroundthrowForegroundServiceStartNotAllowedExceptionon Android 12 and later, and the work failed. The request is now expedited, falling back to ordinary work when out of quota, and a refused foreground start lets the uploads carry on without the notification (8b18d1242).RecordingUploadWorkerTestcovers the refused start. On the API 37 emulator, a 10 second pattern recording finished with the app in the background. Before the fix the worker failed with that exception and the recording was not completed. After it, ActivityManager still refused the foreground start, but every segment uploaded, the recording was completed and the worker succeeded, with no exception in the app's log.9965ee960). Three newAppModelTestcases on a loopback server check that the deletes reach the server before the revoke, and that sign-out still completes when a delete fails or never answers.addnow saves the record before it returns; upload progress still coalesces its writes (17a845b4c). iOS coalesces these writes too and accepts losing the last few seconds, so Android differs here on purpose.aSegmentFinishedJustBeforeACrashIsKeptkills the process right after two segments are added and has a fresh instance read the same directory: both segments are recovered, the recording completes with 2 seconds of video, and nothing is deleted. The existing test for a crashed recording with nothing saved now adds only the initialisation segment, which is the case its name describes.3325ce7e3).aPumpHoldingTheJobFromBeforeTheCapWasCreatedDoesNotCreateAnotherdrives that interleaving on the loopback server without mocks: the server holds the create answer on aCompletableDeferred, a second thread's pump is held inside thecurrentUserIdcallback just after it reads the job, the first create is answered and stored, and the held pump is released. The test checks that it started nothing and that the server saw exactly one create.:media:testDebugUnitTestand:media:lintDebug, and so does the standing check line in the README and the plan (f449d3e69).Saving that cannot finish
A segment writer told to finish waited for the video encoder, then the audio encoder, to return end of stream, with no limit. An encoder that stopped answering, as the Android 10 emulator's media codec service did under load, left the recording saving for ever with its codecs held. The wait now has a deadline that scales with the work still queued when the recording stops, measured in media time (
f7fb783d6):SegmentWriterTest.finishBeforeAnyFrameReportsNothingRecorded, which finishes a writer before any frame, takes 43 ms in all on the API 29 emulator and 34 ms on API 35.UNFINISHEDfailure that carries the seconds it kept. The recorders in the PRs above keep that recording and say "Couldn't finish saving, N s kept". The debug pattern recorder here does the same: it finishes the upload with the seconds kept instead of discarding it, and other failures still discard the upload (077ea1786).The deadline lives in
Drain, which owns the completion, so it is tested on coroutine virtual time without a codec.DrainTest.aDrainThatNeverAnswersEndsWithWhatWasKeptfails without the deadline, as the drain never completes, and checks that the codecs are released once and the kept seconds are reported.aSlowDrainWithinItsBacklogFinishesdrains 3 s of frames at half real time, so it takes about 6 s, and fails with a flat 2 s limit. There is no device test of the writer giving up: it would need a real encoder that stops answering on demand, which cannot be arranged without replacing the codec. SegmentWriterTest still passes 7 of 7 with the deadline in place, on the API 29 and API 35 emulators at276cfebaa, the top of the Android stack.Checked
./gradlew spotlessCheck :capkit:test :app:testDebugUnitTest :app:lintDebug :app:assembleDebug :app:assembleRelease :app:assembleDebugAndroidTest :media:testDebugUnitTest :media:lintDebug :media:assembleDebugAndroidTestpasses on7b1906f1e, on the merge,5270d95dc, on9965ee960after the review fixes, with 268 capkit, 473 app and 30 media JVM tests, on the second merge,9a37a6b22, with 269 capkit, 477 app and 30 media JVM tests, onf449d3e69after the second round of review fixes, with 271 capkit, 477 app and 30 media JVM tests, and onf7fb783d6, after the drain deadline, with 272 capkit, 491 app and 32 media JVM tests.:app:testReleaseShrunkUnitTestcomes later in the stack, so it is not part of the line here.Not checked
Confidence Score: 4/5

Fix the existing Loom cancellation issue before merging; Cancel upload currently hides the notification without stopping the import.
Findings
Fix with agent prompt
Summary
Adds the Android recording engine, saved upload jobs, crash recovery, and a background upload worker.
No new actionable issues were established in the changes since the previous review.
Reviews (32) · Last reviewed commit: "Merge commit 'fe9bcc418d00f1eddc21882679..." · Reviewed by Greptile