research: fix Draft 'Invalid Date' + stale-error leak in pipeline card
ci / gates (push) Successful in 15s
ci / frontend (push) Successful in 26s
ci / rust (push) Successful in 3m58s
ci / e2e (push) Skipped
ci / publish (push) Successful in 3m46s

Two cosmetic bugs surfaced by the successful v0.8.3 pipeline run:

1. **'produced Invalid Date'** — research_outcomes.created_at was
   an OffsetDateTime serialized by time's default array format
   (`[y, ordinal, hh, mm, ss, ns, tz]`), which browser's
   `new Date(...)` can't parse. Add `#[serde(with =
   "time::serde::rfc3339")]` matching the pattern already in
   threads.rs / routine_runs.rs.

2. **Stale error text on pipeline card** — the runs stage's
   `latest_error` walked every run by `created_at DESC` and
   returned the first non-empty error, so a topic with an earlier
   failed run + a later completed run kept displaying the old
   error next to '1 completed'. Now the error only surfaces when
   the MOST RECENT run itself failed. Historical failures stay in
   the run count but don't leak their message.
This commit is contained in:
Omar Sobh
2026-07-16 15:59:04 -07:00
parent ae113dd319
commit e3ef3fd056
3 changed files with 22 additions and 5 deletions
@@ -22,6 +22,11 @@ pub struct Outcome {
pub version: i32,
pub body_md: String,
pub produced_by_run_id: Option<Uuid>,
// RFC3339 on the wire so `new Date(...)` in the browser parses it
// instead of choking on the `time` crate's default `[y, ordinal,
// ...]` array format (surfaced as "Invalid Date" in the Draft
// header).
#[serde(with = "time::serde::rfc3339")]
pub created_at: OffsetDateTime,
}