Skip to content

Roadmap 2.2: the files backend - #26

Merged
tobixen merged 2 commits into
mainfrom
roadmap-2.2-files
Oct 23, 2026
Merged

tobixen merged 2 commits into
mainfrom
roadmap-2.2-files

Conversation

@tobixen

@tobixen tobixen commented Oct 23, 2026

Copy link
Copy Markdown
Member

Disclaimer: Code and the text below the line are AI-generated, by Claude Opus 5.5.


Implements roadmap item 2.2, a backend for local iCalendar files.

  • Layouts. Backend.open(path) picks the layout from the path:

    • a single .ics file;
    • a directory of collection directories, as vdirsyncer lays out a vdir;
    • one collection directory, as khal's path = names it.

    khal, todoman and vdirsyncer can share the same vdir. A path that cannot be a calendar is a ConfigurationError.

  • Writes.

    • Every write goes through a temporary file, keeping the file's mode and any symlink.
    • A vdir create never overwrites another object, and does not store a UID twice when two writers race.
    • A single file is locked (filelock, a new dependency) around each write.
    • The etags of API_DESIGN §7 catch a file edited behind the backend's back.
  • Async. In the async mode, file I/O runs in worker threads, through a new ato_thread helper whose sync twin is a plain call.

  • Capabilities.

    • A collection made for fewer than all components records them in a hidden .calendaring-components file, since the vdir spec has no place for it.
    • time-log is unsupported in a collection holding no events.
  • Tests. The conformance suite passes in all three layouts and both modes.

  • A separate commit records the decision that occurrence edits and recurring-task completion go to edit-icalendar, superseding Proposal: helpers for completing one occurrence of a recurring VTODO (and editing one occurrence) niccokunzmann/python-recurring-ical-events#292. Until edit-icalendar has them, every backend declares them UNSUPPORTED. The capability notes for them, and for time-log without events, are now public constants in calendaring.capabilities.

Left for later:

  • A UID index for large vdirs (each create scans the collection), watching the directory for changes, and a read-only mode over several .ics files.
  • Windows: os.replace while a reader holds the file open is untested, since CI runs on Linux.

🤖 Generated with Claude Code

Backend.open(path) reads and writes a vdir, as vdirsyncer, khal and
todoman lay it out, and a single .ics file, picking the layout from the
path.  Writes go through a temporary file, keeping the mode and any
symlink; a vdir create never overwrites another object or stores a UID
twice, and a single file is locked (filelock) around each write.  File
I/O runs in worker threads in the async mode.  It passes the
conformance suite in all three layouts and both modes.

Prompt: [Please make the files backend, based on the earlier design decisions]

Assisted-By: Claude Opus 5.5 (1M context)
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
The author decided that the occurrence merge and recurring-task
completion go to edit-icalendar, superseding recurring-ical-events
issue 292.  The capability note backends give for those features now
says so, and API_DESIGN and the ROADMAP no longer say CalDAV may call
caldav's code for them.  That note, and the one for time-log in a
collection without events, are public constants in capabilities, so
out-of-tree backends can declare the same.

Prompt: As for the recurring-ical-events #292, I think the decision was to do it in a separate edit-icalendar package.  It's OK to throw NotImplementedError until that's done.  [#292: niccokunzmann/python-recurring-ical-events#292]

Assisted-By: Claude Opus 5.5 (1M context)
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
@tobixen
tobixen merged commit e8e639d into main Oct 23, 2026
8 checks passed
@tobixen
tobixen deleted the roadmap-2.2-files branch October 23, 2026 12:46
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