Skip to content

A whole-number float in an integer field passes config validate, then crashes the command that reads it #602

Done

Description

@shipmill-romamo

Problem

A whole-number float in an integer field of a declaration passes cloudfall config validate and then crashes the command that reads it.

JSON Schema's "type": "integer" accepts 8100.0 (draft 2020-12 counts a number with a zero fractional part as an integer), so the schema lets it through, while the value objects behind the fields (TcpPort.from_boundary, RequestBodyMegabytes.from_boundary and the others built on _required_bounded_integer in sdk/src/cloudfall/domain.py) refuse anything that isn't a Python int with a TypeError.

Reproduce

On main at 8659e4b, in a copy of config/examples, set the Domain's spec.proxy.upstream.port to 8100.0:

  • cloudfall config validate --project <copy> reports ok
  • cloudfall domains apply on the same project fails with HANDLER_CRASHED (TypeError) instead of a validation error

The same holds for spec.proxy.maxRequestBodyMegabytes: 55.0 once #601 lands; it was found reviewing that PR.

Expected

config validate refuses a float in an integer field with the field's path, as it refuses "55m", so no command gets as far as the value object. Either the validator rejects floats for integer (a format checker or a custom type checker on the validator), or validation runs the value objects and reports their refusal as a validation error. Q-1: a config that validates must not crash a later command.

Touches: the schema validator in sdk/src/cloudfall/validation.py, the integer value objects in sdk/src/cloudfall/domain.py.

Activity

  1. shipmill-romamo commented on Nov 23, 2026

    @shipmill-romamo
    ContributorAuthor

    Triage: implement.

    Confirmed on main at 3a5e60f: SchemaCatalog builds a stock Draft202012Validator (sdk/src/cloudfall/validation.py:292), whose integer type accepts 8100.0, while _required_bounded_integer (sdk/src/cloudfall/domain.py:646) refuses any non-int with a TypeError. That breaks Q-1: a config that validates must not crash a later command. This is a bug fix that restores documented behaviour, so it skips the design gate.

    The plan:

    • Build the catalog's validators from a Draft202012Validator extended with a type checker whose integer accepts only a Python int (and still refuses bool), so every integer field in every schema refuses 8100.0 at config validate, reported with the field's path like any other schema error
    • Keep the value objects' TypeError as the second line of defence
    • Regression tests: config validate refuses spec.proxy.upstream.port: 8100.0 with its path, and a plain 8100 still passes

    Behaviour change: a project that writes a whole-number float (8100.0) in any integer field now fails config validate instead of passing it. Every such value already crashed the command that read it through a value object. I'll link the PR here.

  2. shipmill-romamo commented on Nov 23, 2026

    @shipmill-romamo
    ContributorAuthor

    The fix is in #603: the config validator's integer type now accepts only whole numbers written as integers (still refusing true/false), so config validate refuses 8100.0 with the field's path before any command reads it. The value objects' TypeError stays as a second check. A project with such a value now fails validation where it passed before, so the changelog lists it under Breaking per D-14, with the step to take before upgrading; the decision and its veto window are on #603. The MCP tool-argument validator in investigation.py is left as is: it checks agent tool input, not config. This issue closes when #603 merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions