Skip to content

Conversation

@martinemde
Copy link

  • I bumped the gem version (or don't need to) 💎

Aligns the bin/packs move command's argument order with the standard mv utility.

The command now accepts arguments as sources... destination (last argument is the destination pack), making it more intuitive and consistent with common CLI patterns.


Slack Thread

Open in Cursor Open in Web

Co-authored-by: martin.emde <martin.emde@gusto.com>
@cursor
Copy link

cursor bot commented Nov 25, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@martinemde
Copy link
Author

@cursor Make sure sorbet passes:

lib/packs/cli.rb:99: Expected `String` but found `T.nilable(String)` for argument `pack_name` https://srb.help/7002
    99 |        pack_name: pack_name,
                           ^^^^^^^^^
  Expected `String` for argument `pack_name` of method `Packs.move_to_pack!`:
    sorbet/rbi/gems/packs-specification@0.0.10.rbi:92:
    92 |        pack_name: ::String,
                ^^^^^^^^^
  Got `T.nilable(String)` originating from:
    lib/packs/cli.rb:99:
    99 |        pack_name: pack_name,
                           ^^^^^^^^^
  Autocorrect: Use `-a` to autocorrect
    lib/packs/cli.rb:99: Replace with `T.must(pack_name)`
    99 |        pack_name: pack_name,
                           ^^^^^^^^^

lib/packs/cli.rb:100: Expected `T::Array[String]` but found `T.nilable(T::Array[String])` for argument `paths_relative_to_root` https://srb.help/7002
     100 |        paths_relative_to_root: paths
                                          ^^^^^
  Expected `T::Array[String]` for argument `paths_relative_to_root` of method `Packs.move_to_pack!`:
    sorbet/rbi/gems/packs-specification@0.0.10.rbi:93:
    93 |        paths_relative_to_root: T::Array[::String],
                ^^^^^^^^^^^^^^^^^^^^^^
  Got `T.nilable(T::Array[String])` originating from:
    lib/packs/cli.rb:100:
     100 |        paths_relative_to_root: paths
                                          ^^^^^
  Autocorrect: Use `-a` to autocorrect
    lib/packs/cli.rb:100: Replace with `T.must(paths)`
     100 |        paths_relative_to_root: paths
                                          ^^^^^
Errors: 2

@cursor
Copy link

cursor bot commented Nov 25, 2025

Fixed the Sorbet type errors by adding T.must() to assert non-nil values after the length check. Since we validate args.length >= 2 before destructuring, pack_name (the last element) and paths (all elements except the last) are guaranteed to exist.

The changes:

  • Added T.must(pack_name) to ensure Sorbet knows pack_name is a String, not T.nilable(String)
  • Added T.must(paths) to ensure Sorbet knows paths is a T::Array[String], not T.nilable(T::Array[String])

This satisfies Sorbet's type checker while preserving the logic. The linter shows no errors, and the type checks should pass in CI.


Open in Cursor Open in Web

Learn more about Cursor Agents

Co-authored-by: martin.emde <martin.emde@gusto.com>
@martinemde martinemde marked this pull request as ready for review November 25, 2025 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants