Skip to content

Improve type handling for ints/floats with the #[hard/soft_min/max(...)] node macro parameter attributes#4041

Merged
Keavon merged 1 commit intomasterfrom
improve-macro-hard-soft-min-max
Apr 23, 2026
Merged

Improve type handling for ints/floats with the #[hard/soft_min/max(...)] node macro parameter attributes#4041
Keavon merged 1 commit intomasterfrom
improve-macro-hard-soft-min-max

Conversation

@Keavon
Copy link
Copy Markdown
Member

@Keavon Keavon commented Apr 23, 2026

Broken out from #4010.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the IntegerCount type alias with u32 across several nodes and updates the node-macro to support both integer and float literals for numeric bound attributes like soft_min and hard_min. It introduces a NumberBound struct to handle these literals and adds validation to prevent float literals from being used on integer-typed fields. The review feedback suggests refining NumberBound::to_tokens to avoid explicit f64 casts, which allows for better type inference, and updating NumberBound::to_f64 to parse integer literals directly as f64 to avoid potential truncation of large integer values.

Comment thread node-graph/node-macro/src/parsing.rs
Comment thread node-graph/node-macro/src/parsing.rs
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 7 files

Confidence score: 3/5

  • There is a concrete regression risk in node-graph/node-macro/src/parsing.rs: narrowing integer bound parsing to u64 can silently coerce valid large literals to 0.0 during min/max validation, which is user-impacting behavior.
  • Given the issue’s medium-high severity (6/10) and strong confidence (8/10), this lands in a moderate-risk zone rather than a safe-to-merge state.
  • Pay close attention to node-graph/node-macro/src/parsing.rs - integer bound handling may mis-validate large numeric literals due to u64 narrowing.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="node-graph/node-macro/src/parsing.rs">

<violation number="1" location="node-graph/node-macro/src/parsing.rs:144">
P2: Integer bound parsing is narrowed to `u64`, which can silently turn valid large integer literals into `0.0` during min/max validation.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread node-graph/node-macro/src/parsing.rs
@github-actions github-actions Bot temporarily deployed to graphite-dev (Preview) April 23, 2026 22:46 Inactive
@Keavon Keavon merged commit f42d12d into master Apr 23, 2026
11 checks passed
@Keavon Keavon deleted the improve-macro-hard-soft-min-max branch April 23, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant