mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-24 01:57:40 -06:00
* Use chrono for UTC/calendar conversion instead of hand-rolled copies Replaces the hand-rolled Howard Hinnant civil/days-from-civil copies and the leap-year/days-in-month table with chrono as a workspace dependency: - apps/lightcraft/src/logging.rs: timestamp (log line time) - crates/catalog/src/dates.rs: civil + weekday - crates/catalog/src/stacks.rs: iso_seconds (date -> seconds) - crates/engine/src/cmd/face_recognize.rs: capture_secs (native only) - crates/meta/src/datetime.rs: DateTime::unix_seconds and the valid() day check Output formats and semantics are unchanged (pre-epoch clamp, day rollover that normalize_iso relies on, leap-second tolerance, EXIF/XMP parsing). chrono uses only std, so wasm stays safe. AGENTS.md/CLAUDE.md now say time goes through chrono. Follow-up to storytold/cadcraft#1785 * Never panic on a clock outside chrono's range; keep 5-digit years unprefixed chrono's From<SystemTime> unwraps, so a clock past year 262143 panicked inside the logger. timestamp now uses the fallible DateTime::from_timestamp and reads such a clock as the epoch, keeping the old pre-epoch clamp. timestamp and catalog's civil write years past 9999 with {:04} like the old {y:04} did, because %Y would add a '+'. Tests cover the out-of-range and 5-digit-year cases. * Don't build an unrepresentable SystemTime in the far-future test UNIX_EPOCH + Duration::from_secs(u64::MAX / 2) overflows Windows' SystemTime and panicked before timestamp() ran, failing the Windows test job. Build it with checked_add and only assert where it exists. * time: preserve old out-of-range date conversion (no epoch fallback) `DateTime::from_timestamp(...).unwrap_or_default()` silently reset any instant past chrono's year range to 1970-01-01, changing output the old hand-rolled Howard-Hinnant code converted exactly (e.g. 10_000_000_000_000 s was 318857-05-20 17:46:40, not the epoch). Restore the old conversion domain with a cycle-based helper that routes the calendar through chrono (the calendar repeats every 400 years = 146_097 days, so month/day/time come from chrono and only the year is carried in i128, keeping every i64 exact). - apps/lightcraft/src/logging.rs: `timestamp` via `utc_parts`; keep the pre-1970 epoch clamp; u64 secs past i64::MAX saturate, not epoch. - crates/catalog/src/dates.rs: `civil` cycle-based (the callers stay inside 0000-9999, but a far clock no longer resets to the epoch). Pinned old outputs in tests: logging u64::MAX/2 s -> 292277026596-12-04T15:30:07.000Z (was epoch), 10_000_000_000_000 s -> 318857-05-20T17:46:40.000Z civil 10_000_000_000_000 -> 318857-05-20T17:46:40, -10_000_000_000_000 -> -314918-08-13T06:13:20, i64 extremes * Don't build a year-318857 SystemTime unchecked in the logging test Windows' SystemTime only reaches about year 30828, so UNIX_EPOCH + Duration::from_secs(10_000_000_000_000) panicked before timestamp() ran and failed the Windows test job. Build it with checked_add and assert where the platform can hold it. The year-10000 case fits everywhere and stays unconditional. * Name the 400-year range extension as the one exception to the time rule The rule said never to hand-roll calendar math, but the range fix (shifting by whole 400-year Gregorian cycles so dates past chrono's year range keep their old output) is cycle arithmetic, so the rule and the code disagreed. The rule now names that exception: the library still computes month, day and time, and only whole cycles are carried in the year. * Say the library computes month and day; time-of-day is plain arithmetic Narrows the range-extension wording: the date library computes the calendar fields, and splitting seconds into hours, minutes and seconds is ordinary arithmetic, which is what the code does.
170 lines
6.8 KiB
TOML
170 lines
6.8 KiB
TOML
[workspace]
|
|
resolver = "3"
|
|
members = ["crates/*", "apps/*", "xtask"]
|
|
|
|
[workspace.package]
|
|
version = "0.11.0"
|
|
edition = "2024"
|
|
license = "MIT OR Apache-2.0"
|
|
rust-version = "1.90"
|
|
repository = "https://github.com/storytold/lightcraft"
|
|
|
|
[workspace.dependencies]
|
|
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "5c874d51eeb3de70e735c8ce87a59a7dedd47675", features = ["serde"] }
|
|
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "82a24b006eefa036b43c09a67fb9a3fbd17ffe63" }
|
|
# internal
|
|
lightcraft-denoise-core = { path = "crates/denoise-core" }
|
|
lightcraft-denoise = { path = "crates/denoise", default-features = false }
|
|
lightcraft-geom = { path = "crates/geom" }
|
|
lightcraft-faces = { path = "crates/faces" }
|
|
lightcraft-sysmem = { path = "crates/sysmem" }
|
|
lightcraft-color = { path = "crates/color" }
|
|
lightcraft-raster = { path = "crates/raster" }
|
|
lightcraft-tiff = { path = "crates/tiff" }
|
|
lightcraft-raw = { path = "crates/raw" }
|
|
lightcraft-codecs = { path = "crates/codecs" }
|
|
lightcraft-meta = { path = "crates/meta" }
|
|
lightcraft-develop = { path = "crates/develop" }
|
|
lightcraft-lensdb = { path = "crates/lensdb" }
|
|
lightcraft-inpaint = { path = "crates/inpaint" }
|
|
lightcraft-scenes = { path = "crates/scenes" }
|
|
lightcraft-pipeline = { path = "crates/pipeline" }
|
|
lightcraft-gpu = { path = "crates/gpu" }
|
|
lightcraft-catalog = { path = "crates/catalog" }
|
|
lightcraft-preview = { path = "crates/preview" }
|
|
lightcraft-merge = { path = "crates/merge" }
|
|
lightcraft-engine = { path = "crates/engine" }
|
|
lightcraft-ui-egui = { path = "crates/ui-egui" }
|
|
lightcraft-mcp = { path = "crates/mcp" }
|
|
lightcraft-fetch = { path = "crates/fetch" }
|
|
lightcraft-heif = { path = "crates/heif" }
|
|
lightcraft-segment = { path = "crates/segment" }
|
|
lightcraft-geocode = { path = "crates/geocode" }
|
|
lightcraft-slideshow = { path = "crates/slideshow" }
|
|
lightcraft-testkit = { path = "crates/testkit" }
|
|
|
|
# foundation
|
|
thiserror = "2"
|
|
sha2 = "0.10"
|
|
serde = { version = "1", features = ["derive", "rc"] }
|
|
serde_json = { version = "1", features = ["float_roundtrip"] }
|
|
log = "0.4"
|
|
# All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md).
|
|
chrono = { version = "0.4.45", default-features = false, features = ["std"] }
|
|
rayon = "1"
|
|
proptest = "1"
|
|
bytemuck = { version = "1", features = ["derive"] }
|
|
crc32fast = "1"
|
|
siphasher = "1"
|
|
libc = "0.2" # dev-only: process CPU time in benches
|
|
dhat = "0.3" # opt-in heap profiling (lightcraft-cli --features dhat-heap) and heap tests; never in product builds
|
|
|
|
# formats
|
|
quick-xml = "0.38"
|
|
miniz_oxide = "0.8"
|
|
|
|
# codecs
|
|
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "tiff", "webp"] }
|
|
zune-jpeg = { version = "0.5", default-features = false, features = ["std", "x86", "neon"] }
|
|
zune-core = { version = "0.5", default-features = false, features = ["std"] }
|
|
jpeg-decoder = { version = "0.3", default-features = false }
|
|
jpeg-encoder = { version = "0.7", default-features = false, features = ["std"] }
|
|
ab_glyph = { version = "0.2", default-features = false, features = ["std"] } # Apache-2.0, pure Rust glyph rasterizer (export watermarks)
|
|
png = "0.18"
|
|
tiff = "0.11"
|
|
image-webp = "0.2"
|
|
moxcms = { version = "0.9", default-features = false, features = ["lut"] }
|
|
jxl-oxide = { version = "0.12", default-features = false }
|
|
jixel = "=0.3.4" # BSD-3-Clause OR Apache-2.0, pure-Rust JPEG XL encoder (export; port of libjxl-tiny)
|
|
zune-jpegxl = { version = "0.5", default-features = false, features = ["std"] } # MIT/Apache-2.0/Zlib lossless JXL encoder (test fixtures only)
|
|
ravif = { version = "0.13", default-features = false, features = ["threading"] } # no "asm": it needs nasm (non-Rust)
|
|
# HDR AVIF (PQ): ravif fixes the sRGB transfer curve, so HDR files drive its rav1e + avif-serialize directly
|
|
rav1e = { version = "0.8.1", default-features = false, features = ["threading"] }
|
|
avif-serialize = "0.8.6"
|
|
|
|
# gpu (crates/gpu; native backends only, no GL: everything stays pure Rust)
|
|
# SAM 3 inference (lightcraft-segment). 0.9.2: later releases pull `tokenizers` with the
|
|
# Oniguruma C library into candle-core, and the product is pure Rust.
|
|
candle-core = { version = "=0.9.2", default-features = false }
|
|
candle-nn = { version = "=0.9.2", default-features = false }
|
|
wgpu = { version = "30", default-features = false, features = ["std", "parking_lot", "metal", "vulkan", "dx12", "wgsl"] }
|
|
pollster = "1"
|
|
|
|
# ui
|
|
egui = "0.36"
|
|
egui_extras = { version = "0.36", default-features = false }
|
|
eframe = { version = "0.36", default-features = false }
|
|
egui_kittest = "0.36"
|
|
rfd = "0.17"
|
|
muda = { version = "0.21", default-features = false } # native menu bar (macOS: objc2/AppKit, pure Rust; no GTK)
|
|
# macOS: the profile of the screen showing the window (safe AppKit bindings; muda and wgpu use the same)
|
|
objc2 = { version = "0.6", default-features = false, features = ["std"] }
|
|
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSApplication", "NSColorSpace", "NSResponder", "NSScreen", "NSWindow"] }
|
|
objc2-foundation = { version = "0.3", default-features = false, features = ["std", "NSArray", "NSData"] }
|
|
# Linux: the desktop's dark/light setting from the XDG settings portal (Settings ▸ Interface ▸
|
|
# Appearance Mode ▸ Auto). Pure Rust; the version accesskit already brings in, pinned to it.
|
|
zbus = "=5.19.0"
|
|
web-time = "1"
|
|
|
|
# web (apps/lightcraft-web)
|
|
wasm-bindgen = "0.2.129"
|
|
wasm-bindgen-futures = "0.4"
|
|
js-sys = "0.3"
|
|
web-sys = "0.3"
|
|
|
|
[workspace.lints.rust]
|
|
unsafe_code = "deny"
|
|
|
|
[workspace.lints.clippy]
|
|
dbg_macro = "warn"
|
|
todo = "warn"
|
|
too_many_arguments = "allow"
|
|
needless_range_loop = "allow"
|
|
type_complexity = "allow"
|
|
excessive_precision = "allow"
|
|
|
|
[profile.dev.package."*"]
|
|
opt-level = 2
|
|
|
|
[profile.dev]
|
|
opt-level = 1
|
|
|
|
[profile.release]
|
|
debug = "line-tables-only"
|
|
|
|
[profile.dist]
|
|
inherits = "release"
|
|
lto = "thin"
|
|
codegen-units = 1
|
|
debug = false
|
|
|
|
# `cargo xtask web`: the browser build. Size matters more than build time: fat LTO, one codegen
|
|
# unit, no symbols, abort on panic (wasm32 can't unwind anyway), size-optimized code — except the
|
|
# crates that do per-pixel work, which stay at opt-level 3 (opt-level "s"/"z" there costs ~50 %/
|
|
# ~130 % render time; measured in docs/web.md → Bundle size).
|
|
[profile.web]
|
|
inherits = "release"
|
|
debug = false
|
|
lto = "fat"
|
|
codegen-units = 1
|
|
strip = true
|
|
panic = "abort"
|
|
opt-level = "s"
|
|
|
|
[profile.web.package]
|
|
lightcraft-pipeline = { opt-level = 3 }
|
|
lightcraft-raster = { opt-level = 3 }
|
|
lightcraft-color = { opt-level = 3 }
|
|
lightcraft-develop = { opt-level = 3 }
|
|
lightcraft-geom = { opt-level = 3 }
|
|
lightcraft-raw = { opt-level = 3 }
|
|
lightcraft-codecs = { opt-level = 3 }
|
|
lightcraft-scenes = { opt-level = 3 }
|
|
lightcraft-preview = { opt-level = 3 }
|
|
zune-jpeg = { opt-level = 3 }
|
|
zune-core = { opt-level = 3 }
|
|
jpeg-decoder = { opt-level = 3 }
|
|
jpeg-encoder = { opt-level = 3 }
|
|
png = { opt-level = 3 }
|
|
miniz_oxide = { opt-level = 3 }
|