Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions dashboard/site/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,44 @@
},
"layout": "half"
},
{
"id": "repository-workflow-aic",
"title": "Top workflows by AIC",
"description": "The five workflows with the highest measured AI Credit totals in this repository.",
"data": {
"source": "repository-workflow-usage",
"route-field": "repository",
"limit": 5,
"order-by": [
{
"field": "total-aic",
"direction": "desc"
}
]
},
"mark": "chart",
"chart": "pie",
"encoding": {
"x": {
"field": "workflow",
"type": "nominal",
"title": "Workflow"
},
"y": {
"field": "aic",
"type": "quantitative",
"aggregate": "sum",
"as": "total-aic",
"title": "Total AIC",
"unit": "aic"
},
"href": {
"field": "workflow-link",
"type": "nominal"
}
},
"layout": "third"
},
{
"id": "repository-authored-workflows",
"title": "Agentic workflows",
Expand Down
1 change: 1 addition & 0 deletions dashboard/site/playwright.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const executablePath = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH

export default defineConfig({
fullyParallel: true,
workers: process.env.CI ? 1 : undefined,
testMatch: ['**/*.spec.js'],
testDir: './test/e2e',
timeout: 30000,
Expand Down
18 changes: 18 additions & 0 deletions dashboard/site/src/repository-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export function deriveRepositorySources(sources) {
rows: buildRepositoryWorkflowStatusRows(repositoryWorkflows),
metadata: workflowMetadata
},
'repository-workflow-usage': {
source: 'repository-workflow-usage',
rows: buildRepositoryWorkflowUsageRows(sources.usage?.rows ?? []),
metadata: sources.usage?.metadata ?? unavailableMetadata()
},
'repository-workflows': {
source: 'repository-workflows',
rows: repositoryWorkflows,
Expand Down Expand Up @@ -136,6 +141,19 @@ function buildRepositoryWorkflowStatusRows(workflows) {
return [...counts.values()];
}

/** @param {Array<Record<string, unknown>>} usage */
function buildRepositoryWorkflowUsageRows(usage) {
return usage
.map((row) => ({
repository: qualifiedRepository(row),
workflow: String(row.workflow ?? ''),
invocation: String(row.invocation ?? ''),
aic: Number(row.aic),
...(row['workflow-link'] ? { 'workflow-link': row['workflow-link'] } : {})
}))
.filter((row) => row.repository && row.workflow && row.invocation && Number.isFinite(row.aic) && row.aic >= 0);
}

/**
* @param {Record<string, import('./presenter.js').LogicalSourceInput>} sources
* @returns {Array<Record<string, unknown>>}
Expand Down
3 changes: 3 additions & 0 deletions dashboard/site/src/specification.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export const SOURCE_VALUES = [
'repository-activity',
'repository-detail-summary',
'repository-workflow-status',
'repository-workflow-usage',
'repository-workflows',
'workflow-reports',
'package-reports'
Expand Down Expand Up @@ -311,6 +312,7 @@ export const SOURCE_FIELDS = {
'repository-activity': ['repository', 'workflows', 'reports', 'evaluated-workflows', 'runs', 'failure-summary', 'aic', 'status', 'repository-link'],
'repository-detail-summary': ['repository', 'workflows', 'latest-update', 'external-link'],
'repository-workflow-status': ['repository', 'status', 'workflows'],
'repository-workflow-usage': ['repository', 'workflow', 'invocation', 'aic', 'workflow-link'],
'repository-workflows': ['repository', 'workflow', 'workflow-name', 'workflow-role', 'package-name', 'rollout-mode', 'workflow-active', 'observed-at', 'workflow-link'],
'workflow-reports': ['workflow-route', 'safe-output', 'outcome-title', 'outcome-summary', 'outcome-status', 'rollout-mode', 'outcome-category', 'observed-at', 'external-link'],
'package-reports': ['package', 'safe-output', 'outcome-title', 'outcome-summary', 'outcome-status', 'rollout-mode', 'outcome-category', 'observed-at', 'external-link'],
Expand Down Expand Up @@ -364,6 +366,7 @@ export const SOURCE_ENTITY_IDENTIFIER_FIELDS = {
'repository-activity': ['repository'],
'repository-detail-summary': ['repository'],
'repository-workflow-status': ['repository', 'status'],
'repository-workflow-usage': ['invocation'],
'repository-workflows': ['repository', 'workflow'],
'workflow-reports': ['workflow-route', 'safe-output'],
'package-reports': ['package', 'safe-output']
Expand Down
31 changes: 29 additions & 2 deletions dashboard/site/test/unit/repositories-view.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ function sources() {
{ organization: 'octo', repository: 'quiet', 'safe-output': 'report-1' }
]),
usage: source('usage', [
{ organization: 'octo', repository: 'failing', run: '1', aic: 12 },
{ organization: 'octo', repository: 'failing', workflow: 'one', invocation: 'usage-one', aic: 7 },
{ organization: 'octo', repository: 'failing', workflow: 'one', invocation: 'usage-two', aic: 2 },
{ organization: 'octo', repository: 'failing', workflow: 'two', invocation: 'usage-three', aic: 3 },
{ organization: 'octo', repository: 'active', run: '3', aic: 8 },
{ organization: 'octo', repository: 'usage-only', run: '4', aic: 100 }
], { completeness: 'partial' }),
Expand Down Expand Up @@ -131,7 +133,7 @@ describe('repositories view', () => {

expect(scope.textContent).toContain('Repository scope · 3 configured');
expect(scope.textContent).toContain('Complete 24-hour Actions run window');
expect(scope.textContent).toContain('3 artifacts · partial');
expect(scope.textContent).toContain('5 artifacts · partial');
expect([...scope.querySelectorAll('a')].map((link) => link.getAttribute('href'))).toEqual([
'#page-repository-detail?repository=octo%2Factive',
'#page-repository-detail?repository=octo%2Ffailing',
Expand Down Expand Up @@ -195,11 +197,31 @@ describe('repositories view', () => {
const workflowsView = repositoryPage.views.find(
(/** @type {{ id: string }} */ view) => view.id === 'repository-authored-workflows'
);
const workflowAicView = repositoryPage.views.find(
(/** @type {{ id: string }} */ view) => view.id === 'repository-workflow-aic'
);
expect(workflowsView).toMatchObject({
mark: 'table',
controls: 'interactive',
'column-summaries': true
});
expect(workflowAicView).toMatchObject({
title: 'Top workflows by AIC',
data: {
source: 'repository-workflow-usage',
'route-field': 'repository',
limit: 5,
'order-by': [{ field: 'total-aic', direction: 'desc' }]
},
mark: 'chart',
chart: 'pie',
encoding: {
x: { field: 'workflow' },
y: { field: 'aic', aggregate: 'sum', as: 'total-aic', unit: 'aic' },
href: { field: 'workflow-link' }
},
layout: 'third'
});

const sourceInputs = sources();
sourceInputs.workflows.rows[0] = {
Expand Down Expand Up @@ -229,6 +251,11 @@ describe('repositories view', () => {
{ repository: 'octo/failing', status: 'Active', workflows: 2 },
{ repository: 'octo/quiet', status: 'Disabled', workflows: 1 }
]));
expect(derived['repository-workflow-usage'].rows).toEqual(expect.arrayContaining([
{ repository: 'octo/failing', workflow: 'one', invocation: 'usage-one', aic: 7 },
{ repository: 'octo/failing', workflow: 'one', invocation: 'usage-two', aic: 2 },
{ repository: 'octo/failing', workflow: 'two', invocation: 'usage-three', aic: 3 }
]));
expect(derived['repository-workflows'].rows).toContainEqual(expect.objectContaining({
repository: 'octo/failing',
workflow: '.github/workflows/one.md',
Expand Down
Loading