ReviewOS

also looking at this

stacks/wildloop

feat: native trail maps and complete native mobile screens

#1017
Draft chris wants to merge codex/trail-experience into main
60 files +2505 -823

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

tests/unit/native-record-screen.test.tsmodified+19-0
Changes to tests/unit/native-record-screen.test.ts
@@ -11,6 +11,25 @@ async function recover(userId=7, keychain=new Map([['auth_token','record-token']
1111}
1212describe('native Record checkpoint recovery',()=>{
1313 beforeAll(compileNativeBundle,30000)
14 it('durably registers a system recording ID before starting native GPS',async()=>{
15 const screen=await start('Record',{},['fetch','secureStorage','storage','storageCompareAndSet','storageSetIfAbsent','crypto','geolocation','locationRecordingOwnership','locationRecordingIntentIdentity','lifecycle','liveActivity'],new Map([['auth_token','record-token'],['wildloop-account',JSON.stringify({token:'record-token',user:{id:7}})]]))
16 const stored=await waitForRequest(screen,0,r=>r.payload.module==='Storage' && r.payload.method==='get')
17 answer(screen,stored,null)
18 const initialHost=await waitForRequest(screen,0,r=>r.payload.method==='getRecordingState')
19 answer(screen,initialHost,{active:false,paused:false})
20 await Bun.sleep(0)
21 await screen.event('record-start','onPress')
22 const host=await waitForRequest(screen,requests(screen).indexOf(initialHost)+1,r=>r.payload.method==='getRecordingState')
23 answer(screen,host,{active:false,paused:false})
24 const uuid=await waitForRequest(screen,0,r=>r.payload.module==='Crypto' && r.payload.method==='randomUUID')
25 answer(screen,uuid,'782f0d4a-f626-41bc-8f17-2f67e9a099bf')
26 const registration=await waitForRequest(screen,0,r=>r.payload.module==='Storage' && r.payload.method==='setIfAbsent')
27 expect(registration.payload.args).toMatchObject(['wildloop-native-recording-v1',{userId:7,id:'782f0d4a-f626-41bc-8f17-2f67e9a099bf',phase:'starting'}])
28 expect(requests(screen).some(r=>r.payload.method==='startRecording')).toBe(false)
29 answer(screen,registration,true)
30 const start=await waitForRequest(screen,0,r=>r.payload.method==='startRecording')
31 expect(start.payload.args[0]).toMatchObject({recordingId:'782f0d4a-f626-41bc-8f17-2f67e9a099bf'})
32 })
1433 it('recovers a finished upload offline without starting another GPS recording',async()=>{
1534 const screen=await recover()
1635 await waitForText(screen,'Your finished recording is saved on this device. Retry the upload when connected.')