Skip to content

[FIX] Keep an offset deadline's written date in the cockpit - #144

Merged
puretensor merged 1 commit into
mainfrom
grok/review/deadline-civil-date
Oct 25, 2026
Merged

puretensor merged 1 commit into
mainfrom
grok/review/deadline-civil-date

Conversation

@puretensor

Copy link
Copy Markdown
Owner
  • Seat: grok-4.7 / xhigh (adversarial review wave 7, 2026-10-25)

  • Category: [FIX]

  • Problem / Opportunity: pt serve builds deadline_date for /api/tasks and /api/timeline by converting the timestamp to UTC and then reading that UTC calendar day. The Python sidecar's _parse_deadline uses datetime.date(), which is the date written on the timestamp. 2026-10-26T00:30:00+01:00 is 26 October at that offset and 23:30 UTC on 25 October, so the two cockpits disagree. The day count is already an instant delta and is left alone.

  • Evidence: Sidecar, this session:

python3 -c 'from datetime import datetime; print(datetime.fromisoformat("2026-10-26T00:30:00+01:00").date().isoformat())'
2026-10-26

Unfixed parse_deadline, before the function change (/tmp/ptask-deadline at 1a80d2a plus the new test only):

env PATH=/usr/bin:/bin:/home/puretensorai/.cargo/bin HOME=$(mktemp -d) CARGO_TARGET_DIR=/tmp/ptask-target-deadline cargo +1.98.1 test -p ptask-server --lib timed_deadline_keeps_the_offset_civil_date -- --test-threads=1
thread 'routes::dashboard::tests::timed_deadline_keeps_the_offset_civil_date' panicked at crates/ptask-server/src/routes/dashboard.rs:1702:9:
assertion `left == right` failed
  left: "2026-10-25"
 right: "2026-10-26"
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 141 filtered out; finished in 0.00s

jiff will not parse an offset timestamp as Zoned without a [Time/Zone] annotation, so the written date cannot be recovered by parsing Zoned and then skipping the UTC fold. From jiff 0.2.24 src/fmt/temporal/pieces.rs (the crate this repo already pins):

parsing a datetime string into a `Zoned` requires that the string contain
a time zone annotation. Namely, parsing `2025-01-03T17:28-05` into a
`Zoned` will fail

The date is the leading YYYY-MM-DD once parse_iso_to_utc has accepted the string. A Z timestamp's leading date is the UTC date, which is what the existing sidecar test locks (2026-01-01T09:00:00Z → 2026-01-01).

  • Change: After a successful parse, deadline_date is that leading civil date when it is a real date. Otherwise it stays the UTC date parse_iso_to_utc already returned (SQLite YYYY-MM-DD HH:MM:SS and the char-safe fallback). days_until is still the instant delta. Date-only deadlines stay on the operator-timezone day count. Version 3.51.6 in the workspace package, the six internal requirements, Cargo.lock, and docs/gen/pt.1.

  • Verification: Toolchain 1.98.1, on this branch:

env PATH=/usr/bin:/bin:/home/puretensorai/.cargo/bin HOME=$(mktemp -d) RUSTUP_TOOLCHAIN=1.98.1 CARGO_TARGET_DIR=/tmp/ptask-target-deadline cargo +1.98.1 test -p ptask-server --locked --lib -- --test-threads=8
test result: ok. 142 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.45s

env PATH=/usr/bin:/bin:/home/puretensorai/.cargo/bin RUSTUP_TOOLCHAIN=1.98.1 CARGO_TARGET_DIR=/tmp/ptask-target-deadline bash scripts/ci-version-check.sh
version-check: workspace, lockfile, internal requirements, and manpage agree on 3.51.6

env PATH=/usr/bin:/bin:/home/puretensorai/.cargo/bin HOME=$(mktemp -d) RUSTUP_TOOLCHAIN=1.98.1 CARGO_TARGET_DIR=/tmp/ptask-target-deadline bash scripts/generated-artifacts.sh --check
generated-artifacts: checked-in files match the CLI

env PATH=/usr/bin:/bin:/home/puretensorai/.cargo/bin HOME=$(mktemp -d) RUSTUP_TOOLCHAIN=1.98.1 CARGO_TARGET_DIR=/tmp/ptask-target-deadline cargo +1.98.1 clippy -p ptask-server --locked --all-targets -- -D warnings
Finished `dev` profile [unoptimized + debuginfo] target(s) in 19.56s

The workspace suite and the Python sidecar suite were not re-run. The sidecar function was not changed.

  • Risk & rollback: deadline_date changes only for a timestamp whose written date is not the UTC date. days_until, date-only deadlines, and Z timestamps are unchanged. Revert is one commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@puretensor
puretensor force-pushed the grok/review/deadline-civil-date branch from b93ff85 to bf3b8e2 Compare October 25, 2026 06:14
@puretensor
puretensor merged commit 7366aab into main Oct 25, 2026
5 checks passed
@puretensor
puretensor deleted the grok/review/deadline-civil-date branch October 25, 2026 06:41
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