//! A repeating todo's occurrence ids: the rule's instants (cotton-rules) under//! the store's derived id. The id is what decides whether the person sees one//! todo or two, so both halves are held together here.use cotton_core::transforms::rrule::{expand_rrule, DateRange};use cotton_store::protocol::derived_id::recurrence_occurrence_id;use cotton_store::protocol::js::{parse_date_ms, to_iso_string};fn iso_expand(rule: &str, dtstart: &str, from: &str, to: &str, zone: &str) -> Vec<String> {let at = |iso: &str| parse_date_ms(iso).expect("an ISO instant"); expand_rrule(rule, at(dtstart), DateRange { from: at(from), to: at(to) }, zone) .expect("a valid rule") .into_iter() .map(|ms| to_iso_string(ms).expect("a renderable instant")) .collect()}#[test]fn the_ids_the_two_producers_derive_are_identical_and_zone_sensitive() {const RECURRENCE: &str = "8f1d1c2e-0000-4000-8000-000000000001";let ids_for = |zone: &str| -> Vec<String> { iso_expand("FREQ=MONTHLY;BYMONTHDAY=2", "2026-02-02T03:30:00.000Z", "2026-08-01T00:00:00.000Z", "2026-10-01T00:00:00.000Z", zone) .iter() .map(|iso| recurrence_occurrence_id(RECURRENCE, iso)) .collect() };let kolkata = ids_for("Asia/Kolkata"); assert_eq!(kolkata.len(), 2);// Two calls in the same zone agree — the property the whole design buys. assert_eq!(kolkata, ids_for("Asia/Kolkata"));// And changing the zone MOVES them: a zone silently ignored would satisfy// the line above vacuously. assert_ne!(kolkata, ids_for("Europe/Berlin"));}