Skip to content

Fixes #38494 - Add imported syncable content to import history #11415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qcjames53
Copy link
Contributor

@qcjames53 qcjames53 commented Jun 12, 2025

This PR is currently a draft since the unit tests aren't complete and it will likely have merge conflicts with another of my PRs.

What are the changes introduced in this pull request?

Considerations taken when implementing this change?

What are the testing steps for this pull request?

Summary by Sourcery

Refactor the content view publish plan to extract common import and sync operations into a new handle_content_import method and add import history recording for syncable imports

Bug Fixes:

  • Record syncable imports in the import history via CreateImportHistory action

Enhancements:

  • Extract content import and cloning logic into handle_content_import and simplify the plan method
  • Update RuboCop disable annotations to include Metrics/PerceivedComplexity

Tests:

  • Add placeholder tests for handle_content_import covering importing and syncable scenarios

Copy link

sourcery-ai bot commented Jun 12, 2025

Reviewer's Guide

This PR refactors the publish workflow by extracting and unifying content import and cloning logic into a new handle_content_import method, updates the plan method to delegate to it, and adds import history creation for syncable imports, accompanied by new test stubs.

Sequence Diagram for Content Publish Logic

sequenceDiagram
    participant P as Publish Action
    P->>P: plan(content_view, options)
    activate P
    P->>P: handle_content_import(version, ..., importing, syncable, ...)
    activate P
    alt if importing is true
        P->>P: plan_action(Import, ...)
        P->>P: plan_action(IndexContent, ...)
        P->>P: plan_action(MetadataGenerate, ...)
        P->>P: plan_action(CopyVersionUnitsToLibrary, ...)
    else if importing is false
        P->>P: plan_action(MultiCloneToVersion, ...)
        opt if syncable is true
            P->>P: plan_action(CreateImportHistory, ...)
        end
    end
    deactivate P
    deactivate P
Loading

File-Level Changes

Change Details Files
Refactor plan method to delegate import and cloning logic
  • Added Metrics/PerceivedComplexity to rubocop disable on plan
  • Replaced inline importing vs. clone branches with a single handle_content_import call
app/lib/actions/katello/content_view/publish.rb
Extract handle_content_import to unify workflows and support syncable history
  • Renamed handle_import and merged repository multi-clone logic
  • Implemented branching for importing vs. non-importing flows
  • Added CreateImportHistory action when syncable is true
app/lib/actions/katello/content_view/publish.rb
Add test placeholders for import handling scenarios
  • Introduced example specs for importing/non-importing and syncable/non-syncable combinations
  • Left TODOs for assertion implementation
test/actions/katello/content_view_test.rb

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant