type(store): mark pending SSH readoptions readonly

Widen pendingSshRepoReadoptions, recordSshRepoReadoptions, and the
merge/reconcile helpers to readonly so a reused pending queue cannot be
mutated in place after a no-op catalog reconcile.

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Neil
2026-08-13 00:07:17 -07:00
co-authored by Orca
parent fe2593c2f4
commit 685ac9476e
3 changed files with 6 additions and 6 deletions
@@ -43,7 +43,7 @@ export async function saveNewSshHostFromForm({
}: {
form: EditingTarget
ssh: SshApi
recordSshRepoReadoptions: (readoptions: SshRepoReadoption[]) => void
recordSshRepoReadoptions: (readoptions: readonly SshRepoReadoption[]) => void
setSshTargetsMetadata: (targets: SshTarget[]) => void
recordFeatureInteraction: (feature: 'ssh') => void
}): Promise<'saved' | 'validation-failed' | 'failed'> {
@@ -170,7 +170,7 @@ export async function addAllSshConfigHostsToOrca({
recordFeatureInteraction
}: {
ssh: SshApi
recordSshRepoReadoptions: (readoptions: SshRepoReadoption[]) => void
recordSshRepoReadoptions: (readoptions: readonly SshRepoReadoption[]) => void
setSshTargetsMetadata: (targets: SshTarget[]) => void
recordFeatureInteraction: (feature: 'ssh') => void
}): Promise<{ kind: 'added'; count: number } | { kind: 'already-synced' } | { kind: 'failed' }> {
+2 -2
View File
@@ -1781,8 +1781,8 @@ export type RepoSlice = {
activeRepoId: string | null
// Monotonic sequence so overlapping catalog fetches can drop stale same-host results (#7020).
reposFetchGeneration: number
pendingSshRepoReadoptions: SshRepoReadoption[]
recordSshRepoReadoptions: (readoptions: SshRepoReadoption[]) => void
pendingSshRepoReadoptions: readonly SshRepoReadoption[]
recordSshRepoReadoptions: (readoptions: readonly SshRepoReadoption[]) => void
fetchRepos: (options?: RuntimeCatalogFetchOptions) => Promise<void>
fetchReposForAllHosts: (options?: AllHostCatalogFetchOptions) => Promise<void>
awaitLocalRepoCatalogSettlement: () => Promise<void>
@@ -4,7 +4,7 @@ import { getRepoExecutionHostId, toSshExecutionHostId } from '../../../../shared
export type SshRepoReconciliation = {
repos: readonly Repo[]
pendingReadoptions: SshRepoReadoption[]
pendingReadoptions: readonly SshRepoReadoption[]
}
function repoBelongsToTarget(repo: Repo, targetId: string): boolean {
@@ -69,7 +69,7 @@ export function reconcileReadoptedSshRepoRows(
export function mergeSshRepoReadoptions(
pending: readonly SshRepoReadoption[],
incoming: readonly SshRepoReadoption[]
): SshRepoReadoption[] {
): readonly SshRepoReadoption[] {
const repoIdsByMigration = new Map<string, Set<string>>()
for (const readoption of [...pending, ...incoming]) {
const key = `${readoption.oldTargetId}\0${readoption.newTargetId}`