Skip to content

ci: run async integration tests#669

Merged
tobixen merged 4 commits into
masterfrom
async-github-testruns
May 20, 2026
Merged

ci: run async integration tests#669
tobixen merged 4 commits into
masterfrom
async-github-testruns

Conversation

@tobixen
Copy link
Copy Markdown
Member

@tobixen tobixen commented Apr 24, 2026

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 gh tool 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.

@tobixen tobixen force-pushed the async-github-testruns branch 4 times, most recently from 9234d74 to d09ec45 Compare May 1, 2026 20:02
@tobixen tobixen force-pushed the async-github-testruns branch 2 times, most recently from ec47e75 to 7400ca4 Compare May 16, 2026 15:16
tobixen and others added 4 commits May 17, 2026 07:01
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]>
@tobixen tobixen marked this pull request as ready for review May 20, 2026 20:43
@tobixen tobixen force-pushed the async-github-testruns branch from 7400ca4 to 1510b4d Compare May 20, 2026 20:44
@tobixen tobixen merged commit 8c7ee49 into master May 20, 2026
11 checks passed
@tobixen tobixen deleted the async-github-testruns branch May 20, 2026 20:59
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