Skip to content

Conversation

@fbacall
Copy link
Contributor

@fbacall fbacall commented Dec 1, 2025

  • Adds new option for creating workflow versions in the UI (Previously you could only create versions from RO-Crates via the API)
  • Refactor/rename some workflow/version creation code to be very slightly less confusing
  • Ensure commits to SEEK-managed Git repos follow a clean history (Previously there could be junk commits in the history from versions that were not saved)

@fbacall fbacall requested a review from Copilot December 1, 2025 10:25
Copilot finished reviewing on behalf of fbacall December 1, 2025 10:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds UI functionality to create new workflow versions via RO-Crate upload, complementing the existing Git-based versioning system. The key change enables users to upload an RO-Crate ZIP file through a web form to create a new version of an existing workflow.

  • Adds a new create_version_from_ro_crate controller action and route for handling RO-Crate-based version creation through the UI
  • Refactors WorkflowCrateExtractor to support both new workflow creation and new version creation with the detect_workflow flag (renamed from update_existing)
  • Implements reset-to-last-commit functionality in Git operations to prevent orphaned commits when creating versions

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
config/routes.rb Adds route for create_version_from_ro_crate action
lib/seek/permissions/translator.rb Adds permission for the new create_version_from_ro_crate action
app/controllers/workflows_controller.rb Implements create_version_from_ro_crate action and renames methods for clarity (API vs UI handling)
app/controllers/concerns/legacy/workflow_support.rb Renames legacy_handle_ro_crate_post to legacy_handle_ro_crate_api_post for consistency
app/forms/workflow_crate_extractor.rb Refactors to support both new workflow and new version creation; renames update_existing to detect_workflow
app/views/workflows/new_git_version.html.erb Adds RO-Crate upload tab to the new version form
app/views/workflows/provide_metadata.html.erb Updates header to show "Version" for existing workflows and adds error display for versions
lib/git/operations.rb Adds reset_to_last_local_commit method to revert to saved commits before performing new operations
config/locales/en.yml Adds locale mapping for workflow_crate_extractor ActiveModel
test/unit/git/git_version_test.rb Adds test for commit reset behavior
test/integration/git_workflow_versioning_test.rb Adds integration tests for RO-Crate version creation including error handling
test/integration/workflow_versioning_test.rb Adds assertion for error display
test/unit/git/git_workflow_wizard_test.rb Updates commit hash from short to full format
test/integration/github_scraper_test.rb Updates commit hash from short to full format
test/factories/workflows.rb Updates commit hashes from short to full format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

test 'handles errors when creating version metadata' do
workflow = FactoryBot.create(:local_git_workflow)
person = workflow.contributor
original_version = workflow.latest_git_version
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

This assignment to original_version is useless, since its value is never read.

Suggested change
original_version = workflow.latest_git_version

Copilot uses AI. Check for mistakes.
person = workflow.contributor
original_version = workflow.latest_git_version

repo_count = Git::Repository.count
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

This assignment to repo_count is useless, since its value is never read.

Suggested change
repo_count = Git::Repository.count

Copilot uses AI. Check for mistakes.
original_version = workflow.latest_git_version

repo_count = Git::Repository.count
workflow_count = Workflow.count
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

This assignment to workflow_count is useless, since its value is never read.

Suggested change
workflow_count = Workflow.count

Copilot uses AI. Check for mistakes.

repo_count = Git::Repository.count
workflow_count = Workflow.count
version_count = Git::Version.count
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

This assignment to version_count is useless, since its value is never read.

Suggested change
version_count = Git::Version.count

Copilot uses AI. Check for mistakes.
repo_count = Git::Repository.count
workflow_count = Workflow.count
version_count = Git::Version.count
annotation_count = Git::Annotation.count
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

This assignment to annotation_count is useless, since its value is never read.

Suggested change
annotation_count = Git::Annotation.count

Copilot uses AI. Check for mistakes.
parent_commit = v1.commit
# Make a change to the repo, but don't save the change to the `commit` of the Git::Version
v1.add_file('text2.txt', StringIO.new('text2'))
orphaned_commit = v1.commit
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

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

This assignment to orphaned_commit is useless, since its value is never read.

Suggested change
orphaned_commit = v1.commit

Copilot uses AI. Check for mistakes.
@fbacall fbacall marked this pull request as ready for review December 4, 2025 11:17
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.

2 participants