Skip to content

feat: support v2 sync protocol#4634

Merged
doc-han merged 14 commits intomainfrom
sync-v2-protocol
Apr 21, 2026
Merged

feat: support v2 sync protocol#4634
doc-han merged 14 commits intomainfrom
sync-v2-protocol

Conversation

@doc-han
Copy link
Copy Markdown
Contributor

@doc-han doc-han commented Apr 17, 2026

Description

This PR makes sync v2 protocol an option for syncing projects with Github. By default sync will use the old config.json style but users can switch to the new openfn.yaml style if they prefer.

Currently defaults to v1 (legacy) but can be switched to v2 (new) style

Github Sync Setup Screen
Screenshot 2026-04-20 at 12 06 56 PM
Legacy New
Screenshot 2026-04-21 at 6 48 44 AM Screenshot 2026-04-21 at 6 47 58 AM

Closes #4523

Validation steps

  1. Try to sync a project with github. connect and select the repo you want to sync with
  2. Click on Advanced: Use new openfn.yaml format
  3. After connecting. sync the project.
  4. Check whether your openfn.yaml is in github with nicely generated content like the example below

Example openfn.yaml content

project:
  uuid: 43c34b65-50cf-4ec3-b480-32b3b17ac9c0
  endpoint: <your-instance-url>
  alias: 
  inserted_at: 2026-04-13T01:00:00Z
  updated_at: 2026-04-13T04:37:54Z
  id: sync
  name: sync
workspace:
  credentials: credentials.yaml
  dirs:
    projects: .projects
    workflows: workflows
  formats:
    openfn: yaml
    project: yaml
    workflow: yaml

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@github-project-automation github-project-automation Bot moved this to New Issues in Core Apr 17, 2026
@doc-han
Copy link
Copy Markdown
Contributor Author

doc-han commented Apr 17, 2026

Problems

  1. Why don't we allow users to generate a new github project from our platform when doing sync? (because if I need it on a new repo, I'll have to manually create that on github)
  2. When a repo has no content yet. We're unable to find the branches on it. i.e we can't find main on the repo

@doc-han
Copy link
Copy Markdown
Contributor Author

doc-han commented Apr 17, 2026

@josephjclark suggests we keep v1 as default and then allow users to switch to v2 style

Comment thread lib/lightning_web/live/project_live/github_sync_component.ex Outdated
Comment thread lib/lightning/version_control/project_repo_connection.ex Outdated
@josephjclark
Copy link
Copy Markdown
Collaborator

Sample v2 filesystem after sync has been established: https://github.com/doc-han/openfn-new

@doc-han doc-han force-pushed the sync-v2-protocol branch 2 times, most recently from 3a3bd93 to bee2f38 Compare April 20, 2026 11:44
@doc-han doc-han marked this pull request as ready for review April 20, 2026 12:10
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.67%. Comparing base (a665cfc) to head (8442117).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ing_web/live/project_live/github_sync_component.ex 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4634      +/-   ##
==========================================
+ Coverage   89.62%   89.67%   +0.05%     
==========================================
  Files         444      444              
  Lines       21609    21627      +18     
==========================================
+ Hits        19366    19395      +29     
+ Misses       2243     2232      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread lib/lightning/version_control/version_control.ex Outdated
Comment thread lib/lightning/version_control/project_repo_connection.ex Outdated
@doc-han doc-han requested a review from josephjclark April 21, 2026 06:56
Copy link
Copy Markdown
Collaborator

@midigofrank midigofrank left a comment

Choose a reason for hiding this comment

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

Nicely done @doc-han , left a few change requests. Also, is there a link we can add that describes what this new yaml format is all about? Maybe community post or just the docs

Comment thread lib/lightning/version_control/version_control.ex Outdated
Comment thread lib/lightning/version_control/project_repo_connection.ex Outdated
@github-project-automation github-project-automation Bot moved this from New Issues to In review in Core Apr 21, 2026
@github-actions
Copy link
Copy Markdown

Security Review

⚠️ The review completed but no findings comment was posted.

See the workflow run for the raw Claude output.

Copy link
Copy Markdown
Collaborator

@josephjclark josephjclark left a comment

Choose a reason for hiding this comment

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

Great @doc-han, I'm happy with this

I think we should run careful testing against staging. I've not done any kind of QA beyond watching you screen. It's not actually that complicated though so we should be alright

@josephjclark
Copy link
Copy Markdown
Collaborator

QA notes:

  • Setting up a GH sync works exactly the same as it is in production, with (almost no) change in the UI
  • After sync is set up, the settings will tell you you're using sync v1
  • And the sync works for push and pull
  • Now you can set up a GH sync but tick the box to use V2
  • In v2 sync, your github should contain:
    • an openfn.yaml file
    • a workflows folder with all job code beautifully expanded into files
    • a .projects folder with a yam file called something like main@openfn.org.yaml
    • No config.json, state.json or project.yaml file from v1
  • After sync is established, the sync should tell you it's using v2 style
  • Sync should work for push and pull

Copy link
Copy Markdown
Collaborator

@midigofrank midigofrank left a comment

Choose a reason for hiding this comment

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

Nicely done

@doc-han doc-han merged commit 7978d1f into main Apr 21, 2026
8 checks passed
@doc-han doc-han deleted the sync-v2-protocol branch April 21, 2026 12:44
@github-project-automation github-project-automation Bot moved this from In review to Done in Core Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Update GH sync to support v2 protocol

3 participants