refactor: include vault directory in mobile git requests

This commit is contained in:
lucaronin
2026-05-05 14:14:30 +02:00
parent e7fada7805
commit 2fb5b96313
4 changed files with 11 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ describe('native mobile git transport', () => {
expect(requests).toEqual([
{
remoteUrl: 'https://github.com/refactoringhq/tolaria.git',
vaultDirectoryName: 'personal-journal',
vaultId: 'personal',
},
])

View File

@@ -1,4 +1,5 @@
import type { MobileGitTransport, MobileGitTransportRequest, MobileGitTransportResult } from './mobileGitTransport'
import { createMobileVaultConfigFromMetadata } from './mobileVaultMetadata'
type MobileGitNativeOperation = 'pull' | 'push'
@@ -9,6 +10,7 @@ export type MobileGitNativeModule = {
export type MobileGitNativeRequest = {
remoteUrl: string
vaultDirectoryName: string
vaultId: string
}
@@ -49,8 +51,10 @@ async function runNativeGitOperation({
}
function nativeRequest(request: MobileGitTransportRequest): MobileGitNativeRequest {
const vaultConfig = createMobileVaultConfigFromMetadata(request.vault)
return {
remoteUrl: request.remote.url,
vaultDirectoryName: vaultConfig.storage.directoryName,
vaultId: request.vault.id,
}
}

View File

@@ -468,7 +468,7 @@ The mobile app routes Git pull/push through `MobileGitTransport`. React Native U
Until a native module is wired into Expo development builds, the native transport adapter returns a clear unavailable-module failure. This keeps authentication, sync status, retry UI, and future libgit2/Rust work testable without pretending that a JavaScript fallback is production Git.
The native boundary request is intentionally narrow for the first spike: active vault id plus remote URL. Credentials stay behind SecureStore/OAuth/native Git credential callbacks, and remote URLs must not embed tokens.
The native boundary request is intentionally narrow for the first spike: active vault id, app-managed vault directory name, and remote URL. Credentials stay behind SecureStore/OAuth/native Git credential callbacks, and remote URLs must not embed tokens.
### Auto-Sync

View File

@@ -100,6 +100,7 @@ This file is the resumable working log for Tolaria mobile. The strategy and road
- Added the first mobile Git transport execution boundary behind the existing sync/auth plan, including explicit pull/push routing and a visible unavailable-transport failure until the native Git implementation lands.
- Hardened TenTap link serialization so safe HTTP, mailto, and relative links persist while unsafe link destinations block draft persistence.
- Added the first native mobile Git transport adapter contract, wiring the app to a native-module-shaped boundary that currently fails clearly until the real implementation is present.
- Added the app-managed vault directory name to the native Git transport request so the future native module can locate the repository without deriving paths from display names.
## Next Action
@@ -381,6 +382,10 @@ Continue Phase 4 with editor durability:
- `pnpm --filter @tolaria/mobile typecheck` passed after adding the native Git transport adapter contract.
- CodeScene after adding the native Git transport adapter contract: `apps/mobile/src/MobileApp.tsx`, `apps/mobile/src/mobileNativeGitTransport.ts`, and `apps/mobile/src/mobileNativeGitTransport.test.ts` scored `10`.
- `pnpm --filter @tolaria/mobile exec expo export --platform ios --output-dir /tmp/tolaria-mobile-export` passed after adding the native Git transport adapter contract; Metro recovered from a cache deserialize warning by doing a full crawl.
- `pnpm --filter @tolaria/mobile test -- src/mobileNativeGitTransport.test.ts src/mobileVaultMetadata.test.ts src/mobileVaultConfig.test.ts` passed after adding the vault directory name to native Git transport requests: 44 files / 148 tests.
- `pnpm --filter @tolaria/mobile typecheck` passed after adding the vault directory name to native Git transport requests.
- CodeScene after adding the vault directory name to native Git transport requests: `apps/mobile/src/mobileNativeGitTransport.ts` and `apps/mobile/src/mobileNativeGitTransport.test.ts` scored `10`.
- `pnpm --filter @tolaria/mobile exec expo export --platform ios --output-dir /tmp/tolaria-mobile-export` passed after adding the vault directory name to native Git transport requests; Metro recovered from a cache deserialize warning by doing a full crawl.
## Risks / Watch Items