Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ members = [
resolver = "2"

[workspace.package]
version = "3.51.7"
version = "3.51.8"
edition = "2024"
license-file = "LICENSE"
authors = ["PureTensor, Inc. <hal@puretensor.ai>"]
Expand Down Expand Up @@ -52,12 +52,12 @@ rmcp = { version = "3.3.0", features = ["server", "macros", "schemars", "transpo
futures-util = { version = "0.3", default-features = false }

# Internal crates
ptask-core = { path = "crates/ptask-core", version = "3.51.7" }
ptask-tui = { path = "crates/ptask-tui", version = "3.51.7" }
ptask-server = { path = "crates/ptask-server", version = "3.51.7" }
ptask-bot = { path = "crates/ptask-bot", version = "3.51.7" }
ptask-distill = { path = "crates/ptask-distill", version = "3.51.7" }
ptask-notify = { path = "crates/ptask-notify", version = "3.51.7" }
ptask-core = { path = "crates/ptask-core", version = "3.51.8" }
ptask-tui = { path = "crates/ptask-tui", version = "3.51.8" }
ptask-server = { path = "crates/ptask-server", version = "3.51.8" }
ptask-bot = { path = "crates/ptask-bot", version = "3.51.8" }
ptask-distill = { path = "crates/ptask-distill", version = "3.51.8" }
ptask-notify = { path = "crates/ptask-notify", version = "3.51.8" }

# HMAC for outbound webhook signing (v0.3.5).
sha2 = "0.10"
Expand Down
27 changes: 26 additions & 1 deletion crates/ptask-server/src/routes/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ fn parse_deadline(s: &str) -> Option<(String, f64)> {
let days = today.until(date).ok()?.get_days();
return Some((date.to_string(), f64::from(days)));
}
// Civil date is the date written on the timestamp, matching the sidecar
// `datetime.date()`. `parse_iso_to_utc` folds the instant into UTC
// first, so 00:30 at +01:00 became the previous UTC date. jiff refuses
// to parse an offset timestamp as `Zoned` without a `[Time/Zone]`
// annotation, so the written `YYYY-MM-DD` is read from the text. The
// day count stays an instant delta.
let z = ptask_core::dates::parse_iso_to_utc(s).or_else(|| {
// Date-only "YYYY-MM-DD" → midnight UTC. `s.get(..10)` is char-safe:
// a raw `&s[..10]` panics when byte 10 lands inside a multi-byte scalar
Expand All @@ -379,7 +385,12 @@ fn parse_deadline(s: &str) -> Option<(String, f64)> {
.ok()?
.with_time_zone(ptask_core::jiff::tz::TimeZone::UTC);
let days = (z.timestamp().as_second() - now.timestamp().as_second()) as f64 / 86_400.0;
Some((z.date().to_string(), (days * 10.0).round() / 10.0))
let date = s
.get(..10)
.filter(|prefix| prefix.parse::<ptask_core::jiff::civil::Date>().is_ok())
.map(str::to_string)
.unwrap_or_else(|| z.date().to_string());
Some((date, (days * 10.0).round() / 10.0))
}

fn round4(v: f64) -> f64 {
Expand Down Expand Up @@ -1692,6 +1703,20 @@ mod tests {
);
}

#[test]
fn timed_deadline_keeps_the_offset_civil_date() {
// The sidecar's datetime.date() keeps the offset's calendar day.
// 00:30 at +01:00 is still 26 Oct there and 23:30 UTC on 25 Oct.
// Converting to UTC before reading the date files that deadline
// on the previous day in /api/tasks and /api/timeline.
let (date, _) = parse_deadline("2026-10-26T00:30:00+01:00").unwrap();
assert_eq!(date, "2026-10-26");
// A `Z` timestamp's civil date is the UTC date. The sidecar test
// locks the same string.
let (zdate, _) = parse_deadline("2026-01-01T09:00:00Z").unwrap();
assert_eq!(zdate, "2026-01-01");
}

#[test]
fn parse_deadline_is_char_boundary_safe() {
// Regression: a raw `&s[..10]` panics when byte 10 lands inside a
Expand Down
4 changes: 2 additions & 2 deletions docs/gen/pt.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH pt 1 "pt 3.51.7"
.TH pt 1 "pt 3.51.8"
.SH NAME
pt \- Sovereign task manager for PureTensor
.SH SYNOPSIS
Expand Down Expand Up @@ -208,4 +208,4 @@ Generate shell completions (bash/zsh/fish) to stdout
pt\-help(1)
Print this message or the help of the given subcommand(s)
.SH VERSION
v3.51.7
v3.51.8
Loading