-
Notifications
You must be signed in to change notification settings - Fork 0
Render dashboard release health summary in UI #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ProfRandom92
merged 1 commit into
main
from
codex/render-dashboard-release-health-summary
May 11, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { releaseHealthSummaryFallback } from '../mocks/releaseHealthSummary'; | ||
| import type { ReleaseHealthCheck, ReleaseHealthSummary } from '../types/domain'; | ||
|
|
||
| export const RELEASE_HEALTH_SUMMARY_PATH = 'docs/reports/dashboard-health-summary.json'; | ||
|
|
||
| export interface ReleaseHealthState { | ||
| summary: ReleaseHealthSummary; | ||
| unavailable: boolean; | ||
| message?: string; | ||
| } | ||
|
|
||
| function isRecord(value: unknown): value is Record<string, unknown> { | ||
| return typeof value === 'object' && value !== null && !Array.isArray(value); | ||
| } | ||
|
|
||
| function stringArray(value: unknown): string[] { | ||
| return Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : []; | ||
| } | ||
|
|
||
| function normalizeCheck(value: unknown, key: string): ReleaseHealthCheck { | ||
| if (!isRecord(value)) return { key, status: 'unknown', present: false }; | ||
| return { | ||
| description: typeof value.description === 'string' ? value.description : undefined, | ||
| key: typeof value.key === 'string' ? value.key : key, | ||
| path: typeof value.path === 'string' ? value.path : undefined, | ||
| present: typeof value.present === 'boolean' ? value.present : undefined, | ||
| required: typeof value.required === 'boolean' ? value.required : undefined, | ||
| size_bytes: typeof value.size_bytes === 'number' ? value.size_bytes : undefined, | ||
| status: typeof value.status === 'string' ? value.status : undefined, | ||
| }; | ||
| } | ||
|
|
||
| export function normalizeReleaseHealthSummary(value: unknown): ReleaseHealthSummary | null { | ||
| if (!isRecord(value)) return null; | ||
| const checks = isRecord(value.checks) | ||
| ? Object.fromEntries(Object.entries(value.checks).map(([key, check]) => [key, normalizeCheck(check, key)])) | ||
| : undefined; | ||
| const missing = isRecord(value.missing_artifacts) | ||
| ? Object.fromEntries(Object.entries(value.missing_artifacts).map(([key, artifacts]) => [key, stringArray(artifacts)])) | ||
| : undefined; | ||
|
|
||
| return { | ||
| overall_status: typeof value.overall_status === 'string' ? value.overall_status : 'unknown', | ||
| checks, | ||
| required_artifacts_present: stringArray(value.required_artifacts_present), | ||
| missing_artifacts: missing, | ||
| next_recommended_actions: stringArray(value.next_recommended_actions), | ||
| safety_notes: stringArray(value.safety_notes), | ||
| generated_at: typeof value.generated_at === 'string' ? value.generated_at : undefined, | ||
| synthetic: typeof value.synthetic === 'boolean' ? value.synthetic : undefined, | ||
| summary_type: typeof value.summary_type === 'string' ? value.summary_type : undefined, | ||
| }; | ||
| } | ||
|
|
||
| function releaseHealthUrl(apiBase: string) { | ||
| return `${apiBase.replace(/\/$/, '')}/dashboard-health-summary.json`; | ||
| } | ||
|
|
||
| async function fetchSummary(path: string, signal?: AbortSignal): Promise<ReleaseHealthSummary> { | ||
| const response = await fetch(path, { signal, headers: { Accept: 'application/json' } }); | ||
| if (!response.ok) throw new Error(`${response.status} ${response.statusText}`); | ||
| const summary = normalizeReleaseHealthSummary(await response.json()); | ||
| if (!summary) throw new Error('Invalid release health summary payload'); | ||
| return summary; | ||
| } | ||
|
|
||
| export async function fetchReleaseHealthSummary(apiBase = '', signal?: AbortSignal): Promise<ReleaseHealthState> { | ||
| try { | ||
| return { summary: await fetchSummary(releaseHealthUrl(apiBase), signal), unavailable: false }; | ||
| } catch (error) { | ||
| const message = error instanceof Error ? error.message : 'Unknown summary load error'; | ||
| return { | ||
| summary: releaseHealthSummaryFallback, | ||
| unavailable: true, | ||
| message: `Health summary unavailable. Expected ${RELEASE_HEALTH_SUMMARY_PATH}. ${message}`, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import type { ReleaseHealthSummary } from '../types/domain'; | ||
|
|
||
| export const releaseHealthSummaryFallback: ReleaseHealthSummary = { | ||
| overall_status: 'unknown', | ||
| checks: { | ||
| contract_validation_report: { | ||
| description: 'Contract schema validation report.', | ||
| key: 'contract_validation_report', | ||
| path: 'docs/reports/contract-validation-report.md', | ||
| present: false, | ||
| required: true, | ||
| status: 'unavailable', | ||
| }, | ||
| api_export_validation_report: { | ||
| description: 'Synthetic API/export contract validation report.', | ||
| key: 'api_export_validation_report', | ||
| path: 'docs/reports/api-export-validation-report.md', | ||
| present: false, | ||
| required: true, | ||
| status: 'unavailable', | ||
| }, | ||
| project_health_report: { | ||
| description: 'Generated project health and release status report.', | ||
| key: 'project_health_report', | ||
| path: 'docs/reports/project-health-report.md', | ||
| present: false, | ||
| required: true, | ||
| status: 'unavailable', | ||
| }, | ||
| }, | ||
| missing_artifacts: { | ||
| required_local: ['docs/reports/dashboard-health-summary.json'], | ||
| optional_cross_repo: [], | ||
| }, | ||
| next_recommended_actions: [ | ||
| 'Generate docs/reports/dashboard-health-summary.json before release review.', | ||
| 'Run the dashboard with a built static bundle or local backend route that can serve the summary artifact.', | ||
| ], | ||
| safety_notes: [ | ||
| 'Health summary unavailable; showing synthetic fallback metadata only.', | ||
| 'No real Daimler data, customer payloads, secrets, cookies, tokens, raw production logs, or proprietary documents are included.', | ||
| ], | ||
| synthetic: true, | ||
| summary_type: 'dashboard_release_health_fallback', | ||
| }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
ReleaseHealthSummaryCardcomponent currently displays a 'Health summary unavailable' warning while the data is still being fetched. This occurs becausestateis undefined during the loading phase, causingsummaryto be undefined and triggering the condition on line 55.Furthermore, line 55 is redundant because the
fetchReleaseHealthSummaryhelper is designed to always return a validReleaseHealthStateobject (using a fallback summary on error), sosummarywill only be falsy when the query is still loading.I recommend adding a guard clause to return
nullifstateis undefined to prevent the loading flash, and removing the redundant check on line 55.