Skip to content

Switch to packs#10

Merged
alexevanczuk merged 4 commits intorubyatscale:mainfrom
iMacTia:mg/switch-to-packs
Feb 24, 2023
Merged

Switch to packs#10
alexevanczuk merged 4 commits intorubyatscale:mainfrom
iMacTia:mg/switch-to-packs

Conversation

@iMacTia
Copy link
Copy Markdown
Contributor

@iMacTia iMacTia commented Feb 22, 2023

WHY

We recently updated parse_packwerk, code_ownership and other gems in the rubyatscale ecosystem.
They all moved to make packs a more central part of it, but this gem has not been updated yet, which causes issues like the following:

VisualizePackwerk.team_graph!(teams)

# TypeError: Parameter 'package': Expected type Packs::Pack, got type ParsePackwerk::Package with value <ParsePackwerk::Package con...on" public_path="app/public/">
# Caller: ~/.rvm/gems/ruby-3.1.3/gems/visualize_packwerk-0.0.6/lib/visualize_packwerk/package_graph.rb:29
# Definition: ~/.rvm/gems/ruby-3.1.3/gems/code_ownership-1.29.3/lib/code_ownership.rb:162

WHAT

  • Update the gem to be compatible with the latest version of the ecosystem's gems, including code_ownership.
  • As a result of switching to packs, we now need to ignore the root package, but that was already in the plans based on comments I found in the code.
  • Update the README to reflect the changes.
  • Chore: Remove Gemfile.lock from VCS. Update code_ownership version in Gemfile.lock

Testing

Since this repo has no tests, I manually tested the following steps:

  • VisualizePackwerk.package_graph! as demonstrated in the README
  • VisualizePackwerk.team_graph! as demonstrated in the README
  • The modularity-graph as explained in the d3_graph_generator/README.md

NOTE:
They were all successfully working against our codebase.
However, it's worth noting that we use an older version of parse_packwerk (0.14.0) since we're still using Packwerk 2.
It would be great to have someone else testing these changes against a Packwerk 3 codebase using the latest parse_packwerk.

Copy link
Copy Markdown
Contributor

@alexevanczuk alexevanczuk left a comment

Choose a reason for hiding this comment

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

Thanks for this awesome contribution! Everything looks great – I'm just not sure about no longer checking in Gemfile.lock. Had some questions about that. If you wanted to continue to chat through it, I'd recommend we pull that change into a separate PR – that way this could be unblocked and we can go ahead and merge it!

Lastly, want to bump the minor version in the gemspec? That way CD will automatically publish a new release once this merges on main and CI passes.

Comment thread .gitignore Outdated
/pkg/
/spec/reports/
/tmp/
Gemfile.lock
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Chore: Remove Gemfile.lock from VCS. Although the Bundler team now recommends on having it, that only makes sense with additional tooling in place (e.g. Dependabot). Without them, this is only making it harder to test against your dependencies and validate your gemspec properly.

Could you explain more context here? I think this is still useful to have in VCS to ensure all contributors are using the same set of dependencies, especially as it's recommended by bundler. In what ways are you finding it's harder to test against your dependencies and validate your gem spec?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Following your suggestion, I'll push the Gemfile.lock back into VCS and open a separate issue about this 👍

Comment thread README.md

# Building a team graph for specific teams
```
```ruby
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice changes!

spec.add_dependency 'rake'
spec.add_dependency 'ruby-graphviz'

spec.add_development_dependency 'bundler', '~> 2.2.16'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we'd still want this if we choose to continue to commit the Gemfile.lock.

@alexevanczuk
Copy link
Copy Markdown
Contributor

Also looks like type check is failing! Let me know if I can help with that 😄

@iMacTia
Copy link
Copy Markdown
Contributor Author

iMacTia commented Feb 24, 2023

Of course, I forgot to re-run sorbet after my latest changes 🤦.
I'll get those fixed, and push the Gemfile.lock, thank you @alexevanczuk

ParsePackwerk is still needed to parse packages dependencies and violations.
However, CodeOwnership will now expect us to pass it Packs::Pack objects.

A direct effect of this transition is that we now need to remove the root package from processing, since Packs does not consider that.
@iMacTia
Copy link
Copy Markdown
Contributor Author

iMacTia commented Feb 24, 2023

@alexevanczuk Gemfile.lock is back and sorbet looks happy when I run it locally.
Also, bumped the version in the gemspec to 0.1.0 🙌

Copy link
Copy Markdown
Contributor

@alexevanczuk alexevanczuk left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@alexevanczuk alexevanczuk merged commit e5aeb99 into rubyatscale:main Feb 24, 2023
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