Skip to content

refactor: No longer set timeline event as state event#2358

Open
krille-chan wants to merge 1 commit into
mainfrom
krille/no-longer-set-timeline-event-as-state
Open

refactor: No longer set timeline event as state event#2358
krille-chan wants to merge 1 commit into
mainfrom
krille/no-longer-set-timeline-event-as-state

Conversation

@krille-chan

Copy link
Copy Markdown
Contributor

We did this in the past to store the lastEvent but we now have a dedicated slot in our Room JSON structure for the persistent storage.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d94e9dbd-ad98-4d68-896f-3123c39a03ea

📥 Commits

Reviewing files that changed from the base of the PR and between 8a9a2fa and d391e52.

📒 Files selected for processing (1)
  • lib/encryption/encryption.dart
💤 Files with no reviewable changes (1)
  • lib/encryption/encryption.dart

📝 Walkthrough

Walkthrough

The decryptRoomEvent method in the encryption module no longer calls event.room.setState(event) before persisting decrypted event updates. The conditional branch that performed this room state update has been removed, and the method now proceeds directly to database persistence operations.

Changes

Event Decryption

Layer / File(s) Summary
Remove room state update from event decryption
lib/encryption/encryption.dart
The conditional call to event.room.setState(event) executed when updateType != EventUpdateType.history was removed from decryptRoomEvent. Room state is no longer updated at this point during decrypted event handling.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing the conditional state update call in decryptRoomEvent, which aligns with no longer setting timeline events as state events.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale behind removing the state event update by noting a dedicated Room JSON structure now exists for persistent storage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch krille/no-longer-set-timeline-event-as-state

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

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.29%. Comparing base (c8f1062) to head (23b6de1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2358   +/-   ##
=======================================
  Coverage   59.29%   59.29%           
=======================================
  Files         161      161           
  Lines       20303    20301    -2     
=======================================
  Hits        12038    12038           
+ Misses       8265     8263    -2     
Files with missing lines Coverage Δ
lib/encryption/encryption.dart 84.57% <ø> (+0.95%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8f1062...23b6de1. Read the comment docs.

@krille-chan krille-chan force-pushed the krille/no-longer-set-timeline-event-as-state branch from d391e52 to a6c623c Compare June 26, 2026 08:38
@krille-chan krille-chan force-pushed the krille/no-longer-set-timeline-event-as-state branch from a6c623c to e2febd0 Compare June 26, 2026 08:44
We did this in the past to store the
lastEvent but we now have a dedicated
slot in our Room JSON structure for
the persistent storage.
@krille-chan krille-chan force-pushed the krille/no-longer-set-timeline-event-as-state branch from e2febd0 to 23b6de1 Compare July 8, 2026 07:02
@krille-chan krille-chan enabled auto-merge July 8, 2026 07:02
@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Single-path behavior change in decryption persistence; low risk unless something incorrectly depended on timeline events appearing in room.states.

Overview
After a room event is decrypted and persisted via storeEventUpdate, the SDK no longer calls event.room.setState(event) for non-history updates.

That path used to treat timeline events like room state (historically to support lastEvent); last event is now stored in the room JSON instead, so decrypted messages should only go through the database/timeline pipeline—not the in-memory state map.

Reviewed by Cursor Bugbot for commit 23b6de1. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

2 participants