mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-30 03:59:41 +00:00
feat: guide missing external network creation during deploy (#1645)
* feat: guide missing external network creation during deploy Detect missing external networks before Compose runs, prompt or auto-create safe bridge networks, and keep unsupported declarations blocked with trusted deploy provenance. * test: align deploy context and settings fixtures with missing-network gate Update caller spies, EffResource expectations, StacksSection save keys, and git-source spy cleanup so CI matches the new deployStack context and auto-create setting. * fix: drop unused renderError binding in missing-network resolver Satisfies no-unused-vars so backend ESLint CI passes; callers already key only on model presence. * fix: use HTTP-safe clipboard helper in missing-network dialog navigator.clipboard fails on plain HTTP LAN hosts; route copy actions through copyToClipboard so Docker and Compose copy buttons work on self-hosted instances. * fix: simplify missing-network dialog actions and copy label Drop the Compose snippet escape hatch, move secondary actions under More, and rename the terminal copy action to Copy create command so the footer is a clear Cancel / Create decision.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import type { MissingExternalNetwork } from '../network/missingExternalNetworks';
|
||||
|
||||
export type MissingExternalNetworksKind =
|
||||
| 'prompt'
|
||||
| 'unsupported'
|
||||
| 'unavailable'
|
||||
| 'create_failed';
|
||||
|
||||
/**
|
||||
* Typed pre-Compose gate error. Must be thrown before atomic backup so it is
|
||||
* never wrapped in ComposeRollbackError.
|
||||
*/
|
||||
export class MissingExternalNetworksError extends Error {
|
||||
readonly code: 'missing_external_networks' | 'external_network_create_failed';
|
||||
readonly kind: MissingExternalNetworksKind;
|
||||
readonly networks: MissingExternalNetwork[];
|
||||
readonly createdNames: string[];
|
||||
readonly remainingNames: string[];
|
||||
|
||||
constructor(opts: {
|
||||
kind: MissingExternalNetworksKind;
|
||||
message: string;
|
||||
networks?: MissingExternalNetwork[];
|
||||
createdNames?: string[];
|
||||
remainingNames?: string[];
|
||||
}) {
|
||||
super(opts.message);
|
||||
this.name = 'MissingExternalNetworksError';
|
||||
this.kind = opts.kind;
|
||||
this.code = opts.kind === 'create_failed'
|
||||
? 'external_network_create_failed'
|
||||
: 'missing_external_networks';
|
||||
this.networks = opts.networks ?? [];
|
||||
this.createdNames = opts.createdNames ?? [];
|
||||
this.remainingNames = opts.remainingNames ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
export function isMissingExternalNetworksError(error: unknown): error is MissingExternalNetworksError {
|
||||
return error instanceof MissingExternalNetworksError;
|
||||
}
|
||||
|
||||
export interface DeployInvocationContext {
|
||||
actor?: string | null;
|
||||
source:
|
||||
| 'manual'
|
||||
| 'rollback'
|
||||
| 'template'
|
||||
| 'from_git'
|
||||
| 'git_apply'
|
||||
| 'fleet_snapshot'
|
||||
| 'labels'
|
||||
| 'scheduler'
|
||||
| 'webhook'
|
||||
| 'blueprint'
|
||||
| 'mesh_redeploy';
|
||||
}
|
||||
Reference in New Issue
Block a user