Skip to content

feat: sync virtual user files to a project's Git repo - #9756

Draft
nishantmonu51 wants to merge 1 commit into
mainfrom
virtual_files_in_git
Draft

feat: sync virtual user files to a project's Git repo#9756
nishantmonu51 wants to merge 1 commit into
mainfrom
virtual_files_in_git

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

Virtual files (alerts, reports, personal dashboards) previously lived only in the admin database and never made it into a project's Git repo. This adds a sync path that promotes them into Git under user_files/<segment>/<kind>/<name>.yaml.

  • Virtual files now act as a staging buffer with a per-file sync_state (dirty/synced) and a base_data snapshot, so a sync can detect and report edits made directly in Git that it overwrote.
  • Adds GitWriter for committing user files to a project's repo, the SyncUserFilesToGit river job, and a periodic sweep that syncs projects whose configured interval has elapsed.
  • Adds the SyncProjectFilesToGit, GetProjectFileSyncStatus and UpdateProjectFileSyncSchedule APIs, and exposes synced on VirtualFile so runtimes drop their staged overlay copy and serve the Git copy instead.
  • Surfaces sync status, a manual sync action, and the auto-sync schedule on the project status page.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

https://claude.ai/code/session_0171HV6KomTrLmi2CbrQwsxV

Virtual files (alerts, reports, personal dashboards) previously lived only in
the admin database and never made it into a project's Git repo. This adds a
sync path that promotes them into Git under `user_files/`.

- Track per-file sync state (`dirty`/`synced`) plus a `base_data` snapshot so a
  sync can detect and report edits made directly in Git that it overwrote.
- Add `GitWriter` for committing user files to a project's repo, plus the
  `SyncUserFilesToGit` river job and a periodic sweep that syncs projects whose
  configured interval has elapsed.
- Add `SyncProjectFilesToGit`, `GetProjectFileSyncStatus` and
  `UpdateProjectFileSyncSchedule` APIs, and expose `synced` on `VirtualFile` so
  runtimes drop their staged overlay copy and serve the Git copy instead.
- Surface sync status, manual sync and the auto-sync schedule in the project
  status page.

Claude-Session: https://claude.ai/code/session_0171HV6KomTrLmi2CbrQwsxV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant