Skip to content

Python: parse scientific notation in declarative numeric values - #9077

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ktz03:fix/declarative-number-exponents
Oct 9, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
ktz03:fix/declarative-number-exponents

Conversation

@ktz03

Copy link
Copy Markdown
Contributor

Motivation & Context

Declarative ParseValue converts numeric strings without a decimal point using int(). Caller input such as "1e3" or "-2e-2" therefore silently becomes zero, while the equivalent decimal-bearing form "3.5e2" parses correctly. A workflow can store the wrong value or take the wrong numeric branch.

Description & Review Guide

  • What are the major changes? Parse no-dot e/E notation as a finite float. Add executor and public workflow regressions for positive/negative exponents, whitespace, ordinary numbers, a large exact integer, invalid input, and overflow.
  • What is the impact of these changes? Valid finite scientific notation retains its value. Plain integers keep their existing exact int conversion, and the decimal-bearing path and invalid-input fallback remain unchanged. On Windows with Python 3.12.14, the 61 focused cases pass after 16 fail on the baseline; the declarative unit suite passes 1,408 tests with 93% coverage and no skips. Ruff, source Pyright, all five test type checkers, applicable pre-commit hooks, and wheel/sdist builds pass. No provider integration tests were run.
  • What do you want reviewers to focus on? Scientific notation through caller input, preservation of integer precision, and keeping non-finite results out of the newly accepted exponent path.

Related Issue

Fixes #9076

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix). A workflow keeps the label and title prefix in sync automatically.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:54
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Oct 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused implementation preserves existing behavior and is comprehensively covered by regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes declarative numeric parsing for finite scientific notation while preserving exact integer conversion and existing invalid-input fallbacks.

Changes:

  • Parses no-dot e/E notation as finite floats.
  • Adds executor and workflow-level regression coverage.
File Description
python/​packages/​declarative/​agent_framework_declarative/​_workflows/​_executors_basic.py Adds finite scientific-notation conversion.
python/​packages/​declarative/​tests/​test_graph_executors.py Covers notation, precision, whitespace, invalid input, and overflow.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Merged via the queue into microsoft:main with commit 9f21f1a Oct 9, 2026
53 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — 52b0e94c Deployed Oct 9, 2026 by ktz03 via team_check #6418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: ParseValue converts scientific notation without a decimal point to zero

3 participants