Skip to content

Report dangling references to the user instead of silently discarding them #34

Description

@TobiasKlanert

Context

The layout mapper (toElkGraph in core/layout/compose-to-elk.ts) filters
edges using a knownIds guard: If an edge points to a node that
does not exist, it is silently discarded. This is intentional because ELK
would otherwise abort the entire layout run with JsonImportException: Referenced shape does not exist.

Side effect: A depends_on, networks, or volume entry that references something
undeclared produces an incomplete graph without any
indication
. The user sees a missing edge and doesn’t know why.

Problem

The guard prevents a crash but suppresses the information. For a tool
whose stated MVP goal is “understandable error feedback instead of a crash”
(see MVP Doc §2.1, point 3), silent rejection is the wrong final step.

Context

This is not a layout issue, but a validation issue. The parser currently checks
structure and required fields, but not the referential integrity
between services, networks, and volumes.

Possible Approach

  • Add semantic validation to the parser: For each dependsOn,
    networks, and named volume reference, check whether the target exists in the
    top-level declarations.
  • Collect unresolvable references as ParseError (using the same two-level
    mechanism as for existing semantic errors), specifying the
    service, reference type, and missing name.
  • Decision pending: hard error (graph is not drawn) vs.
    warning (graph is drawn, a note is displayed). For dangling
    references, a warning is likely more user-friendly—the
    graph remains visible, and the note explains the missing edge.
  • The knownIds guard in the mapper remains in place as a safety net, even
    when the parser validates—a double safeguard against the ELK crash.

Acceptance Criteria

  • A reference to a nonexistent service/network/volume generates
    a clear message (reason + affected name).
  • The graph does not crash (the guard remains active).
  • Unit tests cover one dangling case per reference type.

Dependencies

Affects the error feedback UI (Roadmap Phase 6). It makes sense to
consider both together.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions