Skip to content

test(talk): fetch rooms once before checking modifiedSince - #459

Merged
oleksandr-nc merged 1 commit into
mainfrom
fix/talk-modified-since-flake
Aug 11, 2026
Merged

test(talk): fetch rooms once before checking modifiedSince#459
oleksandr-nc merged 1 commit into
mainfrom
fix/talk-modified-since-flake

Conversation

@oleksandr-nc

@oleksandr-nc oleksandr-nc commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

test_get_conversations_modified_since fails intermittently across the matrix (seen on #458 and earlier on main), always as assert not [<Conversation name=Note to self>, <Conversation name=Let's get started!>].

Talk captures X-Nextcloud-Talk-Modified-Before (T) at the start of getRooms and only then dispatches BeforeRoomsFetchEvent (RoomController.php:240-243), whose listeners create the note-to-self, sample and changelog conversations the first time a user fetches rooms. Those rooms get a lastActivity newer than the T already reported, and the server filter is lastActivity >= modifiedSince. The test asks for T + 2, so it only passes while that creation finishes inside 2 seconds. Measured on an idle local server it already takes ~1.15 s.

Fetch the rooms once before the timed sequence so the lazy creation happens outside the checked window.

Reproduced end to end by making sample creation exceed the margin (Talk's samples_directory), then running the real test as a fresh admin user: current test fails, patched test passes, same server and conditions.

Summary by CodeRabbit

  • Bug Fixes
    • Improved conversation modification-date filtering tests by excluding pre-existing default rooms from results.
    • Synchronous and asynchronous conversation list behavior is now validated more reliably.

Talk captures the timestamp it returns in X-Nextcloud-Talk-Modified-Before at
the start of getRooms, and only then dispatches BeforeRoomsFetchEvent, whose
listeners create the "Note to self", sample and changelog conversations for a
user seeing Talk for the first time. Those rooms end up with a lastActivity
newer than the timestamp already reported, so the test's window of "nothing was
modified since T + 2 seconds" only held while that creation finished within two
seconds. On a loaded CI runner it does not, and the returned sample rooms fail
the assertion, which is what made the matrix jobs flaky.

Fetch the rooms once before the timed sequence, so the lazy creation happens
outside the window that is checked.

Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dba2e4a6-3202-4164-b775-29bd26f9235d

📥 Commits

Reviewing files that changed from the base of the PR and between f9141af and 377b8eb.

📒 Files selected for processing (1)
  • tests/actual_tests/talk_test.py

📝 Walkthrough

Walkthrough

The synchronous and asynchronous modified-since tests now fetch the conversation list before creating test conversations. This prevents existing Talk-created default rooms from affecting modification-window assertions.

Changes

Conversation test stability

Layer / File(s) Summary
Initialize conversation state
tests/actual_tests/talk_test.py
Both modified-since tests perform an initial conversation fetch before creating test conversations. The synchronous test also documents the default-room behavior.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the test change to fetch rooms before checking modifiedSince.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/talk-modified-since-flake

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@oleksandr-nc
oleksandr-nc merged commit 786d102 into main Aug 11, 2026
13 checks passed
@oleksandr-nc
oleksandr-nc deleted the fix/talk-modified-since-flake branch August 11, 2026 09:36
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