Repository navigation
fix(workflows): keep integer number inputs exact instead of rounding them - #5027
Merged
mnriem merged 1 commit intoOct 19, 2026
Merged
Conversation
…them `type: number` inputs went through float(), so integers above 2**53 (64-bit ids, nanosecond timestamps) were rounded before any step saw them, and an enum default holding such an integer failed validation against its own rounded value. Try int() first for strings and ints, and keep the float path for decimal and exponent forms. Assisted-by: Codex CLI (model: gpt-6.1-sol, autonomous) Assisted-by: Claude Code (model: claude-opus-5-5, autonomous)
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The localized fix preserves existing validation and includes focused unit and CLI regression coverage.
No open issues 🎉
What changed in this PR
Preserves exact integer workflow inputs, preventing silent rounding of large identifiers and timestamps.
Changes:
- Parse integers before using floating-point conversion.
- Add precision, validation, enum, and CLI regression tests.
- Document number-input conversion rules.
Tests were not rerun; validation uses the supplied regression evidence. Review generated by GitHub Copilot (model unknown, autonomous).
| File | Description |
|---|---|
| tests/test_workflows.py | Covers precision, accepted forms, rejection, and enums. |
| tests/specify_cli/workflows/test_command_run.py | Checks exact values in shell output and persisted state. |
| src/specify_cli/workflows/engine.py | Preserves integers during number-input coercion. |
| docs/reference/workflows.md | Explains numeric conversion behavior. |
Review effort: Max
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Workflow inputs declared as
type: numbergo throughfloat()inWorkflowEngine._coerce_input(src/specify_cli/workflows/engine.py), even when the value is already an integer, or an integer string from--input. Integers above2**53, such as 64-bit ids or nanosecond timestamps, are rounded before any step sees them. The run still completes, so the wrong value is written without any error. Anenumthat lists such an integer also rejects its own default, because the default is rounded before the enum check.This PR tries
int()first for strings and integers. Decimal and exponent strings and native floats keep the existing float path. The boolean rejection, the error messages and the enum check are unchanged.docs/reference/workflows.mdgets a short paragraph on how number inputs are converted.I haven't seen a user report of this. It came up while reading the input coercion code.
Repro: a workflow with one number input,
record_id, and a shell stepecho {{ inputs.record_id }} > record-id.txt, run withspecify workflow run <yaml> --json:main(e5714c6)--input record_id=179223456789012345617922345678901235201792234567890123456179223456789012345617922345678901235201792234567890123456enum: [1792234567890123456]Input 'record_id' value 1792234567890123520 not in allowed values: [1792234567890123456].1792234567890123456Testing
uv run specify --helpuv sync && uv run pytestNew tests:
tests/test_workflows.py: integers and integer strings at and above2**53keep their exact value, decimal and exponent strings and floats convert as before, booleans and non-finite values are still rejected, and the enum check compares the exact value.tests/specify_cli/workflows/test_command_run.py: the three repro cases above through the realspecify workflow run, checking the written file and the persisted run state.With only
src/reverted tomain, 12 of the 27 new cases fail; with the fix all 27 pass.Full suite on Linux, Python 3.13: 12436 passed, 377 skipped (
uv sync --extra test, thenuv run pytest, 16m).Ruff 0.15.0 (
ruff check src tests) passes.AI Disclosure
AI disclosure: Two agents, both autonomous. Codex CLI (model: gpt-6.1-sol, reasoning effort xhigh, autonomous, sandboxed and offline) found this while reading the workflow input code, wrote the reproduction, and generated the fix, tests and docs paragraph. Claude Code (model: claude-opus-5-5, autonomous) reviewed the change, reran the tests against
mainand the fix, reran the repro with the realspecifyCLI, ran the full suite and lint, and drafted this description. Commits carryAssisted-by:trailers.