code_ownership 2.1.3-arm64-darwin → 2.2.0-arm64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47528d7463165d00762c6153562bd1ad905dc0b9b2f000955eca84b0ef72aca3
4
- data.tar.gz: '099559be1697e29df87b6d947f39e7998bd81cb9687d94f9bda8898dea6de8db'
3
+ metadata.gz: 6538bb70b0368b924c8b4dc53f7527cb07a1ab8e82071a94b858c851df193c2c
4
+ data.tar.gz: 2ab3748b627697004f60bccafe80e140f934eed5eb0fe5cf9e4bfa0b69b4b09e
5
5
  SHA512:
6
- metadata.gz: 05d0ae0a1d71863de645986b953cd950c4a94f51a0936e1465aedd7fc3db46e45092173ec117802b71445d7add4c55d2f8dfd3c52311770c395c33c6cbbb9918
7
- data.tar.gz: 760805f1fe30b51c957f0747288cdf343d8996a7235251d9fb18590e95864b4262456622bd317f590150513acedffb977900efd1cc3750a2f7628ebf582c9476
6
+ metadata.gz: d42d03fef183fc4c6715421083ec9c7ba1fc430969401baf32647844b52171117395ad6d9690a390f4f2b043f78d2c35082b8f6e94c118d0339ed41a55c9dcc2
7
+ data.tar.gz: 566fd29b5dbb3096392782fed3239e124d2bf7ace740f1fe679554b1dce4ae4c14e9cc3d319a28032d66b6d5236c32fbd22348b9ad1356052a065cf00f33d487
@@ -12,12 +12,12 @@ module CodeOwnership
12
12
 
13
13
  return FilePathTeamCache.get(file_path) if FilePathTeamCache.cached?(file_path)
14
14
 
15
- result = T.let(RustCodeOwners.for_file(file_path), T.nilable(T::Hash[Symbol, String]))
15
+ result = T.let(RustCodeOwners.for_file(file_path), T.nilable(FileOwnershipDetails))
16
16
 
17
- if result.nil? || result[:team_name].nil?
17
+ if result.nil?
18
18
  FilePathTeamCache.set(file_path, nil)
19
19
  else
20
- FilePathTeamCache.set(file_path, T.let(find_team!(T.must(result[:team_name]), allow_raise: allow_raise), T.nilable(CodeTeams::Team)))
20
+ FilePathTeamCache.set(file_path, T.let(find_team!(result[:team_name], allow_raise: allow_raise), T.nilable(CodeTeams::Team)))
21
21
  end
22
22
 
23
23
  FilePathTeamCache.get(file_path)
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module CodeOwnership
5
- VERSION = '2.1.3'
5
+ VERSION = '2.2.0'
6
6
  end
@@ -28,6 +28,11 @@ module CodeOwnership
28
28
 
29
29
  GlobsToOwningTeamMap = T.type_alias { T::Hash[String, CodeTeams::Team] }
30
30
 
31
+ # The `Team` struct that the Rust extension serializes out of `RustCodeOwners.for_file`.
32
+ FileOwnershipDetails = T.type_alias do
33
+ { team_name: String, team_config_yml: String, reasons: T::Array[String] }
34
+ end
35
+
31
36
  # Returns the version of the code_ownership gem and the codeowners-rs gem.
32
37
  sig { returns(T::Array[String]) }
33
38
  def self.version
@@ -154,7 +159,7 @@ module CodeOwnership
154
159
  # @see #for_file for a simpler ownership lookup that returns just the team
155
160
  # @see CLI#for_file for the command-line interface that uses this method
156
161
  #
157
- sig { params(file: String).returns(T.nilable(T::Hash[Symbol, String])) }
162
+ sig { params(file: String).returns(T.nilable(FileOwnershipDetails)) }
158
163
  def self.for_file_verbose(file)
159
164
  ::RustCodeOwners.for_file(file)
160
165
  end
@@ -312,10 +317,13 @@ module CodeOwnership
312
317
  # Namely, the set of files, packages, and directories which are tracked for ownership should not change.
313
318
  # The primary reason this is helpful is for clients of CodeOwnership who want to test their code, and each test context
314
319
  # has different ownership and tracked files.
320
+ # It also clears the team files that codeowners-rs caches for `for_file(..., from_codeowners: false)`,
321
+ # so call it after adding or editing team files in a long-lived process.
315
322
  sig { void }
316
323
  def self.bust_caches!
317
324
  Private::FilePathTeamCache.bust_cache!
318
325
  Private::FilePathFinder.instance_variable_set(:@pwd, nil)
319
326
  Private::FilePathFinder.instance_variable_set(:@pwd_prefix, nil)
327
+ ::RustCodeOwners.clear_team_cache
320
328
  end
321
329
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_ownership
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.2.0
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-10 00:00:00.000000000 Z
11
+ date: 2026-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_teams