fix(ui/astryx-reference): show runs as short facts with one status indicator
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 file changed
+63
-132
@@ -38,7 +38,6 @@ import {
|
||||
import {StatusDot} from '@astryxdesign/core/StatusDot';
|
||||
import {Heading, Text} from '@astryxdesign/core/Text';
|
||||
import {Timestamp} from '@astryxdesign/core/Timestamp';
|
||||
import {Token} from '@astryxdesign/core/Token';
|
||||
import {useMediaQuery} from '@astryxdesign/core/hooks';
|
||||
import {BellAlertIcon} from '@heroicons/react/24/outline';
|
||||
|
||||
@@ -52,13 +51,13 @@ interface Run extends Record<string, unknown> {
|
||||
service: string;
|
||||
environment: string;
|
||||
status: RunStatus;
|
||||
trigger: string;
|
||||
startedAt: string;
|
||||
summary: string;
|
||||
evidence: string;
|
||||
proposedAction: string;
|
||||
reversibility: string;
|
||||
policy: string;
|
||||
cause: string;
|
||||
change: string;
|
||||
risk: string;
|
||||
undo: string;
|
||||
approval: string;
|
||||
}
|
||||
|
||||
const PRIMARY_RUN_ID = 'RUN-2041';
|
||||
@@ -77,16 +76,6 @@ const STATUS_LABEL: Record<RunStatus, string> = {
|
||||
declined: 'Declined',
|
||||
};
|
||||
|
||||
const STATUS_TOKEN_COLOR: Record<
|
||||
RunStatus,
|
||||
'yellow' | 'green' | 'red' | 'gray'
|
||||
> = {
|
||||
approval: 'yellow',
|
||||
completed: 'green',
|
||||
failed: 'red',
|
||||
declined: 'gray',
|
||||
};
|
||||
|
||||
const STATUS_DOT_VARIANT: Record<
|
||||
RunStatus,
|
||||
'warning' | 'success' | 'error' | 'neutral'
|
||||
@@ -105,17 +94,13 @@ const BASE_RUNS: Run[] = [
|
||||
service: 'checkout',
|
||||
environment: 'production',
|
||||
status: 'approval',
|
||||
trigger: 'Checkout timeout alert',
|
||||
startedAt: '2026-11-19T09:38:00Z',
|
||||
summary: 'Evidence points to release 4.9.0; rollback awaits an exact decision',
|
||||
evidence:
|
||||
'Checkout timeouts rose from 0.4% to 8.1% four minutes after release 4.9.0. No other service showed a comparable rise.',
|
||||
proposedAction:
|
||||
'Roll back checkout only from 4.9.0 to 4.8.2, then verify the deployed version and timeout rate.',
|
||||
reversibility:
|
||||
'Moderate risk: checkout may briefly lose capacity during rollout. Release 4.9.0 can be reapplied. The database is unchanged.',
|
||||
policy:
|
||||
'Read-only investigation is allowed. A production rollback needs operator approval. Database changes are blocked.',
|
||||
summary: 'Likely caused by release 4.9.0',
|
||||
cause: 'Timeouts rose from 0.4% to 8.1% after release 4.9.0',
|
||||
change: 'Roll checkout back to 4.8.2',
|
||||
risk: 'Moderate: brief capacity dip',
|
||||
undo: 'Yes, reapply 4.9.0',
|
||||
approval: 'Needs your approval',
|
||||
},
|
||||
{
|
||||
id: 'RUN-2040',
|
||||
@@ -124,17 +109,13 @@ const BASE_RUNS: Run[] = [
|
||||
service: 'payments',
|
||||
environment: 'production',
|
||||
status: 'completed',
|
||||
trigger: 'Projection lag alert',
|
||||
startedAt: '2026-11-19T08:52:00Z',
|
||||
summary: 'Rebuilt 18,420 stale documents and verified query freshness',
|
||||
evidence:
|
||||
'Projection lag crossed 12 minutes after the indexing worker was rescheduled. Source events remained intact.',
|
||||
proposedAction:
|
||||
'Pause the stale reader, rebuild the projection from verified source events, and run a freshness check.',
|
||||
reversibility:
|
||||
'Low risk. The prior read projection remained available until the replacement passed validation.',
|
||||
policy:
|
||||
'Rebuilding a derived projection is permitted. Changing source payment records requires separate approval.',
|
||||
summary: 'Rebuilt 18,420 stale documents',
|
||||
cause: 'Search results lagged by 12 minutes',
|
||||
change: 'Rebuilt the search projection',
|
||||
risk: 'Low',
|
||||
undo: 'Yes, old projection kept',
|
||||
approval: 'Allowed',
|
||||
},
|
||||
{
|
||||
id: 'RUN-2039',
|
||||
@@ -143,17 +124,13 @@ const BASE_RUNS: Run[] = [
|
||||
service: 'webhooks',
|
||||
environment: 'production',
|
||||
status: 'failed',
|
||||
trigger: 'Queue saturation alert',
|
||||
startedAt: '2026-11-19T08:11:00Z',
|
||||
summary: 'Stopped before replay because the target allowlist did not match policy',
|
||||
evidence:
|
||||
'The failed queue held 2,104 deliveries, including two destinations outside the approved recovery allowlist.',
|
||||
proposedAction:
|
||||
'Replay deliveries only to approved destinations and retain the rest for operator review.',
|
||||
reversibility:
|
||||
'No delivery replay occurred. The retained queue can be reviewed without duplicating external side effects.',
|
||||
policy:
|
||||
'External delivery is limited to approved destinations. The policy match must pass before replay starts.',
|
||||
summary: 'Blocked: 2 destinations not on the allowlist',
|
||||
cause: '2,104 webhook deliveries failed',
|
||||
change: 'None; nothing was replayed',
|
||||
risk: 'None',
|
||||
undo: 'Nothing to undo',
|
||||
approval: 'Blocked by allowlist',
|
||||
},
|
||||
{
|
||||
id: 'RUN-2038',
|
||||
@@ -162,17 +139,13 @@ const BASE_RUNS: Run[] = [
|
||||
service: 'warehouse',
|
||||
environment: 'staging',
|
||||
status: 'completed',
|
||||
trigger: 'Freshness report',
|
||||
startedAt: '2026-11-18T23:24:00Z',
|
||||
summary: 'Restored cache generation 41 and verified sample query parity',
|
||||
evidence:
|
||||
'The active cache was two generations behind while the source data and last good cache remained available.',
|
||||
proposedAction:
|
||||
'Promote cache generation 41 after parity checks, then invalidate the stale generation.',
|
||||
reversibility:
|
||||
'Generation 40 remains retained and can be promoted again if parity checks regress.',
|
||||
policy:
|
||||
'Staging cache promotion is permitted because it does not modify source data.',
|
||||
summary: 'Restored cache generation 41',
|
||||
cause: 'Staging cache was 2 generations behind',
|
||||
change: 'Promoted cache generation 41',
|
||||
risk: 'Low',
|
||||
undo: 'Yes, generation 40 kept',
|
||||
approval: 'Allowed',
|
||||
},
|
||||
{
|
||||
id: 'RUN-2037',
|
||||
@@ -181,17 +154,13 @@ const BASE_RUNS: Run[] = [
|
||||
service: 'notifications',
|
||||
environment: 'production',
|
||||
status: 'completed',
|
||||
trigger: 'Worker heartbeat miss',
|
||||
startedAt: '2026-11-18T21:07:00Z',
|
||||
summary: 'Replaced one unhealthy worker and drained its duplicate task safely',
|
||||
evidence:
|
||||
'Worker notifications-7 missed three heartbeats while the scheduler retained its last lease record.',
|
||||
proposedAction:
|
||||
'Drain notifications-7, start a replacement, and verify one active lease per scheduled task.',
|
||||
reversibility:
|
||||
'The replacement remained behind the healthy pool until lease uniqueness passed; the old worker could be returned if needed.',
|
||||
policy:
|
||||
'Worker replacement is permitted. Sending an ad hoc notification requires a separate workflow and grant.',
|
||||
summary: 'Replaced one unhealthy worker',
|
||||
cause: 'Worker notifications-7 stopped responding',
|
||||
change: 'Replaced the worker',
|
||||
risk: 'Low',
|
||||
undo: 'Yes',
|
||||
approval: 'Allowed',
|
||||
},
|
||||
{
|
||||
id: 'RUN-2036',
|
||||
@@ -200,17 +169,13 @@ const BASE_RUNS: Run[] = [
|
||||
service: 'identity',
|
||||
environment: 'production',
|
||||
status: 'failed',
|
||||
trigger: 'Credential expiry',
|
||||
startedAt: '2026-11-18T18:43:00Z',
|
||||
summary: 'Stopped at the first protected group; no membership was changed',
|
||||
evidence:
|
||||
'The sync reached an expired credential after loading 61 proposed membership differences, including four protected groups.',
|
||||
proposedAction:
|
||||
'Renew the credential and replay only the membership differences allowed by the protected-group policy.',
|
||||
reversibility:
|
||||
'No membership update was applied. A renewed credential and a new run can reproduce the proposed difference set.',
|
||||
policy:
|
||||
'Protected groups cannot be reconciled by this workflow. Credential renewal does not authorize protected membership changes.',
|
||||
summary: 'Stopped at a protected group; nothing changed',
|
||||
cause: 'Sync credential expired',
|
||||
change: 'None; no memberships changed',
|
||||
risk: 'None',
|
||||
undo: 'Nothing to undo',
|
||||
approval: 'Protected groups are excluded',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -275,8 +240,8 @@ function getRuns(decision: RunDecision): Run[] {
|
||||
decision === 'pending'
|
||||
? run.summary
|
||||
: decision === 'approved'
|
||||
? 'Rollback completed; checkout timeouts returned to 0.4%'
|
||||
: 'Operator declined the rollback; no production change was made',
|
||||
? 'Rolled back; timeouts back to 0.4%'
|
||||
: 'Declined; nothing changed',
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -327,7 +292,7 @@ function RunRows({
|
||||
<ListItem
|
||||
key={run.id}
|
||||
label={run.title}
|
||||
description={`${run.id} · ${run.workflow} · ${run.summary}`}
|
||||
description={run.summary}
|
||||
startContent={
|
||||
<StatusDot
|
||||
variant={STATUS_DOT_VARIANT[run.status]}
|
||||
@@ -336,18 +301,11 @@ function RunRows({
|
||||
/>
|
||||
}
|
||||
endContent={
|
||||
<HStack gap={3} vAlign="center">
|
||||
<Token
|
||||
size="sm"
|
||||
color={STATUS_TOKEN_COLOR[run.status]}
|
||||
label={STATUS_LABEL[run.status]}
|
||||
/>
|
||||
<Timestamp
|
||||
value={run.startedAt}
|
||||
format="relative_short"
|
||||
color="secondary"
|
||||
/>
|
||||
</HStack>
|
||||
<Timestamp
|
||||
value={run.startedAt}
|
||||
format="relative_short"
|
||||
color="secondary"
|
||||
/>
|
||||
}
|
||||
onClick={() => onSelect(run.id)}
|
||||
isSelected={run.id === selectedId}
|
||||
@@ -385,13 +343,8 @@ function RunInspector({
|
||||
isPulsing={run.status === 'approval'}
|
||||
/>
|
||||
<Text type="supporting" color="secondary">
|
||||
{run.id}
|
||||
{STATUS_LABEL[run.status]} · {run.id}
|
||||
</Text>
|
||||
<Token
|
||||
size="sm"
|
||||
color={STATUS_TOKEN_COLOR[run.status]}
|
||||
label={STATUS_LABEL[run.status]}
|
||||
/>
|
||||
</HStack>
|
||||
</StackItem>
|
||||
{onClose && (
|
||||
@@ -426,11 +379,20 @@ function RunInspector({
|
||||
<MetadataList
|
||||
columns="single"
|
||||
label={{position: 'start', width: 96}}>
|
||||
<MetadataListItem label="Service">
|
||||
<Text type="body">{run.service}</Text>
|
||||
<MetadataListItem label="Cause">
|
||||
<Text type="body">{run.cause}</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Environment">
|
||||
<Text type="body">{run.environment}</Text>
|
||||
<MetadataListItem label="Change">
|
||||
<Text type="body">{run.change}</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Risk">
|
||||
<Text type="body">{run.risk}</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Undo">
|
||||
<Text type="body">{run.undo}</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Approval">
|
||||
<Text type="body">{run.approval}</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Started">
|
||||
<Timestamp
|
||||
@@ -439,38 +401,7 @@ function RunInspector({
|
||||
timezoneID="UTC"
|
||||
/>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Trigger">
|
||||
<Text type="body">{run.trigger}</Text>
|
||||
</MetadataListItem>
|
||||
</MetadataList>
|
||||
|
||||
<Divider />
|
||||
|
||||
<VStack gap={2}>
|
||||
<Heading level={3}>Decision record</Heading>
|
||||
<MetadataList columns="single" label={{position: 'top'}}>
|
||||
<MetadataListItem label="Evidence">
|
||||
<Text as="p" type="body">
|
||||
{run.evidence}
|
||||
</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Proposed action">
|
||||
<Text as="p" type="body">
|
||||
{run.proposedAction}
|
||||
</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Reversibility">
|
||||
<Text as="p" type="body">
|
||||
{run.reversibility}
|
||||
</Text>
|
||||
</MetadataListItem>
|
||||
<MetadataListItem label="Policy">
|
||||
<Text as="p" type="body">
|
||||
{run.policy}
|
||||
</Text>
|
||||
</MetadataListItem>
|
||||
</MetadataList>
|
||||
</VStack>
|
||||
</VStack>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user