Title: Refuse a whole-number float in an integer field at config validate by shipmill-romamo[bot] · Pull Request #603 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Refuse a whole-number float in an integer field at config validate by shipmill-romamo[bot] · Pull Request #603 · cloudfall-dev/cloudfall
X Title: Refuse a whole-number float in an integer field at config validate by shipmill-romamo[bot] · Pull Request #603 · cloudfall-dev/cloudfall
Description: Plan Serves: quality bar (Q-1) Files: sdk/tests/test_strict_integer.py (new), sdk/src/cloudfall/validation.py, changelog.d/602-strict-integer.md; review fix: sdk/src/cloudfall/domain.py, sdk/tests/test_retain_releases.py Order: commit the failing regression test alone first (a whole-number float in spec.proxy.upstream.port and in spec.proxy.maxRequestBodyMegabytes is refused by config validate with its field path; plain integers still pass; true is still refused); then build SchemaCatalog's validators from a Draft202012Validator extended with a strict integer type checker, with its changelog fragment Proof: uv run pytest sdk/tests/test_strict_integer.py fails on main and passes with the fix; sdk/tests/test_validation.py, sdk/tests/test_domain_request_body_limit.py and the other validation tests stay green; uv run cloudfall config validate --project config/examples passes Kind: fix Tests changed: sdk/tests/test_retain_releases.py: it asserted that retainReleases: 2.0 validates and reads as 2, the one integer field that coerced a whole-number float; under this change 2.0 is refused like every other integer field, so its cases move from the accepted to the refused lists Summary SchemaCatalog built a stock Draft202012Validator, whose integer type accepts a float with a zero fractional part. A Domain with spec.proxy.upstream.port: 8100.0 passed cloudfall config validate, then the value object (_required_bounded_integer) raised TypeError and the command that read it, such as cloudfall domains apply, failed with HANDLER_CRASHED. The catalog now builds its validators from jsonschema.validators.extend(Draft202012Validator, type_checker=...), whose integer accepts only a Python int and still refuses bool. Every integer field of every schema refuses 8100.0 at config validate, reported as schema_validation_failed with the field's path, like any other schema error. check_schema still checks each schema against the 2020-12 metaschema, and $refs resolve through the same strict validator class. The value objects' TypeError stays as the second line of defence. Behaviour change: a project that writes a whole-number float in any integer field now fails config validate. For every field but one, such a value passed and then crashed the command that read it. The exception is a Component's spec.deployment.retainReleases: RetainReleases.from_boundary turned 2.0 into 2, so retainReleases: 2.0 validated and worked on main. It is now refused like the rest, and the value object no longer coerces it (review fix). No example or fixture writes an integer as a float. The changelog entry is under ### Breaking, as D-14 requires for a change after which a config that validated before stops validating, and names retainReleases and the step a user takes before upgrading. Test notes New: sdk/tests/test_strict_integer.py, failing on main, passing here Changed in review: sdk/tests/test_retain_releases.py, where 2.0 joins the refused values and the value object's refused list (the latter fails on the old coercion) Ran locally: uv run ruff check ., uv run mypy, uv run cloudfall config validate --project config/examples, and the validation and retain-releases test files; the full suite is left to CI Fixes #602 🤖 Generated with Claude Code
Open Graph Description: Plan Serves: quality bar (Q-1) Files: sdk/tests/test_strict_integer.py (new), sdk/src/cloudfall/validation.py, changelog.d/602-strict-integer.md; review fix: sdk/src/cloudfall/domain.py, sdk/tests...
X Description: Plan Serves: quality bar (Q-1) Files: sdk/tests/test_strict_integer.py (new), sdk/src/cloudfall/validation.py, changelog.d/602-strict-integer.md; review fix: sdk/src/cloudfall/domain.py, sdk/tests...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/603
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:b52c5071-0d48-914d-bcd5-5e20d3ce9c2d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D500:20F35A:EBE057:141DB18:6B0557C4 |
| html-safe-nonce | e41a2bb4da04a794310ea4c9a462a42ee331ed8dcf3b7a959b5da94f3027df57 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTAwOjIwRjM1QTpFQkUwNTc6MTQxREIxODo2QjA1NTdDNCIsInZpc2l0b3JfaWQiOiIxMDk2NTU1NjUyNjg5Nzc4NjI4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 31111d783eab347ebbd621876a4aafc80c51210b588c01a9d7bc7555ed6cb9c1 |
| hovercard-subject-tag | pull_request:5460447969 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/603/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Plan Serves: quality bar (Q-1) Files: sdk/tests/test_strict_integer.py (new), sdk/src/cloudfall/validation.py, changelog.d/602-strict-integer.md; review fix: sdk/src/cloudfall/domain.py, sdk/tests... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width