Skip to content

feat: MVP Connection model #365

@ggfevans

Description

@ggfevans

Parent Epic

Part of #362 (Connection Graph Model - Port-Based Architecture)

Supersedes: #261 (Cable data model) / PR #355


Summary

Implement a minimal Connection model using port IDs. Start simple, add complexity when needed.

Background

The original Cable model (#261) used string references like a_device_id + a_interface. This is fragile. The new model references PlacedPort.id directly.

MVP Type Definition

interface Connection {
  id: string;           // UUID
  a_port_id: string;    // PlacedPort.id
  b_port_id: string;    // PlacedPort.id
  label?: string;       // Optional user label
  color?: string;       // Hex color for visualization
}

That's it. No connection_class, no status, no role, no redundancy_group, no CableProperties nesting. Add those when users actually need them.

Acceptance Criteria

  • Create Connection interface in src/lib/types/index.ts
  • Create ConnectionSchema in src/lib/schemas/index.ts
  • Add connections: Connection[] to Layout (default: [])
  • YAML serialization for connections
  • Basic validation (a_port_id ≠ b_port_id)

Test Requirements

  • Connection schema validates correctly
  • Self-connection rejected (a_port_id === b_port_id)
  • YAML round-trip preserves connections
  • Empty label/color handled correctly

Design Decisions

  1. No connection class/type: Users can use label + color to distinguish network vs power vs console
  2. No status field: Everything is "connected" - if it's in the data, it exists
  3. No nested CableProperties: Color and label are flat fields
  4. No role/redundancy_group: YAGNI - add when users request

Future Enhancements (NOT in MVP)

These can be added later if users need them:

  • Connection classes (network, power, console)
  • Connection status (planned, decommissioning)
  • Cable properties (type, length, length_unit)
  • Redundancy groups
  • Bidirectional relationship tracking

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions