Skip to content

Commit dd76d94

Browse files
Fix contributor heatmap dropdown issue and restore original descriptions
- Add detailed logging to repo_dropdown and directory_dropdown to debug issue - Remove top-level docstrings from all three heatmap files - Restore original long-form PopoverBody descriptions for contributor/reviewer heatmaps - Restore original short-form description for contribution heatmap - Add back NOTE comment explaining query logic in repo_files_query.py
1 parent 3f05c9f commit dd76d94

File tree

4 files changed

+31
-37
lines changed

4 files changed

+31
-37
lines changed

8Knot/pages/codebase/visualizations/cntrb_file_heatmap.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""
2-
Contributor File Heatmap Visualization
3-
4-
Shows when contributors who touched files were last active in the repository.
5-
"""
6-
71
from dash import html, dcc, callback
82
import dash_bootstrap_components as dbc
93
import dash_mantine_components as dmc
@@ -34,12 +28,13 @@
3428
dbc.PopoverHeader("Graph Info:"),
3529
dbc.PopoverBody(
3630
"""
37-
This visualization analyzes when contributors to each file/directory
38-
were last active in the repository. A contributor is someone who has
39-
opened at least one pull request touching a file. The heatmap shows
40-
the count of contributors whose last activity falls in each month.
41-
This helps identify files where past contributors may no longer be
42-
actively maintaining the code.
31+
This visualization analyzes the activity of the contributors to sub-sections (files or folders)
32+
of a repository. Specifically, this heatmap identifies the last time a sub-section's contributors
33+
(those people who have opened at least one pull request to a sub-section) last contributed to the
34+
repository. See the definition of "contribution" on the Info page for more information. This could be
35+
interpreted as monitoring technical knowledge retention of codebase components: if a sub-section's
36+
past contributors are no longer active in the repository, maintainership of that sub-section could
37+
be insufficient and require attention.
4338
"""
4439
),
4540
],
@@ -140,8 +135,10 @@ def toggle_popover(n, is_open):
140135
)
141136
def repo_dropdown(repo_ids):
142137
"""Populate repository dropdown."""
143-
logging.debug(f"{VIZ_ID} - repo_dropdown called with {len(repo_ids) if repo_ids else 0} repos")
144-
return hu.build_repo_dropdown_data(repo_ids, rfq)
138+
logging.warning(f"{VIZ_ID} - repo_dropdown called with repo_ids={repo_ids}")
139+
result = hu.build_repo_dropdown_data(repo_ids, rfq)
140+
logging.warning(f"{VIZ_ID} - repo_dropdown returning: {result}")
141+
return result
145142

146143

147144
@callback(
@@ -154,8 +151,9 @@ def repo_dropdown(repo_ids):
154151
)
155152
def directory_dropdown(repo_id):
156153
"""Populate directory dropdown based on selected repository."""
157-
logging.debug(f"{VIZ_ID} - Loading directories for repo_id={repo_id}")
154+
logging.warning(f"{VIZ_ID} - directory_dropdown called with repo_id={repo_id}")
158155
if repo_id is None:
156+
logging.warning(f"{VIZ_ID} - directory_dropdown repo_id is None, returning TOP_LEVEL_DIRECTORY")
159157
return [hu.TOP_LEVEL_DIRECTORY], hu.TOP_LEVEL_DIRECTORY
160158

161159
# Wait for cache with timeout
@@ -174,7 +172,9 @@ def directory_dropdown(repo_id):
174172
df = hu.prepare_file_df(df)
175173
directories = hu.get_directories(df)
176174

177-
logging.debug(f"{VIZ_ID} - Found {len(directories)} directories")
175+
logging.warning(
176+
f"{VIZ_ID} - directory_dropdown returning {len(directories)} directories, default={hu.TOP_LEVEL_DIRECTORY}"
177+
)
178178
return directories, hu.TOP_LEVEL_DIRECTORY
179179

180180

8Knot/pages/codebase/visualizations/contribution_file_heatmap.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""
2-
Contribution File Heatmap Visualization
3-
4-
Shows PR activity (opened/merged) per file/directory over time.
5-
"""
6-
71
from dash import html, dcc, callback
82
import dash_bootstrap_components as dbc
93
import dash_mantine_components as dmc
@@ -32,9 +26,8 @@
3226
dbc.PopoverHeader("Graph Info:"),
3327
dbc.PopoverBody(
3428
"""
35-
This visualization analyzes the activity of pull requests to sub-sections
36-
(files or folders) of a repository over time. The heatmap shows the number
37-
of PRs opened or merged for each file/directory by month.
29+
This visualization analyzes the activity of the open or merged pull requests to sub-sections
30+
(files or folders) of a repository.
3831
"""
3932
),
4033
],

8Knot/pages/codebase/visualizations/reviewer_file_heatmap.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
"""
2-
Reviewer File Heatmap Visualization
3-
4-
Shows when reviewers of file PRs were last active in the repository.
5-
"""
6-
71
from dash import html, dcc, callback
82
import dash_bootstrap_components as dbc
93
import dash_mantine_components as dmc
@@ -34,12 +28,13 @@
3428
dbc.PopoverHeader("Graph Info:"),
3529
dbc.PopoverBody(
3630
"""
37-
This visualization analyzes when reviewers of each file/directory
38-
were last active in the repository. A reviewer is someone who has
39-
reviewed at least one pull request touching a file. The heatmap shows
40-
the count of reviewers whose last activity falls in each month.
41-
This helps identify files where past reviewers may no longer be
42-
actively maintaining the code.
31+
This visualization analyzes the activity of the reviewers to sub-sections (files or folders)
32+
of a repository. Specifically, this heatmap identifies the last time a sub-section's reviewer
33+
(those people who have reviewed at least one pull request to a sub-section) last contributed to the
34+
repository. See the definition of "contribution" on the Info page for more information. This could be
35+
interpreted as monitoring technical knowledge retention of codebase components: if a sub-section's
36+
past reviewers are no longer active in the repository, maintainership of that sub-section could
37+
be insufficient and require attention.
4338
"""
4439
),
4540
],

8Knot/queries/repo_files_query.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ def repo_files_query(self, repos):
3434
if len(repos) == 0:
3535
return None
3636

37+
# NOTE: in below query, for each repo_id we're interested in,
38+
# we pre-compute the most recent augur analysis date. This allows
39+
# us to quickly get the names of the files in the repo that
40+
# exist most-currently, dropping files that have been added and
41+
# then deleted in the past.
42+
3743
# Use pre-computed materialized view for faster performance
3844
query_string = """
3945
SELECT

0 commit comments

Comments
 (0)