kernelci / kernelci/dashboard

issue-detail: matrix of Tree x Nth checkout (cell links to checkout)

Open
#1,960 2 comments 1 reaction 0 assignees View on GitHub
unrefined
Dominant language
Python
Stars
9
Forks
31
Avg merge
3d 19h
Merged PRs (30d)
16

Description

This is just an idea, but I wonder how an issue with multiple trees like https://d.kernelci.org/issue/maestro:96417cd30041ab8f3153128d0120c6cd70782d99?iv=1

would look in a matrix built from something like

```py
# context: issue

from django.db.models import Exists, OuterRef, F, Window
from django.db.models.functions import Cast, RowNumber
from django.db.models import DateField

# 1. Get affected trees (same as before)
affected_trees = (
issue.incidents_set
.order_by("build__checkout__tree_name")
.values_list("build__checkout__tree_name", flat=True)
.distinct()
)

# 2. Query checkouts and calculate the sequential Nth checkout per day
grid_data = (
Checkouts.objects.filter(
start_time__gte=issue.first_seen,
start_time__lte=issue.last_seen,
tree_name__in=affected_trees
)
.annotate(
date=Cast("start_time", DateField()),
# Calculate Nth checkout per tree, per day
checkout_index=Window(
expression=RowNumber(),
partition_by=[F("tree_name"), Cast("start_time", DateField())],
order_by=F("start_time").asc()
)
)
.annotate(
has_incident=Exists(
Incidents.objects.filter(
issue=issue,
build__checkout=OuterRef("id")
)
)
)
# Convert to values so the Window function evaluates cleanly into a dict
.values("id", "tree_name", "date", "checkout_index", "has_incident")
.order_by("tree_name", "date", "checkout_index")
)

# ---

from collections import defaultdict

# Initialize a structure: table[tree_name][date_index_label] = has_incident
table_matrix = defaultdict(dict)

# We also keep track of all unique labels seen to use as your table headers
all_column_headers = set()

for entry in grid_data:
tree = entry["tree_name"]
date_str = entry["date"].strftime("%Y-%m-%d")
index = entry["checkout_index"]

# Create your custom key string
column_label = f"{date_str} - #{index}"

# Store it in the matrix
table_matrix[tree][column_label] = entry["has_incident"]
all_column_headers.add(column_label)

# Sort headers chronologically & sequentially for your frontend table columns
sorted_headers = sorted(list(all_column_headers))
```

To achieve something like

| Tree Name | 2026-06-24 - #1 | 2026-06-24 - #2 | 2026-06-25 - #1 |
| :--- | :---: | :---: | :---: |
| **Tree X** | ✅ Pass | ❌ Incident | ✅ Pass |
| **Tree Y** | ✅ Pass | *N/A* | ❌ Incident |

Contributor guide

Open the contributing guide

Research direction

Start at the issue-detail view and inspect how the Checkouts and Incidents data is currently exposed. Use the proposed tree/date/checkout-index matrix as the target, with each cell linking to its checkout and indicating an incident or N/A where appropriate; confirm the affected trees and date range from the issue data.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.