ci: run async integration tests#669
Merged
Merged
Conversation
9234d74 to
d09ec45
Compare
ec47e75 to
7400ca4
Compare
Also catches the NotFoundError when an event is deleted and ignores
the error. For some calendar servers it may be necessary.
The wipe parameter is a tristate:
True – wipe all objects, keep the calendar (for servers like Nextcloud
where HTTP DELETE moves the calendar to a trashbin)
False – always issue HTTP DELETE
None – existing auto-detect: wipe if the server doesn't support deletion
Same applied to the async path (_async_delete).
This change was AI-generated. According to the AI policy feature
changes should in general be human-made. This change was done
en-passant in a long session dealing with improved test coverage in
the GitHub CI runs and getting all the tests to pass. I've carefully
looked through the changeset and amended it. I couldn't do it better
myself (I'm very unhappy about the duplicated code between the async
and sync delete, but haven't come up with any good ideas on how to
consolidate this yet).
The background for this wipe feature was very slow runs on GitHub -
Claude claimed it was due to the NextCloud database getting bloated up
due to the thrashcan feature in NextCloud. Me (the human) suggested
to wipe the calendar instead of deleting it to avoid this thrashcan
problem. Since we already have wipe-logic in the library I didn't
want it duplicated in the test code, so I suggested to have this
wipe-parameter to delete. (It's probably moot anyway, Claude later
disabled the thrashcan feature from the NextCloud config - but it's
a nice feature to have).
Co-Authored-By: claude-sonnet-4-6 <[email protected]>
refactor: DRY up wipe logic in Calendar.delete() via recursive call
The bottom `if wipe:` block in both the sync and async delete paths
duplicated the `wipe is True` early-return logic, but without the
NotFoundError resilience. Replace both with a recursive call into
the wipe=True path.
prompt: in caldav/collections.py, in the delete function for calendars,
the wipe logic is duplicated. Please make it DRY, for instance through
a recursive call
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
AI Prompts:
claude-sonnet-4-6: in caldav/collections.py, in the delete function for calendars, the wipe logic is duplicated. Please make it DRY, for instance through a recursive call
claude-sonnet-4-6: commit
This commit configures Nextcloud/Cyrus for scheduling tests and it adds async-httpx integration run. Only GitHub logic is touched in this commit. Nextcloud: - Add email addresses for scheduling test users (user1-user3). Without mailto: entries in calendar-user-address-set, iTIP delivery fails. - Disable CalDAV trashbin (calendarRetentionObligation=0) so that HTTP DELETE hard-deletes objects; without this, recreating the same UID causes a UNIQUE constraint violation (500 Internal Server Error). Cyrus: - Copy imapd.conf with virtdomains: off before starting CalDAV. The default virtdomains: userid causes caladdress_lookup() to retain the full email form as the userid while mailbox ACLs use the short form, resulting in 403 on iTIP invite delivery. - Unpin Cyrus from the March 2026 digest; :latest is stable again. - Health check uses the CalDAV port (8800) now that the management port (8001) is no longer exposed. async-httpx job: - Add Baikal as a service so the httpx-fallback path is tested end-to-end against a real server (previously only unit tests ran for this backend). Rename "async (niquests fallback)" → "async (niquests)" to reflect that niquests is now the default install, not a fallback. Add comment block explaining why the async-* jobs exist separately from the main tests job. This was AI-generated. I'm happy to let Claude deal with the GitHub CI stuff. prompt: fix the github ci failures for scheduling tests followup-prompt: github runs still fail, please investigate (rinse and repeat. Claude had various hypothesis on why things were breaking and was repeatedly doing code changes - so "why do you think those code changes are relevant, after all the tests are passing locally?" was also frequently used. More prompts may have contributed to this changeset, but those are the most important) Co-Authored-By: claude-sonnet-4-6 <[email protected]>
The purpose of the session was to improve test coverage by the GitHub
tests. I think all tests run by GitHub is also run locally when I'm
running the tests - so I'm a bit confused on why it's needed to change
the test code (as opposed to only fix the github CI setup), but I deem
the changes to be OK.
Most of this commit was done by generative AI. It's deemed OK to use
AI for generating and maintaining the test suite.
This is the AI-generated description of what was done:
Async test generators (ev1, ev2, todo1, todo2) now produce a fresh uuid4 per
call. Fixed UIDs caused UNIQUE constraint violations on Nextcloud because
deleted objects stay in oc_calendarobjects with a deleted_at timestamp until
the trashbin is purged.
async_calendar and sibling fixtures are refactored to use stable cal_ids.
At teardown, servers where delete-calendar.free-namespace is unsupported
(Nextcloud trashbin) now call calendar.delete(wipe=True) instead of HTTP
DELETE to keep the trashbin empty and the database fast. The async_task_list
sharing-with-Cyrus workaround is removed — wipe-at-teardown guarantees UIDs
are gone before the sync suite runs.
test_object_by_uid generates a random UID and deletes it at the end so
repeated runs don't collide.
testRecurringDateWithExceptionSearch: fall back to DTSTART when RECURRENCE-ID
is absent (RFC 4791 §9.6.5 permits servers to omit it on the initial expanded
instance).
Sync _cleanup: add missing return after wipe-calendar branch so the cleanup
does not fall through to cal.delete() and delete the calendar anyway.
_fixCalendar: give VJOURNAL-only calendars a distinct cal_id ("-journals")
so they don't collide with VTODO-only calendars ("-tasks") under the
wipe-calendar regime where calendars persist across tests.
Unify wipe logic: the three manual wipe loops in _cleanup/_fixCalendar are
replaced with cal.delete(wipe=True), which now lives only in collection.py.
test_servers: register Baikal URL_ENV_VAR so the async-httpx CI job can
reach it; add get_available_servers() helper used by async integration tests.
prompt: (most of it on the form "github runs still fail — please check
why", though apparently I've asked it to delete calendar content
rather than deleting the full calendar)
Co-Authored-By: claude-sonnet-4-6 <[email protected]>
* Stalward and Xandikos supports search.recurrences.expanded.exception. * For NextCloud, during test runs, wipe calendar instead of deleting it * This commit also includes a bugfix in the compatibility test This was mostly AI-generated, a bit en-passant in a branch dedicated for improving the GitHub CI. Test code and compatibility_hints is considered eligible for AI modifications. Co-Authored-By: claude-sonnet-4-6 <[email protected]>
7400ca4 to
1510b4d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempts on catching local errors in github runs.
I leave all the github ci logic to Claude, it's not my thing. Based on the commit message, it seems to be running in the wrong direction on this one.
prompt: async tests towards baikal is currently broken locally - but the github workflow run passes successfully. Is it regressions in the niquests library, or are the baikal tests not run at github? Use
ghtool to get logs from the github runs. rather look into how we can get the async integration tests running at github - I've made a new branch for it. Apply and commit.