Sync Source Follows Publication
A package can move from one repository to another. The registry then lists it from the new
repository straight away. But a partition that syncs the package through {package}/_GitSync keeps
naming the repository it was first wired to, and nothing used to move it. Only a person running a
Store/Provision could do it, because SystemInstall.WireSync rewrites repositoryUrl and
subdirectory when it reconciles an existing package.
What it cost
Crm moved from its own repository (since archived) into the plugins repository, and the registry
published it from there. On the company instance Crm/_GitSync still named the archived repository,
and three things followed:
- The partition counted as sync-owned (One Partition, One Bookkeeping), so the unattended update lane held every newer Crm with "the installer is NOT the owner of Crm's content".
- The sync never delivered a newer Crm either, because an archived repository publishes nothing again. Crm stayed at 4.2.
- TimeTracking 4.9 (
requires Crm@^4.3.0) could not load: "Load of TimeTracking/Desk NOT RUN on this replica — package 'TimeTracking' requires Crm@^4.3.0, but this mesh holds package 'Crm' at 4.2".
Every webhook the instance received also listed the archived repository under "matched NONE … Compared against: …".
The rule
The unattended update lane (PackageUpdateReconciler, policy Auto) checks a sync-owned package
before it holds it (SyncSourceFollowsPublication). It re-points {partition}/_GitSync from the old
repository R1 to the publication repository R2 only when all four of these hold:
- The registry serves the package with a hosted repository R2 (
PackageManifest.RepositoryUrl). - The partition's primary
_GitSyncimports content (it is not export-only) from a repository other than R2 at the package's folder. - The registry's listing names R1 for no package. If the registry also lists R1 — a fork it serves, or the publication's own repository at another folder — somebody chose that source on purpose, and it is never touched.
- R1 is shown to be the package's former publication. Either the install record says the
package was installed from R1, or GitHub reports R1 archived. A custom source with neither is
unrelated to the move, and it is left alone. The log line says that a
Store/Provisionmoves it.
A package on Notify or pinned is not re-pointed. An administrator who chose not to update
automatically is not moved behind their back.
Three more cases are never re-pointed unattended:
- A two-way source (
twoWay: true). It commits server-side edits back to its repository, and moving it would aim that write-back at the publication's repository. - A source whose url cannot be identified as
owner/repo. Its log line says so instead of claiming that the registry lists it. - A source seen by a bound pass. The plugin update watcher reads one watched repository's listing, not the registry's whole listing, so it cannot establish rule 3. Only the registry lane, which reads a registry's whole feed, re-points.
Every read the check makes (the config, and GitHub's archived flag) is bounded at 15 s. An unanswered read decides nothing.
The write
The write is the same one a provision makes. It runs as System on the typed GitHubSyncConfig and
sets repositoryUrl and subdirectory to the publication's values. Every other field is kept
(branch, direction, two-way, ignore rules), with one exception: lastSyncCommitSha and
lastAttemptedCommitSha name commits of R1 and mean nothing in R2, so they are cleared. The next
sealed import of R2 is therefore a first import. Pruning still requires provenance, so content the
repository never wrote, such as a CRM's own records, is never pruned.
The rule is decided again inside the write, against the config as it stands. If a person or a
provision moved the config in the meantime, their change wins. Once the config names R2, rule 2 no
longer holds, so a second pass writes nothing. The re-point is logged at Warning as
[SyncFollowsPublication] … RE-POINTED …, naming both repositories and the evidence. A source that is
left alone is logged at Information with the reason.
How it converges
- Update pass:
_GitSyncis re-pointed, and the record stays held for now. - The next sealed import of the new repository (the sealed publication reconciler on a seal of R2, or the boot reconcile) lands the new version.
- The next update pass finds that the sync delivered the candidate's hash
(
PartitionContentOwnership.SyncDelivered). The install record adopts the new version and its module lands.
Pinned by SyncSourceFollowsPublicationRuleTest (every arm of the rule) and
AMovedPackagesSyncSourceFollowsItsPublicationTest (real GitSync import plus real update lane: a
package moved off an archived repository is re-pointed and then updates from 4.2.0 to 4.3.0, and a
custom source is left exactly as it was).