Skip to content

Comments

Bug 1908824 - bookmark sync should not always consider bookmarks as m…#7230

Open
mhammond wants to merge 1 commit intomozilla:mainfrom
mhammond:push-kmszwlxnuynx
Open

Bug 1908824 - bookmark sync should not always consider bookmarks as m…#7230
mhammond wants to merge 1 commit intomozilla:mainfrom
mhammond:push-kmszwlxnuynx

Conversation

@mhammond
Copy link
Member

…odified "now" after being reconciled.

When applying remote bookmarks to the local database, lastModified was set to MAX(v.dateAdded, {now}) which in practice is always "now". This caused all reconciled items appear "recently modified locally". This in turn caused a sync after a reset to often re-upload all bookmarks as the local bookmark "won" due to its recent lastModified, even though it had never actually changed.

But a lastModified timestamp is not in the sync payload - it's purely a local concept. So while it's not perfect, we use the server's modified timestamp - that's likely to be close to when the record was most recently modified somewhere.

The applyNewLocalStructure trigger was also problematic as this updated the timestamp to now(), and this trigger executed for new incoming items. This meant that the timestamp of an item might move backwards - it would end up as now() as it was created, but move backwards to the server timestamp if reapplied. There's no good reason for this trigger to change the timestamp - if the item moved parents remotely then it will have a new server timestamp.

A desktop patch landing under the same bug number fixes the same problem there.

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@mhammond mhammond requested a review from skhamis February 20, 2026 03:40
…odified "now" after being reconciled.

When applying remote bookmarks to the local database, lastModified was
set to `MAX(v.dateAdded, {now})` which in practice is always "now".
This caused all reconciled items appear "recently modified locally".
This in turn caused a sync after a reset to often re-upload all bookmarks as the
local bookmark "won" due to its recent lastModified, even though it
had never actually changed.

But a lastModified timestamp is not in the sync payload - it's purely a
local concept. So while it's not perfect, we use the server's modified
timestamp - that's likely to be close to when the record was most
recently modified somewhere.

The applyNewLocalStructure trigger was also problematic as this updated the
timestamp to `now()`, and this trigger executed for new incoming items. This
meant that the timestamp of an item might move backwards - it would end up
as `now()` as it was created, but move backwards to the server timestamp if
reapplied. There's no good reason for this trigger to change the
timestamp - if the item moved parents remotely then it will have a new server
timestamp.

A desktop patch landing under bug 2018096 fixes the same problem there.
@mhammond mhammond changed the title Bug 2018096 - bookmark sync should not always consider bookmarks as m… Bug 1908824 - bookmark sync should not always consider bookmarks as m… Feb 20, 2026
Copy link
Contributor

@skhamis skhamis left a comment

Choose a reason for hiding this comment

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

Nice! This is quite elegant, also no migrations needed as both tables are `TEMP.  LGTM!

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