feat(topology): nullable layout coords on LAN + TopologyDecky

MazeNET phase 2 step 5. Pure storage — the generator emits None for
x/y and the web canvas fills them in later. No logic changes; no
compose, deploy, or validator impact.
This commit is contained in:
2026-04-20 17:48:29 -04:00
parent e475c0957e
commit 9afaac7612
4 changed files with 77 additions and 0 deletions

View File

@@ -59,6 +59,10 @@ class _PlannedLAN:
subnet: str
is_dmz: bool
parent: Optional[str] # name of parent LAN, None for DMZ
# Canvas coordinates — generator leaves them None; the web editor
# (or a future auto-layouter) fills them in.
x: Optional[float] = None
y: Optional[float] = None
@dataclass
@@ -73,6 +77,9 @@ class _PlannedDecky:
# Mirrors ``DeckyConfig.service_config`` from the flat-fleet path;
# services read these via ``compose_fragment(service_cfg=...)``.
service_config: dict[str, dict] = field(default_factory=dict)
# Canvas coordinates — see _PlannedLAN.x/y.
x: Optional[float] = None
y: Optional[float] = None
@dataclass

View File

@@ -31,6 +31,8 @@ async def persist(repo: Any, plan: GeneratedTopology) -> str:
"name": lan.name,
"subnet": lan.subnet,
"is_dmz": lan.is_dmz,
"x": lan.x,
"y": lan.y,
}
)
lan_ids[lan.name] = lan_id
@@ -55,6 +57,8 @@ async def persist(repo: Any, plan: GeneratedTopology) -> str:
"service_config": decky.service_config,
},
"ip": primary_ip,
"x": decky.x,
"y": decky.y,
}
)
decky_ids[decky.name] = decky_uuid

View File

@@ -232,6 +232,10 @@ class LAN(SQLModel, table=True):
docker_network_id: Optional[str] = Field(default=None)
subnet: str
is_dmz: bool = Field(default=False)
# Canvas layout coordinates (set by the web editor). Nullable so
# generator-emitted LANs don't need auto-layout at generation time.
x: Optional[float] = Field(default=None)
y: Optional[float] = Field(default=None)
class TopologyDecky(SQLModel, table=True):
@@ -270,6 +274,10 @@ class TopologyDecky(SQLModel, table=True):
updated_at: datetime = Field(
default_factory=lambda: datetime.now(timezone.utc)
)
# Canvas layout coordinates (set by the web editor). Nullable so
# generator-emitted deckies don't need auto-layout at generation time.
x: Optional[float] = Field(default=None)
y: Optional[float] = Field(default=None)
class TopologyEdge(SQLModel, table=True):