gitlab_quality-test_tooling 3.19.0 → 3.19.1

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: de285d350eb535db983a229c6fbe2ea8565fd92ac757ba4371a7abf2e86a0e44
4
- data.tar.gz: bb1143033fdd4d8e0c71c4a0ca27574391138feed3b5198f934df1356684c866
3
+ metadata.gz: 5fb5356dd9a684e76ccf4de875f66d77ee818bef86d1cd9792eb8db9d688cfe9
4
+ data.tar.gz: 75e5afd55644a124fbf09f4fe0edd8f298fb2614f54dd0884a8a18002d2fe6d8
5
5
  SHA512:
6
- metadata.gz: 43d770b36e5b946f287a5f309f0e242033432c9b9a2f7618e396abc894067314d26a0b88416c41f880d1a16c5ffe7a595e306f074a057478fb139f2361e77e56
7
- data.tar.gz: 8f61352e3441e40c2b09d45621e91028f8d1f48623859ba34f5aabc7db449b03bc80f18ede9cbb558c47776d4a6b10c7fdb8e39e22b1dd0158477f2d85d97d8c
6
+ metadata.gz: 35ff364a8fbbd437bef5e94a6bedccf66b8288965fd6c136ce6c21baa3d9052ac44281e54dd3a11eb92dae156f6e9e123756fa526ddb24fd39c00450b1d7187e
7
+ data.tar.gz: 1de79819dcb8aadf7ef3994f54387008ff9d1e15ea4a0b0590caebe9cf2af99a2821dcc7008b7bff5b2df9da69d4103622624983ce7434272ec2e5663c1e6695
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (3.19.0)
4
+ gitlab_quality-test_tooling (3.19.1)
5
5
  activesupport (>= 7.0)
6
6
  amatch (~> 0.4.1)
7
7
  fog-google (~> 1.24, >= 1.24.1)
@@ -71,14 +71,35 @@ WITH
71
71
  GROUP BY test_file
72
72
  HAVING is_flaky
73
73
  ),
74
+ test_ownership AS (
75
+ -- Authoritative test-file ownership from test_metrics, which resolves
76
+ -- feature_category to group/stage/section from a current source. The
77
+ -- per-test coverage export's own CategoryOwners mapping is stale (it fetches
78
+ -- a dated stages.yml), so many rows arrive with a blank group; this is the
79
+ -- fallback. argMax pins the latest ownership per file over the risk window.
80
+ SELECT
81
+ file_path,
82
+ argMax(`group`, timestamp) AS owner_group,
83
+ argMax(stage, timestamp) AS owner_stage,
84
+ argMax(section, timestamp) AS owner_section
85
+ FROM test_metrics.test_results
86
+ WHERE timestamp >= now() - INTERVAL {risk_window}
87
+ AND `group` NOT IN ('', 'unknown')
88
+ GROUP BY file_path
89
+ ),
74
90
  per_test_status AS (
75
91
  SELECT
76
- tc.source_file,
77
- tc.`group`,
78
- tc.stage,
79
- tc.section,
80
- tc.total_lines,
81
- tc.covered_lines,
92
+ tc.source_file AS source_file,
93
+ -- Fall back to test_metrics ownership when the coverage row has no group
94
+ -- (stale CategoryOwners mapping). Resolve all three off the same condition
95
+ -- so the team stays internally consistent. Alias the passthrough columns to
96
+ -- bare names too: the analyzer otherwise keeps the `tc.` qualifier once the
97
+ -- ownership join is in play, and per_file references them unqualified.
98
+ if(tc.`group` != '', tc.`group`, own.owner_group) AS `group`,
99
+ if(tc.`group` != '', tc.stage, own.owner_stage) AS stage,
100
+ if(tc.`group` != '', tc.section, own.owner_section) AS section,
101
+ tc.total_lines AS total_lines,
102
+ tc.covered_lines AS covered_lines,
82
103
  -- Jest quarantine is a flat list (quarantined_vue3_specs.txt), loaded into
83
104
  -- jest_quarantined_tests_today by JestQuarantinedTestsTable before each run.
84
105
  (coalesce(qs.is_quarantined, FALSE)
@@ -87,6 +108,7 @@ WITH
87
108
  FROM code_coverage.test_coverage_per_file tc FINAL
88
109
  LEFT JOIN quarantine_status qs ON qs.test_file = tc.test_file
89
110
  LEFT JOIN flaky_status fs ON fs.test_file = tc.test_file
111
+ LEFT JOIN test_ownership own ON own.file_path = tc.test_file
90
112
  WHERE tc.timestamp >= now() - INTERVAL {coverage_window}
91
113
  ),
92
114
  per_file AS (
@@ -131,8 +131,8 @@ module GitlabQuality
131
131
  end
132
132
 
133
133
  # `tests_to_categories` comes from the test report JSON; without it, rows
134
- # carry blank categories. `CategoryOwners` fetches stages.yml over HTTP,
135
- # so only build it when there are reports to enrich.
134
+ # carry blank categories. The category-to-team map is a ClickHouse read,
135
+ # so only build both when there are reports to enrich.
136
136
  def resolve_categories
137
137
  return [{}, {}] unless test_reports
138
138
 
@@ -141,7 +141,19 @@ module GitlabQuality
141
141
  report_files = Dir.glob(patterns)
142
142
  return [{}, {}] if report_files.empty?
143
143
 
144
- [tests_to_categories_from(report_files), CategoryOwners.new.feature_categories_to_teams]
144
+ [tests_to_categories_from(report_files), feature_categories_to_teams]
145
+ end
146
+
147
+ # Category to group/stage/section, read from `code_coverage.category_owners`
148
+ # (populated by sync-category-owners). This is the source the full
149
+ # coverage export already uses, and it retains categories the live
150
+ # stages.yml fetch has since dropped (global_search and the Duo/AI groups),
151
+ # so more rows resolve to a real group instead of blank. `owner_records`
152
+ # gives string-keyed values; PerTestCoverageData reads symbol keys.
153
+ def feature_categories_to_teams
154
+ ClickHouse::CategoryOwnersTable.new(**clickhouse_credentials).owner_records.transform_values do |owner|
155
+ { group: owner["group"], stage: owner["stage"], section: owner["section"] }
156
+ end
145
157
  end
146
158
 
147
159
  def tests_to_categories_from(report_files)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "3.19.0"
5
+ VERSION = "3.19.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.19.0
4
+ version: 3.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-27 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control