Summary
When RepoSync::sync() finds the remote SHA unchanged (old_sha === $new_sha), it returns early before calling update_sync_status(). Because the method sets the status to 'syncing' at the top of every run (line 42), a project whose docs are already up to date gets permanently left in the 'syncing' state in term meta, even though the sync completed successfully with zero errors.
Impact
- Cosmetic but misleading: the admin Projects column and
RepositoryFields/ProjectColumns display "syncing" indefinitely for healthy, up-to-date projects.
- Anything reading
project_sync_status to gate behavior (health checks, dashboards) sees a false in-progress state.
- Observed on chubes.net after repointing several projects to renamed GitHub repos: every
wp docsync docs sync <id> returned Success / 0 errors, but 5 of 6 terms stayed at project_sync_status = syncing.
Root cause
inc/Sync/RepoSync.php, sync():
$this->update_sync_status( $term_id, 'syncing' ); // line 42
...
if ( $old_sha === $new_sha ) {
$result['success'] = true;
$result['error'] = 'No changes detected';
return $result; // line 94 — returns WITHOUT setting 'success'
}
The success path at the bottom (line 115) is only reached when there are actual changes to apply. The no-changes short-circuit skips it.
Fix
Set the status to 'success' on the no-changes early return before returning:
if ( $old_sha === $new_sha ) {
$result['success'] = true;
$result['error'] = 'No changes detected';
$this->update_sync_status( $term_id, 'success' );
return $result;
}
This also clears any stale project_sync_error via the existing update_sync_status() success branch.
Repro
- Sync a project once so
project_last_sync_sha is stored.
- Sync it again with no upstream commits (
wp docsync docs sync <term_id>).
- Observe
wp term meta get <term_id> project_sync_status → syncing (expected: success).
Summary
When
RepoSync::sync()finds the remote SHA unchanged (old_sha === $new_sha), it returns early before callingupdate_sync_status(). Because the method sets the status to'syncing'at the top of every run (line 42), a project whose docs are already up to date gets permanently left in the'syncing'state in term meta, even though the sync completed successfully with zero errors.Impact
RepositoryFields/ProjectColumnsdisplay "syncing" indefinitely for healthy, up-to-date projects.project_sync_statusto gate behavior (health checks, dashboards) sees a false in-progress state.wp docsync docs sync <id>returnedSuccess/ 0 errors, but 5 of 6 terms stayed atproject_sync_status = syncing.Root cause
inc/Sync/RepoSync.php,sync():The success path at the bottom (line 115) is only reached when there are actual changes to apply. The no-changes short-circuit skips it.
Fix
Set the status to
'success'on the no-changes early return before returning:This also clears any stale
project_sync_errorvia the existingupdate_sync_status()success branch.Repro
project_last_sync_shais stored.wp docsync docs sync <term_id>).wp term meta get <term_id> project_sync_status→syncing(expected:success).