Skip to content

build(deps): replace chrono with jiff - #436

Merged
plusky merged 2 commits into
mainfrom
build/jiff-432
Nov 17, 2026
Merged

plusky merged 2 commits into
mainfrom
build/jiff-432

Conversation

@plusky

@plusky plusky commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Replaces the unmaintained chrono (RUSTSEC-2026-0543), which fails the required rust-deny check on every PR, with jiff 0.2; initialize and tools/list are served byte-identical, and the second commit's message lists every parsing and formatting difference measured against chrono. The first commit refuses a negative younger_than_days or min_bug_age_days at load, because the swap keeps every verdict only without them; it cannot land on its own while rust-deny is red, so cargo deny first passes at the second commit. bugwarden-core's public API now takes jiff::Timestamp, so its next release has to be 0.8.0.

Closes #432

A negative `younger_than_days` or `min_bug_age_days` loaded without
complaint. For the matcher it asks for a cutoff in the future: the
rule matched nothing, until the count was large enough for the date
arithmetic to overflow, and from there it matched every bug, because
an unrepresentable cutoff reads as "every bug is young". Where that
flip happens depends on the date library's range, so the meaning of
such a value is not something the policy file controls. A negative
`min_bug_age_days` was inert; it is refused so that one sign rule
covers both.

Policy::validate now refuses them, naming the rule or the global key.
Zero stays legal in both places. A policy file that carried a
negative count stops the server from starting until the value is
changed, and the README says what each rewrite means.
chrono is unmaintained (RUSTSEC-2026-0543), and deny.toml fails on an
unmaintained crate that a workspace crate depends on directly. Both
crates did, for one type and three operations: an instant, parsing
it, subtracting days from it and formatting it. jiff 0.2 covers those
with its defaults switched off, so no time zone database comes along,
and schemars emits the same `date-time` schema for jiff::Timestamp as
for chrono's DateTime: `initialize` and `tools/list` are served
byte-identical.

Measured against chrono 0.4.45 with jiff 0.2.46, over 64 timestamp
strings, a grid of day counts and 20,012 instants:

- Parsing follows jiff's ISO 8601 grammar. It accepts strings chrono
  refused (no seconds, `+02`, a bracketed zone name) and refuses some
  chrono accepted (ten or more fractional digits, a Unicode minus,
  the last hours of year 9999; on the tool parameters also
  surrounding whitespace and unpadded fields). A second 60 reads as
  59. Bugzilla's own shape reads as the same instant, and an
  unparsable `creation_time` is still unknown and fails closed (I4).
- `age_cutoff` gives the same cutoff wherever both can represent it.
  jiff stops at year -9999 where chrono went some 262,000 years
  back; for a cutoff before that, both criteria reach the verdict
  they reached with chrono. A cutoff after year 9999 takes a negative
  count, which the loader now refuses; built past it, the matcher
  matches nothing.
- The audit `ts` is byte-identical. So is the query string sent to
  Bugzilla from year 0000 on; before it jiff writes `-001` where
  chrono wrote `-0001`.
- The reply to an unusable `new_since` or `changed_since` carries
  jiff's wording, which quotes the unparsed rest of the client's own
  string, escaped. At the default log level none of it is logged;
  under debug rmcp's `response message` line carries it, as it does
  for every parameter error. The two parameters' own log fields
  print fractions without trailing zeros.

chrono stays in the dependency tree through rmcp, which depends on
it and enables schemars' chrono04. bugwarden-core's public API takes
jiff::Timestamp where it took chrono::DateTime<Utc>, a breaking
change for that crate: its next release has to be 0.8.0.
@plusky
plusky merged commit a958531 into main Nov 17, 2026
19 checks passed
@plusky
plusky deleted the build/jiff-432 branch November 17, 2026 15:15
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.

build: chrono is flagged unmaintained (RUSTSEC-2026-0543) and fails rust-deny

1 participant