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:
- 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)
- 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)
-
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.
-
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.
-
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.
-
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.
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:
the default value happens to be a whole number (e.g. 8.0, 250.0, 40.0)
of False
Neither causes runtime failures because all NW nodes cast types explicitly in their
methods.
The fix (4 files)
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.
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.
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.
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
both the label and code generator fall back to current behavior (no regression)
and generate correct types
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.