mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 16:03:26 +00:00
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:
@@ -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' }> {
|
||||
|
||||
@@ -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}`
|
||||
|
||||
Reference in New Issue
Block a user