Skip to content

fix(chat-store): preserve shared history deletion and identities - #247

Merged
jlucaso1 merged 1 commit into
mainfrom
fix/245-history-deletion-and-identities
Oct 23, 2026
Merged

jlucaso1 merged 1 commit into
mainfrom
fix/245-history-deletion-and-identities

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #246 / #245. Synthetic fixtures independently reproduce all three review findings on merged base 5ee0050c279987abf16c6418d9ff9c1251ce975a.

Clear/delete-chat now retires covered pending history envelopes in the same transaction, retaining deduplication keys. Late download completions and redeliveries cannot restore deleted history after restart; other chats and attachments outside the action's timestamp/key range remain eligible.

Missing-target shared edits/revokes now create read-backfill placeholders without unread attention, while existing live targets retain their original eligibility. Aggregated reaction keys are translated from the sharing account's perspective so later live replacement/removal addresses the same author.

Protocol evidence and exact preserved bundle hashes/module offsets are in docs/shared-group-history.md, using whatspec 46f630441389e703e04ff3fc012192cf80fdd4ba (schema 4.4.0, Web 2.3000.1047483476). This is synthetic validation, not an authenticated reproduction or a new server-contract claim. No real sessions or message data were used.

Validation:

  • Identical final fixture SHA-256 c8acac7866197ec32a669292e6ef07c06f3ddde57b6452bbf4b6f025c2971aa6: six regression checks fail on the unchanged merged base; all seven pass after correction.
  • Coverage includes held completion after clear/delete and restart, duplicate delivery, chat/range isolation, edit/revoke unread recount, reaction replacement/removal, and existing live eligibility.
  • cargo fmt --all -- --check
  • cargo clippy -p oxidezap-chat-store --all-targets --all-features -j 2 -- -D warnings
  • Chat-store Nextest: 397 passed, 1 skipped, two build jobs/test threads.
  • Chat-store doctests: successful, 3 ignored examples.

Hosted CI completed successfully: CI (2,070 native tests passed, 13 skipped; one existing daemon launcher test reported leaky), all four release artifacts plus archive verification, and Pages. The initial Pages run was cancelled when superseded by the run triggered after the PR was externally marked ready for review. This PR was created as a draft; this task did not mark it ready, merge it, invoke deployment, post review replies, or resolve threads.


Summary by cubic

Fixes three review gaps in shared group history handling so deleted chats can't be restored and shared amendments keep correct read and author identities.

  • Clear/delete-chat retires covered pending attachment envelopes in the same transaction, retaining dedup keys so post-restart completions or redeliveries can't revive them.
  • Shared edits/revokes for missing targets insert read-backfill placeholders with no unread delta; existing live targets keep their original eligibility.
  • Aggregated reaction keys are translated to the sharing account's perspective, so the sharer's later live replacement/removal addresses the same author.

Written for commit 75f5bc6. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • Bug Fixes
    • Clearing or deleting a chat now retires matching pending shared-history attachments while preserving duplicate detection.
    • Shared-history edits and revocations no longer incorrectly increase unread counts when creating placeholders.
    • Restored shared-history reactions now use the correct sender perspective, and invalid reaction keys are discarded.
    • Shared history is processed only when its pending attachment matches the expected message details.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 92b75d32-dd77-4be5-9c3a-0aa3c9785e46
📥 Commits

Reviewing files that changed from the base of the PR and between 5ee0050 and 75f5bc6.

📒 Files selected for processing: 9
  • crates/chat-store/src/store/chat_rows.rs
  • crates/chat-store/src/store/edit.rs
  • crates/chat-store/src/store/history_sync.rs
  • crates/chat-store/src/store/inbound.rs
  • crates/chat-store/src/store/revoke.rs
  • crates/chat-store/src/store/shared_history.rs
  • crates/chat-store/src/store/writer.rs
  • crates/chat-store/tests/shared_history.rs
  • docs/shared-group-history.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The changes retire matching pending shared-history attachments during chat clear or deletion, update shared edit and revoke placeholder handling, and normalize reaction keys during history import. Regression tests cover deletion boundaries, unread counts, reaction attribution, and subsequent live reaction updates.

Changes: Shared history handling

Layer / File(s) Summary
Retire pending attachments during deletion
crates/chat-store/src/store/shared_history.rs, crates/chat-store/src/store/chat_rows.rs, crates/chat-store/tests/shared_history.rs, docs/shared-group-history.md
Deletion retires matching pending attachments before message rows are deleted. Tests cover clear and delete operations, restart, redelivery, and ranged boundaries.
Preserve shared edit and revoke state
crates/chat-store/src/store/edit.rs, crates/chat-store/src/store/revoke.rs, crates/chat-store/src/store/history_sync.rs, crates/chat-store/src/store/inbound.rs, crates/chat-store/src/store/writer.rs, crates/chat-store/tests/shared_history.rs
Shared-history status reaches edit and revoke handlers. Newly inserted placeholders retain the read-backfill marker and do not increase unread count. Existing live targets retain their unread eligibility.
Normalize imported reaction keys
crates/chat-store/src/store/shared_history.rs, crates/chat-store/tests/shared_history.rs
Imported reaction keys are validated and normalized to the sharing account’s perspective. Tests cover attribution and later live reaction replacement or removal.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Possibly related issues

  • oxidezap/client#245: The changes address shared edit and revoke placeholders for missing targets, but do not address the issue’s bundle classification, pending bundle storage, or history materialization.
Merge Risk: ⚪ Minimal · up to 75f5b

The shared-history corrections appear mergeable after normal checks; no outstanding issue was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 8 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 "fix(chat-store): preserve shared history deletion and identities" names the affected crate and the main change area. The changeset retires pending shared-history attachments on clear/delete…
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.
Full details: Title check

Explanation

The title "fix(chat-store): preserve shared history deletion and identities" names the affected crate and the main change area. The changeset retires pending shared-history attachments on clear/delete-chat, keeps dedup keys, handles shared edit/revoke unread eligibility, and normalizes aggregated reaction keys. The title covers the deletion-retention fix and the identity (reaction key) normalization. It does not name the unread-count fix for shared edits and revokes. That is a real part of the change, so the title is related but not exhaustive. This meets the pass criteria because the title is related to the main change and is not vague.

Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 8 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@jlucaso1
jlucaso1 marked this pull request as ready for review October 23, 2026 01:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T01:24:43.961775Z 75f5bc6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jlucaso1
jlucaso1 merged commit b27bdf5 into main Oct 23, 2026
18 of 19 checks passed
@jlucaso1
jlucaso1 deleted the fix/245-history-deletion-and-identities branch October 23, 2026 02:47
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