Skip to content

fix(compiler): reject non-finite float literals - #934

Open
sean0407 wants to merge 3 commits into
ModernRelay:mainfrom
sean0407:codex/fix-nonfinite-query-float-920
Open

sean0407 wants to merge 3 commits into
ModernRelay:mainfrom
sean0407:codex/fix-nonfinite-query-float-920

Conversation

@sean0407

Copy link
Copy Markdown

Closes #920.

Oversized decimal float literals parse as non-finite f64 values and currently fail later with a generic range error. Reject them during query type checking with stable T3 and add an issue-named GQT regression case.

@azimafroozeh azimafroozeh self-assigned this Oct 10, 2026
@azimafroozeh
azimafroozeh marked this pull request as ready for review October 10, 2026 16:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T16:46:03.738400Z 29ce718 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29ce718e51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +3122 to +3125
Literal::Float(value) if !value.is_finite() => Err(CompilerError::typed(
T3,
"float literal must be finite and within the F64 range".to_string(),
)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Adapt the NaN erasure fixture to the new validation

When the canonical compiler tests run, ir::erase::tests::every_expression_variant_preserves_its_fields feeds Literal::Float(f64::from_bits(0x7ff8_0000_0000_0001)) (NaN) into literal_type(...).unwrap() at crates/omnigraph-compiler/src/ir/erase.rs:461-475. This new arm makes that call return Err, so the test deterministically panics and the workspace CI test graph cannot pass; update the fixture/helper to assign the forged literal's F64 type without unwrapping this validator (or otherwise adapt the test) as part of this change.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +3122 to +3125
Literal::Float(value) if !value.is_finite() => Err(CompilerError::typed(
T3,
"float literal must be finite and within the F64 range".to_string(),
)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate nearest vector elements before the dimension shortcut

When a non-finite value appears inside a correctly sized literal vector used by nearest, e.g. order { nearest($d.embedding, [<oversized decimal>.0, 0.0]) }, the special case at typecheck.rs:2285-2300 checks only dimension and returns before this recursive literal_type arm is reached. Consequently typecheck_query_decl reports success, so both the stored-query boot/offline check (crates/omnigraph-server/src/queries.rs:262-266) and cluster config validation (crates/omnigraph-cluster/src/config.rs:1321-1327) admit a broken query; it is rejected only later when lower_query re-types the child at invocation. Validate the vector elements before that early return.

Useful? React with 👍 / 👎.

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.

bug: an out-of-range float literal is refused without a stable code

2 participants