Skip to content

Add linked-plan contract foundation #7

Description

@relyen-dev

Summary

Add the domain/persistence foundation for linking one plan's output to another plan's external input. This is the first implementation step toward partial cross-plan flows, future node-tray link actions, and later session-scale logistics.

Scope

  • Add session-scoped linked-plan intent to the planner core model.
  • Support partial amountPerMinute links from a source plan output to a destination plan external input.
  • Keep each individual plan solvable/exportable on its own; links belong to sessions/workspace state, not standalone plan JSON/share payloads.
  • Add persistence encoding/decoding and migration/hydration for session links.
  • Add pure derived helpers/selectors for link health/status using current projects, sessions, and optional solve results.
  • Add focused planner-core tests for model hydration, persistence round-trip, stale references, partial amounts, and derived statuses.

Non-goals

  • No Angular UI for creating/editing links in this slice.
  • No selected-node tray link/extract actions yet.
  • No logistics routes, capacities, vehicles, trains, drones, belts, pipes, pools, or session graph overview.
  • No recursive multi-plan solving or circular dependency solving.
  • Do not persist solver output as authoritative state.

Acceptance Criteria

  • PlannerSession can store zero or more linked-plan contracts without breaking existing v3 workspaces.
  • A link records itemId, amountPerMinute, source plan/target-output reference, and destination plan external-input reference.
  • Hydration sanitizes invalid links, non-finite/negative amounts, missing ids, and stale project/target references safely.
  • Persistence round-trips session links while plan export/share payloads remain plan-only.
  • Derived status helpers can report at least healthy, missing-source, missing-destination, source-short, source-overcommitted, and destination-overcovered states.
  • Cycles are either detected or explicitly left as a tested future status if a full graph-cycle helper would overreach this slice.
  • Tests are colocated with the planner-core modules they verify.
  • Existing planner-core persistence/workspace tests continue to pass.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions