Repository navigation
Judge recurring occurrences by one range test and their overrides (#98) - #110
Conversation
A series was expanded by its original recurrence ids, so an occurrence moved into the queried range from outside it was missed and one moved out of it was still listed there. seriesOccurrences judges each occurrence after its overrides apply (incl. RANGE=THISANDFUTURE) and finds moved-in overrides from their finite list, checking with a short walk around the RECURRENCE-ID that it is a real occurrence — so the walk still starts just before the range, not at DTSTART. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every occurrence of a series counted with the master's STATUS and TRANSP at its original time: a cancelled or transparent single occurrence still blocked time, a moved one blocked its old slot, and an opaque occurrence of a transparent series did not block. Free/busy now goes through seriesOccurrences, which also gives it the near-the-range start it lacked. The event details list only what blocks the window, each as its occurrence there, not every object the server returned. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With occurrences listed one by one, a cancelled occurrence looked like a meeting that takes place. The STATUS of what is shown — for a series, the occurrence listed — is now printed. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Regression cases for #98, plus a differential check: random series with random overrides (moved in, out, within, cancelled, transparent, THISANDFUTURE, orphaned, EXDATEd) and random ranges, the fast path against a plain expansion from DTSTART, in four host zones. A spy on the expansion pins that the walk still starts near the range. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Closes #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of #110 found that "which occurrences touch a range" had several answers. Free/busy counted overlap while the lists counted "starts in range, end included", so a running meeting was busy but "not in range". Overrides were matched to occurrences by the text of RECURRENCE-ID, so a UTC id on a zoned or floating series missed. ical.js applied THISANDFUTURE overrides that name no occurrence. Moved-in overrides re-walked from DTSTART one by one (34 s for 200 of them). A capped walk reported busy time as free. src/occurrences.js now answers it once for every tool: - RFC 4791 9.9 half-open overlap, instants read like toInstant - RECURRENCE-IDs aligned to DTSTART's frame by instant before relating; THISANDFUTURE applied here, only when its id is an occurrence - overrides in range plus THISANDFUTURE ids validated in one walk that restarts near each id - near-range start also for HOURLY/MINUTELY/SECONDLY, BYHOUR/BYMINUTE/ BYSECOND, and COUNT without BY parts (cut at its last occurrence) - truncation reported: free/busy names the series, lists say an earlier occurrence may exist Free/busy returns the blocking occurrences per object and the details print exactly those. blocksTime moves next to todoStatus and compares case-insensitively. The differential test now runs the callers themselves against an independent reference expanded once per case, including capped series. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
calendar_query and list_events now list a recurring event as its first occurrence touching the range, cancelled ones included with their Status; freebusy_query names a series it could not expand fully. The descriptions say so, so a model does not read a running meeting or a cancelled entry as an error. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The entry described the first fix only; it now covers the range test, RECURRENCE-ID matching, the wider near-range start, the cap warning, and that an override without STATUS of a cancelled series stays busy. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # CHANGELOG.md
Re-review of #110 (2855b1f) found: - each override re-walked from days before its RECURRENCE-ID with a cap per walk: MINUTELY since 2000 + 1000 overrides took 123 s - dense rules spent the cap on the 26 h pre-range slack (Busy (0)) - capped results could contain wrong occurrences (an unchecked THISANDFUTURE not applied) - a timed RECURRENCE-ID on an all-day series took the UTC day - floating EXDATEs matched as UTC while RECURRENCE-IDs use the host clock Now one 25 000-step budget bounds a whole call. Walks start at the period that holds the id or range (whole periods on DTSTART's wall clock), dropping a shifted start the rule would not generate, so an override costs a few steps. Under truncation, unchecked overrides and anything an unchecked THISANDFUTURE might move are left out: incomplete, never wrong. A timed id on an all-day series names its written date; EXDATEs are aligned like RECURRENCE-IDs. Overrides also match by the instant their id names (the aligned wall clock is ambiguous at a DST fold). Limiting BYHOUR/BYMINUTE/BYSECOND (BYHOUR on HOURLY) is walked from DTSTART: ical.js does not step it on a fixed grid. ical.js no longer looks up overrides at all. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The entries now describe the per-call step budget, the start at the period holding the range, the incomplete-but-not-wrong guarantee, and how a timed RECURRENCE-ID on an all-day series and EXDATEs on a floating series are read. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The wall-clock guards measured 1.18 s on a loaded two-core CI runner for work that takes 0.17 s locally, while the differential's child processes share the CPU. Expansion steps are what tells the fixed pass (a few per override) from the old one (hundreds or thousands per override), and they do not depend on the machine; a 5 s bound stays as a stall guard. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
0.7.0 exports what the occurrence engine needs: a bounded expansion (expandOccurrences with a shareable budget) and zone conversion that is right at DST changes (resolveZone). The lockfile changes only that entry. Since 0.5.0, moving a series' DTSTART moves its overrides with it; the one test that pinned the old behaviour follows. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Final review of #110 found two faults with one root: dav-mcp read occurrences with its own ical.js walk. ical.js converts UTC to local up to an hour off near DST changes (ical.js#847), so EXDATEs and RECURRENCE-IDs at the autumn fold matched the wrong occurrence; and it tests rule candidates without a bound, so a limiting BYHOUR from 1950 took 27 s, fifty such series 45 s per call, and BYMONTHDAY=30 in February never returned. The expansion is now the library's expandOccurrences, the reader the write side uses, so both agree on overrides and EXDATEs (by instant, first pass at a fold). On top of it: the copy expanded starts at the period holding the range (or the override checked), overrides moved in from anywhere are checked in clusters, THISANDFUTURE moves later occurrences. One budget per tool call bounds every candidate and every library call; out of budget means incomplete, never wrong. A shifted start the rule would not generate, or one past UNTIL, is dropped (the library counts any DTSTART). Converters are cached per VTIMEZONE text and copies keep only nearby EXDATEs, as neither is budgeted. Copies are deep clones: toJSON is ical.js's live jCal. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The entries claimed EXDATEs matched by instant and a near-range start for any BYHOUR; neither held. They now describe the library's reading of RECURRENCE-ID and EXDATE, the expanding-only near-range start, the per-call budget, and the 0.7.0 bump with its EXDATE write change. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of #110 (f327ead) found ordinary calendars reported incomplete: MONTHLY and YEARLY series walked from DTSTART, so 30 monthly series from 2010 or 200 yearly birthdays spent one 150 000 budget and most came back incomplete; and one heavy series could starve the rest. MONTHLY/YEARLY now start a whole number of months or years later, anchored one period before the one holding the range so ical.js' first, possibly partial period is never used (ordinal BYDAY, negative BYMONTHDAY, BYSETPOS covered; MONTHLY;BYMONTH and YEARLY BYWEEKNO without BYDAY excluded). Each object gets a fair share of the call's budget. A request budget charges measured time (400 000 units, ~2 s), so the stated bound holds; only overrides in the main window go to it. Also: an all-day occurrence without DTEND/DURATION lasts its day (RFC 5545 3.6.1); times are shown via tsdav-utils (exact at a DST fold); an unreadable series is named with the library's reason; MONTHLY;BYMONTH gets a year of lookahead, as ical.js yields its months out of order and the library stops at the first past `until`. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Describes the MONTHLY/YEARLY near-range start, the time-charged budget with its measured bound and fair shares, the all-day default length, the display conversion and the reason given for an unreadable series. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
CI ran one degenerate series for 2.4-2.7 s: the timed budget counted candidates and measured time on one scale, so a single library call could spend all its units on candidates before any time was charged, and on slower CPUs that is far over the stated bound. Candidates (300 000 per tool call, at most 100 000 per library call) and time (1.5 s of expansion) are now separate, each shared fairly by the objects of a call; whichever runs out first ends the expansion. The time can overrun by one capped call at most. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Review of #110 (81b865d) found two ways to a wrong answer reported as complete. A MONTHLY/YEARLY start moved into a period without a valid day makes ical.js shift its INTERVAL grid, roll to 1 March or stop (29 February from 1980 gave 1 March 2026; the 31st every fourth month lost 1 December 2028). And ical.js yields BY lists in written order (BYHOUR=17,9) while the library stops at the first candidate past its window, so an override of the skipped candidate vanished. The start now moves only where every month or year provably holds an occurrence (BYMONTHDAY within ±28, ordinal BYDAY within ±4 of a month, BYSETPOS within the weekdays every month has, ...); the rest walk from DTSTART. Any BY list out of ascending order (or mixed signs, ordinals, MONTHLY;BYMONTH) reads one period past the window. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The time bound is 1.5 s plus up to one library call per remaining object, so it grows with the answer; load can flag a series incomplete; a walk over 100 000 candidates is incomplete even alone. Also the provably non-empty periods the near-range start now requires. Refs #98 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Review summary: reviewers A (correctness, independent RFC oracle, live Baïkal) and B (callers/design), then five verification rounds. Final state: one occurrence engine on tsdav-utils 0.7.0 (expandOccurrences + dav-mcp's moved-in override pass and THISANDFUTURE), one half-open range test across free/busy, calendar_query and list_events, RECURRENCE-ID/EXDATE matched by instant (RFC 5545 §3.3.5), near-range start only for rule shapes where every period provably has an occurrence, look-ahead for non-monotonic BY lists, per-call budget with per-object fairness, flagged-incomplete instead of wrong. Last round: 6,240-case fuzz 0 unexplained; MONTHLY/YEARLY sweep 0 PR-only deviations; birthday/monthly calendars complete; my own re-run of the reviewer's empty-period probe: 1,500 cases, 0 deviations; dropped-override probe: all shapes found. Documented limits: time bound grows with response size; load can mark series incomplete (always flagged). Follow-ups: tsdav-utils#31 (non-monotonic iteration upstream), dav-mcp#117 (floating times). CI green. |
Brings in the occurrence engine (#110) and tsdav-utils 0.6 adoption with the write-refusal mapping (#114). Resolved so that: - every library refusal goes through explainWriteRefusal; the occurrence-name refusals stay composed in occurrence-edits and hand everything else to it. Library sentences that name options the tools do not have (cancelOccurrences, list mode "replace", absoluteTime "as-given") are translated or replaced, and an orphaning rule change names restore_occurrences in the same call or the raw tool; - the series-change reply compares the object after cancel/restore with the one after the fields, and counts exclusions, extra dates and overrides by occurrence name (occurrence-names.js), not by stored text or position; the Occurrences line stays separate; - tool descriptions combine both, kept compact: cancel/restore through the parameters, move or retitle one occurrence through the raw tools, start_date is the series' first start; - the CHANGELOG has one tsdav-utils 0.7.0 line, points #126 to cancel_occurrences, and corrects how to start a series later. Refs #126 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Recurring events were judged by their original dates and by the series' own STATUS/TRANSP (#98). A cancelled or transparent single occurrence still showed as busy, an occurrence moved from the 20th to the 14th did not appear on the 14th and was still reported on the 20th, and an opaque occurrence of a transparent series did not block time.
The reviews of this PR found more under the same question, "which occurrences touch a range":
BYHOURfrom 1950 took 27 s, fifty such series 45 s per tool call, andBYMONTH=2;BYMONTHDAY=30never returned (also on main)Change
tsdav-utils 0.7.0 (
npm:@philflow/[email protected], lockfile: only that entry). Since 0.5.0, moving a series' DTSTART moves its overrides; one test expectation follows. 0.7.0 also makes anEXDATE/RDATEfield the whole list. Nothing in this PR writes EXDATE expecting an append; #126 covers cancelling one occurrence.One engine,
src/occurrences.js, used by free/busy,calendar_query,list_eventsand the event display, built on the library'sexpandOccurrencesso dav-mcp and the write side agree on which occurrences a series has:UNTILon a floating series) is reported incomplete.RANGE=THISANDFUTUREoverrides move later occurrences by their own wall-clock move; ones that name no occurrence are ignored.DAILY;BYMONTHDAY=1,15from 1970, which cannot start near the range.freebusy_querynames each such series (with the library's reason where it cannot read one) and never answers a bare "Nothing blocks this window"; event lists say the series could not be expanded fully.BYHOUR=17,9; MONTHLY;BYMONTH a year's months in list order), andexpandOccurrencesstops at the first candidate pastuntilwhile reporting the list complete. dav-mcp reads one period past its window whenever a BY list is out of ascending order, mixes signs or has ordinals. Upstream: tsdav-utils#31.Free/busy returns the blocking occurrences per object, and the event details print exactly those.
blocksTimecompares case-insensitively; an override without STATUS of a cancelled series blocks time. Listed events show theirSTATUS. Tool descriptions,manifest.jsonand the CHANGELOG ([Unreleased]) describe all of this.Out of scope:
Tests
__tests__/override-occurrences.test.js(53 tests):__tests__/fixtures/override-differential.mjs, 100 cases × 4 host zones run in parallel):expandOccurrencesfrom DTSTART with an unlimited budget, plus THISANDFUTURE moves, the RFC default length and the touches-range test, written separately from the engine.familyprobe: 0 deviations from the library's full expansion over 3 689 cases.review-110e):monthly(30 series): complete, 0.1 s;bday(200): complete, 0.05 srealistic(100 series, week / month / year): complete, 0.8 / 0.7 / 1.5 scalls(MINUTELY with 3 000 moved-in overrides): 2.2 s total, budget-capped and flagged incompleteCloses #98
🤖 Generated with Claude Code