Two pre-existing problems in get_pit_histogram.forecast_quantile() surfaced during review of #1216 (they exist on main and are unrelated to that PR's changes):
-
Unsorted breaks produce negative densities and nonsense bins. E.g. get_pit_histogram(fq, breaks = c(0.5, 0.25)) yields a bin [0.5, 0.25) with negative density. The internal present_quantiles is sorted, but the user-supplied quantiles/breaks vector is not — sorting it (or asserting sortedness) would fix this cheaply.
-
num_bins = 1 silently returns a 0-row table. Quantile levels 0 and 1 are always injected into present_quantiles and therefore considered 'present', so the missing-quantiles fallback never triggers on that path.
Found during the automated review pass over the #1189 bug-audit PRs (directed by @nikosbosse).
Two pre-existing problems in
get_pit_histogram.forecast_quantile()surfaced during review of #1216 (they exist on main and are unrelated to that PR's changes):Unsorted
breaksproduce negative densities and nonsense bins. E.g.get_pit_histogram(fq, breaks = c(0.5, 0.25))yields a bin[0.5, 0.25)with negative density. The internalpresent_quantilesis sorted, but the user-supplied quantiles/breaks vector is not — sorting it (or asserting sortedness) would fix this cheaply.num_bins = 1silently returns a 0-row table. Quantile levels 0 and 1 are always injected intopresent_quantilesand therefore considered 'present', so the missing-quantiles fallback never triggers on that path.Found during the automated review pass over the #1189 bug-audit PRs (directed by @nikosbosse).