Skip to content

feat: labs listing - #1985

Open
felipebergamin wants to merge 5 commits into
kernelci:mainfrom
profusion:feat/1966/labs-listing-page
Open

feat: labs listing#1985
felipebergamin wants to merge 5 commits into
kernelci:mainfrom
profusion:feat/1966/labs-listing-page

Conversation

@felipebergamin

@felipebergamin felipebergamin commented Jul 10, 2026

Copy link
Copy Markdown
Member

Blocked by #1968

Visual reference

Screen.Recording.2026-07-20.at.09.55.25.mov
Screenshot 2026-07-20 at 09 52 21 Screenshot 2026-07-20 at 09 45 02

@felipebergamin
felipebergamin force-pushed the feat/1966/labs-listing-page branch from 48b98a2 to 017dd23 Compare July 10, 2026 17:02
Comment thread backend/kernelCI_app/queries/labs.py Outdated
}

query = """
WITH build_counts AS (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might be able to simplify those queries with something on the lines of

SELECT 
    COALESCE(labs.name, tests.misc->>'runtime') AS lab,
    CASE
        WHEN status IN ('PASS', 'FAIL') THEN status
        ELSE 'INCONCLUSIVE'
    END AS test_status,
    count(*) as test_count
FROM tests
left join labs on labs.id = tests.lab_id
WHERE COALESCE(labs.name, tests.misc->>'runtime') IS NOT null
GROUP BY 
    lab,
    test_status;

Comment thread dashboard/src/pages/Labs/LabsTable.tsx Outdated
import type { LabsListingRoutesMap } from '@/utils/constants/labsListing';

const statusCell = (
summary: LabListingItem['build_status_summary'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type shouldnt be a ShortStatusCount here?

from kernelCI_app.queries.labs import get_lab_listing_data


class TestGetLabListingData:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont know if this test aggregates much. Might be better to add Integration tests for database query tests.

end_date=ANY,
)
self.assertEqual(response.data["labs"][0]["lab_name"], "lab-collabora")
self.assertEqual(response.data["labs"][0]["build_status_summary"]["PASS"], 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth it checking asserting response here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*the full response

)


class LabListingQueryParams(BaseModel):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth to checking if we can use ListingQueryParams, this way we would keep the same interface as similar listings.

Comment thread backend/kernelCI_app/views/labView.py Outdated
status_code=HTTPStatus.OK,
)
except ValidationError as e:
return Response(data=e.json(), status=HTTPStatus.INTERNAL_SERVER_ERROR)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there is a helper that other views are using create_error_reponse.

Comment thread dashboard/src/types/lab.ts Outdated
test_status_summary: ShortStatusCount;
};

export type LabListingApiItem = LabListingItem;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we exporting the same type twice here?

@felipebergamin
felipebergamin force-pushed the feat/1966/labs-listing-page branch from 017dd23 to 7d53fde Compare July 17, 2026 21:37

@alanpeixinho alanpeixinho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@felipebergamin
felipebergamin force-pushed the feat/1966/labs-listing-page branch from 7d53fde to ce8bcb2 Compare August 20, 2026 22:22
@felipebergamin
felipebergamin marked this pull request as ready for review August 20, 2026 22:22
routeInfo.isLabsPage) && (
<OriginSelect
isHardwarePath={
routeInfo.isHardwarePage || routeInfo.isLabsPage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using the hardware origin list here.
We might be safer using tree origin, or even (if not expensive), listing origins that interact with labs, in a new endpoint.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I have created an endpoint labs/origins to list origins related to labs.

Part of kernelci#1966

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Closes kernelci#1966

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Stop reusing hardware test origins on the labs page so the dropdown only shows origins that actually have lab_id rows.

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
@felipebergamin
felipebergamin force-pushed the feat/1966/labs-listing-page branch from 442b6ee to 8dc5885 Compare August 27, 2026 14:59
Lab listing queries now join the labs table, but fixtures had no lab rows
and start_times sit outside the default 7-day window. Attach labs to
seeded builds/tests and treat NO_LABS_FOUND like the tree listing tests.

Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
Signed-off-by: Felipe Bergamin <felipebergamin@profusion.mobi>
@felipebergamin

Copy link
Copy Markdown
Member Author

@alanpeixinho requesting a new review. Fixed the integration tests, but the page is the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants