Skip to content

Deployment planner ignores soft-deleted nodes → UniqueViolation (unhandled 500) on redeploy / impact preview #2310

Description

@shangyian

Summary

Deploying (or previewing impact for) a node whose (name, namespace) matches a soft-deleted node fails with an unhandled 500: psycopg.errors.UniqueViolation on unique_node_namespace_name. Affects real deploy and the POST /deployments/impact dry-run alike (the INSERT fires inside the SAVEPOINT before rollback).

Repro

  1. Deploy namespace default.example containing node default.example.orders.
  2. Soft-delete default.example.orders (deactivate — sets deactivated_at; the row remains).
  3. Re-deploy the namespace including default.example.orders (or call POST /deployments/impact).
  4. → 500, UniqueViolation: duplicate key value violates unique constraint "unique_node_namespace_name".

Root cause (v0.0.193)

_create_deployment_plan loads existing nodes via NodeNamespace.list_all_nodes(...) without include_deactivated=True (datajunction-server/datajunction_server/internal/deployment/orchestrator.py:1214). list_all_nodes defaults to include_deactivated=False, filtering deactivated_at IS NULL (datajunction-server/datajunction_server/database/namespace.py:264). So filter_nodes_to_deploy (orchestrator.py:2960) never sees the soft-deleted

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions