Skip to content
This repository was archived by the owner on Nov 29, 2026. It is now read-only.

feat: run DocSync's GitHub sync on Data Machine flows - #60

Closed
chubes4 wants to merge 2 commits into
mainfrom
feat/data-machine-sync
Closed

chubes4 wants to merge 2 commits into
mainfrom
feat/data-machine-sync

Conversation

@chubes4

@chubes4 chubes4 commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Closes #59. Needs Extra-Chill/data-machine#4087, the `github` fetch handler.

Changes

  • Task: a new system task, `docsync_apply_github_file` (`ApplyGitHubFileTask`), applies `github` fetch packets to one project.
    • Added and modified files go through `RepoSync::apply_file()`, the per-file logic split out of `process_file`. RepoSync now uses that method too.
    • Existing posts are matched by `_sync_source_file` and the project term, so post IDs and URLs stay the same.
    • Removed files go through `delete_by_source_file`.
    • Sync status, SHA and time meta are updated the same way RepoSync updates them.
    • It is deterministic, with no AI step.
  • Provisioning: `wp docsync project flows ensure [--project=] [--dry-run]` and the `docsync/ensure-sync-flows` ability.
    • They create one `DocSync` pipeline (fetch → system_task) and one daily flow for each top-level project.
    • Each flow's config comes from the project's term meta. `project_docs_path` `.` maps to the repo root.
    • Re-running updates the flows in place. Each flow id is stored in `project_dm_flow_id`.
  • Ownership: when Data Machine and the `github` handler are both present, DocSync's own cron sync is unscheduled and sync-now (CLI, ability, admin, webhook) runs the project's flow. Without them, the legacy cron path runs unchanged.
  • Admin JS: now calls the abilities run endpoint with the correct `{input}` envelope.

Why

The old sync depended on WP-cron, which isn't running on chubes.net. It also reported success with 0 changes when the docs path no longer existed: the Data Machine project has been frozen since 10-31. With this change Data Machine owns scheduling, retries and job history, and a missing `file_path` fails the fetch step visibly.

Verification

  • `tests/data-machine-sync-smoke.php`: added creates a post, modified updates the same ID, removed deletes it, repo/path derivation including `.`, and the cron handoff.
  • `php -l` and phpcs are clean.

Built with AI assistance (chubes-bot).

Data Machine with data-machine-github is now the only sync engine.
CronSync and GitHubClient are deleted, RepoSync keeps only per-file
apply/delete, the PAT/interval settings and the test-token, test-repo,
sync/doc and sync/batch routes are removed. A one-time upgrade moves the
PAT into Data Machine's GitHub auth and clears the old options and cron.
The content layer still loads without Data Machine; only sync needs it.
@chubes4

chubes4 commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Closing. DocSync is being retired instead of moving its sync layer onto Data Machine. Sync becomes a generic Data Machine flow (github fetch from Extra-Chill/data-machine#4087 → a Markdown-to-post upsert step), and the content and rendering layer moves into the chubes.net monorepo as a site plugin. This branch stays as reference for the apply logic (source-file identity, subpath → terms, removal handling).

@chubes4 chubes4 closed this Nov 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace DocSync's sync layer with Data Machine flows + MDI

1 participant