Skip to content

fix: prevent stale settings sync overwrites#342

Merged
Just-Insane merged 7 commits into
integrationfrom
codex/bug-issue-334-settings-sync-freshness
Jun 23, 2026
Merged

fix: prevent stale settings sync overwrites#342
Just-Insane merged 7 commits into
integrationfrom
codex/bug-issue-334-settings-sync-freshness

Conversation

@Just-Insane

Copy link
Copy Markdown
Collaborator

Description

Add an updatedAt freshness marker to settings-sync payloads and use it to avoid uploading stale offline settings over newer account data. The hook now pulls newer remote settings before uploading, ignores older remote echoes, and keeps explicit clear markers intact for later syncs.

Fixes #334

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

AI disclosure:

  • Partially AI assisted (clarify which code was AI assisted and briefly explain what it does).
  • Fully AI generated (explain what all the generated code does in moderate detail).
    This patch adds a persisted local freshness timestamp for settings sync and includes an updatedAt field in the Matrix account-data payload. The sync hook now compares local and remote freshness before uploading, applies newer remote settings instead of overwriting them, ignores stale remote updates that arrive after newer local changes, and keeps explicit remote-clear markers round-trippable. The accompanying tests cover the new timestamped upload payload, stale-overwrite prevention, stale remote event rejection, and the test-mock reset needed to keep the suite isolated.

@Just-Insane Just-Insane enabled auto-merge (squash) June 23, 2026 17:19
@Just-Insane Just-Insane added the bug Something isn't working label Jun 23, 2026
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown

Sentry Preview Error Triage

No Sentry errors found for this PR's preview deployment as of Tue, 23 Jun 2026 20:07:52 GMT.

This comment updates automatically after each push.

@github-code-quality

github-code-quality Bot commented Jun 23, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: JavaScript

JavaScript / code-coverage/vitest

The overall coverage in the branch remains at 27%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 96eea25 e16335d +/-
src/app/hooks/u...SettingsSync.ts 98% 96% -2%
src/app/pages/c...SettingsTab.tsx 0% 0% 0%
src/app/pages/c...ickTools.css.ts 0% 0% 0%
src/app/pages/c...rQuickTools.tsx 0% 0% 0%
src/app/utils/settingsSync.ts 100% 100% 0%

Updated June 23, 2026 20:11 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

Comment thread src/app/hooks/useSettingsSync.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88ec7c6a24

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.test.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2cc1cda4a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ffe95bf45

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/hooks/useSettingsSync.ts
Comment thread src/app/hooks/useSettingsSync.ts Outdated
Comment thread src/app/hooks/useSettingsSync.ts
Comment thread src/app/hooks/useSettingsSync.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6372b415e5

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/hooks/useSettingsSync.ts Outdated
@github-actions

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

Status Preview URL Commit Alias Updated (UTC)
✅ Deployment successful! https://pr-342-charm.justin-tech.workers.dev bbf6d89 pr-342 Tue, 23 Jun 2026 20:10:52 GMT

@Just-Insane Just-Insane merged commit e629234 into integration Jun 23, 2026
18 checks passed
@Just-Insane Just-Insane deleted the codex/bug-issue-334-settings-sync-freshness branch June 23, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings Sync Stale Overwrites

1 participant