Skip to content

fix(sync): mirror upstream metadata edits on every sync - #12

Merged
BatLeDev merged 2 commits into
mainfrom
fix-sync-metadata
Oct 5, 2026
Merged

BatLeDev merged 2 commits into
mainfrom
fix-sync-metadata

Conversation

@BatLeDev

@BatLeDev BatLeDev commented Oct 5, 2026

Copy link
Copy Markdown
Member

Mirrored artefacts now pick up upstream metadata edits (title, description, group, category, deprecated) on every sync, and fields removed upstream are unset on the mirror.
Why: a catalog's title edited upstream never reached the prod mirror, even with Sync now. An upstream PATCH only bumps updatedAt, so the dataUpdatedAt fast path in syncNpmArtefact returned before touching metadata.

  • New syncMetadata runs on both the fast path and the download path.
  • File artefacts use the same dataUpdatedAt fast path as npm instead of comparing updatedAt, which re-downloaded the whole file on any upstream PATCH.
  • The fast path compares against the stored value (dataUpdatedAt || updatedAt), so upstream docs predating dataUpdatedAt are no longer re-downloaded on every sync.

Heads-up: metadata is now strictly upstream-owned: a field missing upstream is $unset locally. Mirrors can't edit these fields locally anyway (PATCH rejects them), so nothing local is lost.

An upstream PATCH (title, description, group, deprecated) only bumps
updatedAt, so the npm dataUpdatedAt fast path skipped it and mirrors kept
stale metadata forever. Metadata is now mirrored on every sync, and fields
removed upstream are unset. File artefacts use the same dataUpdatedAt fast
path instead of re-downloading on any upstream PATCH.
…lback

Upstream artefacts predating dataUpdatedAt are stored with updatedAt as
fallback; comparing against the raw field re-downloaded them on every sync.
@github-actions github-actions Bot added the fix label Oct 5, 2026
@BatLeDev
BatLeDev merged commit d0b5298 into main Oct 5, 2026
2 checks passed
@BatLeDev
BatLeDev deleted the fix-sync-metadata branch October 5, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant