Skip to content

Parameter type labels incorrect in GUI (INT shown instead of FLOAT) #56

Description

@carlosengutierrez

Root cause

PostgreSQL JSONB normalizes whole-number floats at storage time — 8.0 → 8, 250.0 →
250. This is a JSON spec limitation: there is no distinction between integer and
float for whole numbers. The type information is permanently lost at the DB level.

This affects two things:

  1. GUI type label — shows INT for parameters declared as float in the node file when
    the default value happens to be a whole number (e.g. 8.0, 250.0, 40.0)
  2. Generated code — emits syn_weight=40 instead of 40.0, allow_multapses=0 instead
    of False

Neither causes runtime failures because all NW nodes cast types explicitly in their
methods.


The fix (4 files)

  1. python_analyzer.py
    When parsing a node file, store default_value_type (a string: "float", "int",
    "bool", "list", "dict") alongside default_value for every parameter. Strings survive
    JSONB without corruption.

  2. models.py — _convert_parameters()
    Currently drops any field it doesn't know about. Add default_value_type to the
    pass-through so it travels from PythonFile.node_classes → API → frontend →
    FlowNode.data.

  3. nodeDetailModal.tsx
    Replace the inferred type logic with a direct read of default_value_type when
    present, falling back to the existing getInferredType() when absent (old nodes
    without the field). Fixes the INT/FLOAT label in the GUI.

  4. code_generation_service.py
    Before calling _convert_parameter_value, check default_value_type and restore the
    correct Python type: 8 → 8.0 if declared float, 0 → False if declared bool. The
    conversion logic itself is not changed.


Scope and risk

  • Existing workflows: unaffected. Old FlowNode records have no default_value_type →
    both the label and code generator fall back to current behavior (no regression)
  • New nodes (uploaded or re-synced after the fix): immediately show correct labels
    and generate correct types
  • Existing canvas nodes: benefit after the node file is re-synced AND the node is
    re-placed on the canvas (so FlowNode.data gets the new field)

Workaround until fixed

Use a non-whole-number value: 4.001 instead of 4.0 — JSONB cannot normalize it, so
the float type survives.

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