feat(dates): foundation for the true-instant date contract (#114)

Populate the new-contract date columns at ingest while keeping the
legacy date_taken column byte-identical (ADR-0001):

- camera_tz module: offset cascade (offset tag -> GPS zone -> server
  zone) as a pure, testable function; bundled offline TZF geometry for
  GPS -> IANA resolution; DST-correct offsets for the capture date;
  display-zone helpers (DEFAULT_DISPLAY_TZ, display_zone_for,
  display_zone_offset_minutes) for the read-side cutover.
- EXIF branch: kamadak-exif now collects OffsetTime* tags paired with
  the winning date tag; resolve_date_taken takes an ExifPrior and
  emits (date_utc, camera_offset_minutes, date_taken_tz_source) per
  branch: exif -> cascade, exiftool/fs_time -> utc_direct, filename
  -> unclassified (pending #116).
- Schema: migration adds image_exif.date_utc /
  camera_offset_minutes / date_taken_tz_source and
  user_ai_prefs.display_tz (all nullable; down.sql drops them).
- DAO + ingest: backfill_date_taken persists the triple alongside the
  legacy pair; watcher, upload, and set_image_gps call sites feed the
  cascade.
- Response surface: ExifMetadata and ExifSummary carry the triple so
  /image/metadata and /photos/exif expose it (null for unconverted
  rows); reel requests mirror display_tz into prefs.

cargo build + clippy clean; 625 lib + 702 bin tests pass (the one
failing doctest in utils.rs is pre-existing at the base commit).
This commit is contained in:
Cameron Cordes committed 2026-09-24 21:58:46 -04:00
1 parent ee773a34ef
commit 2f2107d4fa
20 files changed
+1039 -36

No files matched your search

Generated
+71
View File
@@ -779,6 +779,16 @@ dependencies = [
"windows-link",
]
[[package]]
name = "chrono-tz"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6139a8597ed92cf816dfb33f5dd6cf0bb93a6adc938f11039f371bc5bcd26c3"
dependencies = [
"chrono",
"phf 0.12.1",
]
[[package]]
name = "cipher"
version = "0.4.4"
@@ -1552,6 +1562,15 @@ dependencies = [
"version_check",
]
[[package]]
name = "geometry-rs"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "794fbaf8ce24464265e001a7a1dc819e401a303127c0cb714538e21ebe077c77"
dependencies = [
"rtree_rs",
]
[[package]]
name = "getopts"
version = "0.2.24"
@@ -2070,6 +2089,7 @@ dependencies = [
"blake3",
"bytes",
"chrono",
"chrono-tz",
"clap",
"diesel",
"diesel_migrations",
@@ -2103,6 +2123,7 @@ dependencies = [
"tempfile",
"tokio",
"tokio-util",
"tzf-rs",
"urlencoding",
"uuid",
"walkdir",
@@ -2886,6 +2907,15 @@ dependencies = [
"phf_shared 0.11.3",
]
[[package]]
name = "phf"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "913273894cec178f401a31ec4b656318d95473527be05c0752cc41cdc32be8b7"
dependencies = [
"phf_shared 0.12.1",
]
[[package]]
name = "phf_codegen"
version = "0.10.0"
@@ -2957,6 +2987,15 @@ dependencies = [
"siphasher 1.0.3",
]
[[package]]
name = "phf_shared"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06005508882fb681fd97892ecff4b7fd0fee13ef1aa569f8695dae7ab9099981"
dependencies = [
"siphasher 1.0.3",
]
[[package]]
name = "pin-project"
version = "1.1.12"
@@ -3041,6 +3080,12 @@ dependencies = [
"zerocopy",
]
[[package]]
name = "pqueue"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2145d14f09d5fc7fe7134b556146599c2929af5b1f1e3a0ecc9d582a9b85e4d"
[[package]]
name = "precomputed-hash"
version = "0.1.1"
@@ -3460,6 +3505,15 @@ dependencies = [
"thiserror 2.0.18",
]
[[package]]
name = "rtree_rs"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7787960e978c1c675fd6b8eb7d56b9c7162aec55c41d368add6f3ff39251b96e"
dependencies = [
"pqueue",
]
[[package]]
name = "rustc_version"
version = "0.4.1"
@@ -4314,6 +4368,23 @@ version = "1.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
[[package]]
name = "tzf-dist"
version = "0.0.2026-d-fix1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2523c6471fd5827173b5b9d51d4444e1033a1f19339da61603cee9300e3f44be"
[[package]]
name = "tzf-rs"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bd4bd76dc7816db8a12043dbac00254158c17cd2c731aa951fd85f1a9d1f1ae"
dependencies = [
"clap",
"geometry-rs",
"tzf-dist",
]
[[package]]
name = "unicase"
version = "2.9.0"