Skip to content

app/: uploads with --threshold work again (floats under arbitrary_precision); CLI 0.2.24 - #156

Merged
ndbroadbent merged 1 commit into
mainfrom
app-lenient-floats
Dec 3, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
app-lenient-floats

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Every upload with --threshold has been refused since the cutover. Talira's screens job runs visualci upload --threshold 0.1 … (docspring/talira builds 18 to 31), and POST /api/v1/builds/{id}/snapshots answered 422: "invalid body: data did not match any variant of untagged enum NumberOrString".

Cause: app/'s dependencies turn on serde_json's arbitrary_precision. With it, a float that serde buffers (in an untagged enum or a #[serde(flatten)] struct) arrives as a private map, so it can't become an f64. Integers aren't affected, which is why uploads without a threshold worked. Three places had this:

  1. domain::lenient (the REST API's "number or numeric string" fields: a snapshot's threshold, plus size, pr_number, shard_total and shard) used an untagged NumberOrString. It now reads the field as serde_json::Value, which understands arbitrary_precision, and parses the number's exact text or the string into the target type. A non-number is still an error naming what arrived.
  2. visualci-core's Threshold (threshold: in visualci.yml, a number or a glob map) was untagged too, so on the server a stored threshold: 0.1 stopped validating, and BuildSettings treated the whole config as absent. It now has a serde_json::Value-based Deserialize; Serialize and the JSON schema are unchanged. This changes visualci-core, so the CLI goes to 0.2.24.
  3. MCP update_project's args flattened SettingsChange, so threshold, dpi and mask sizes there were refused too. They're now read through serde_json::Value (project taken out, the rest into SettingsChange); the tool's schema is unchanged.

Tests, each failing before the fix (the first one reproduced the production error exactly):

  • lenient::tests::reads_bare_floats_and_integers: 0.1, 1, 2.5e-1, a float where an integer belongs, and a boolean;
  • lenient::arbitrary_precision::a_config_threshold_reads_floats: 0.1 and a glob map, through Config::from_json;
  • lenient::arbitrary_precision::update_project_args_read_numbers: threshold, dpi and a mask's region.bottom;
  • api_builds::snapshots_take_a_float_threshold: a real upload over HTTP with the threshold as a number, a string and an integer, checking the stored value.

Checks (build pool): cargo fmt --all --check, clippy with -D warnings on the workspace, the lenient and api_builds tests, visualci-core's and visualci-cli's tests, and app/'s full suite all pass.

After it deploys, Talira's screens job (run 47218196143) can be rerun.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ct are read through serde_json::Value (arbitrary_precision broke untagged and flattened floats); CLI 0.2.24
@ndbroadbent
ndbroadbent merged commit 947b7cb into main Dec 3, 2026
14 checks passed
@ndbroadbent
ndbroadbent deleted the app-lenient-floats branch December 3, 2026 23:57
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.

1 participant