Timeline: add Secret Scanning event stories (Phase 2)#8073
Timeline: add Secret Scanning event stories (Phase 2)#8073janmaarten-a11y wants to merge 3 commits into
Conversation
… group) Storybook-only stories recreating GitHub's secret-scanning alert timeline events with Primer Timeline slots, mirroring the Issues and Dependabot surfaces. Scopes this commit to the canonical Created/Opened event group plus the full file scaffold (file-scoped FeatureFlags decorator, GitHub system actor + muted Time helpers, header doc block). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Complete the secret-scanning surface with all 7 event groups (29 variants): Resolution (7 closed reasons + Reopened), Bypass + delegated bypass, Validity change (active/inactive/unknown x automated/manual), Report, delegated closure request/approve/deny/cancel (with Review/Cancel right-controls), and Assignment (actor + assignee avatars). Extract UserActor and CommentSubRow helpers. Every group is verified against the live AlertTimeline.tsx switch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
There was a problem hiding this comment.
Pull request overview
Adds a new Storybook “Features” surface under Components/Timeline/Events/Secret Scanning that recreates GitHub’s Secret Scanning alert timeline event rows using Primer React Timeline and its Phase 1 compositional slots (inline actor treatment + optional Timeline.Actions).
Changes:
- Added
Timeline.secret-scanning.features.stories.tsxwith 7 event-group story exports (Created, Resolution, Bypass, Validity change, Report, Delegated closure request, Assignment). - Added a co-located CSS module to provide story-only scaffolding (variant sections/labels) and to mirror GitHub’s inline actor and sub-row styling.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/Timeline/Timeline.secret-scanning.features.stories.tsx | Introduces Secret Scanning timeline event stories and helpers (actors, timestamp, comment sub-row), including Timeline.Actions variants for delegated closure requests. |
| packages/react/src/Timeline/Timeline.secret-scanning.features.stories.module.css | Adds story scaffolding and shared styles for inline actors, comment sub-rows, and muted timestamps. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Low
- Render the Resolution "Reopened" variant with the preceding closed Item so
Timeline.Break sits between two items (mirrors live break-between-events
placement; avoids a stray first-child break).
- Use the u/{id}?v=4 avatar URL form for the demo assignee avatars, matching
the convention used elsewhere in the Timeline stories.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Adds Storybook Features stories that recreate GitHub's live Secret Scanning alert timeline events using the Primer
Timelinecomponent and its compositional slots. This is the Secret Scanning surface — the first Security surface — of Phase 2 of the Timeline events effort (github/primer#6663). The Issues surface (#8070), Issue comment cards (#8072), and the Dependabot alert surface (#8071) already landed; Code Scanning and License Compliance will follow as separate Security surfaces.Unlike Dependabot (which is server-rendered ERB), Secret Scanning is fully React and its live timeline already composes Primer React
Timeline+Timeline.Badge variant=, so the events map cleanly — the badge colors, icons, and actor treatments translate almost one-to-one.All examples live in a single new file,
Timeline.secret-scanning.features.stories.tsx(+ a.module.css), exported under the titleComponents/Timeline/Events/Secret Scanning— one story export per event group.The 7 event groups (29 variants total)
EventCreatedshieldon solidsuccess(green)EventResolutionshield-checkon soliddone(revoked) / bareshield-slash(other 6) /syncon solidsuccess(reopened)EventBypassalert/comment/check-circleEventValidityChangealerton soliddanger(active) / bareskip(inactive) /alerton solidattention(unknown)EventReportshield-checkEventClosureRequestcomment/check-circle/x/skipEventAssignmentpersonSource of truth
These stories were recreated from the live React implementation in
github/github-ui, packagepackages/secret-scanning-alerts/. The authoritative dispatch is theswitch (event.type)incomponents/show/AlertTimeline.tsx; per-event copy/badges/actors were read directly from it and its helpers (helper.ts,components/shared/UserComponent.tsx,components/show/closures/ClosureRequestReviewButtons.tsx) and translated faithfully into Primer React. There is no ERB secret-scanning timeline — the migration to React is complete.We verified the live render path rather than trusting the Figma audit blindly. The notable resolutions:
REVOCATIONevent type is dead code.TimelineEventType.Revocation = 'REVOCATION'exists in the enum but has nocasein the switch, so it renders nothing — it is intentionally not built.resolutionText()(revoked, false positive, won't fix, used in tests, pattern deleted, pattern edited, ignored by configuration). Only revoked gets the special purpledone/shield-checkbadge; the other six use the bare default badge withshield-slash. Reasons render as bold text, not links.Reportcase does not passisGitHubActor(a point the audit flagged as uncertain).ClosureRequestReviewButtons.tsx. They are driven by two independent, viewer-specific payload flags (show_closure_request_review_buttonsfor reviewers,show_closure_request_cancel_buttonfor the requester), so they are mutually exclusive per viewer; both are shown as separate variants.MarkGithubIcon+ bold "GitHub", no avatar) is used by Creation unconditionally and by automated validity changes (!event.actor); manual validity changes and every other event use the user actor.Slots used (Phase 1 slots)
Timeline.Bodyfor these badge-row events — a 16px circle user avatar + bold login (UserActor, mirroring liveUserComponent), or the systemGitHubActor(MarkGithubIcon+ bold "GitHub", no avatar). Badge-row events do not use the gutterTimeline.Avatar.Timeline.Actions(right-controls slot, added in Add Timeline.Actions sub-component #7886) for the closure-request "Review request" / "Cancel request" buttons.Timeline.Breakis rendered immediately before the Reopened resolution variant, mirroring the live sibling-selector placement.CommentSubRow: 12px mutedcommenticon + small text) renders the optionalresolution.comment/ requester / reviewer comment under Resolution closures and the delegated-closure events.Badge note
Events whose live code passes a solid variant (
success/done/danger/attention) useTimeline.Badge variant=directly. Events whose live code passesvariant={undefined}(all the "gray" events) render as a bareTimeline.Badge— a muted icon on a borderless circle with no solid fill — matching the Dependabot precedent (#8071), not the Issues--timelineBadge-bgColorsolid-gray hook. None of the secret-scanning gray events is a solid-gray badge.Accessibility
Secret Scanning renders no in-text links — the live
UserComponentrenders the login as a boldtext-boldspan (hovercard attrs only, not a profile link), and resolution reasons are bold text. So the axelink-in-text-blockhigh-contrast rule (which required theinline/bold treatment on the Dependabot surface) is never exercised here. The header doc notes that any future in-text link must still useinline/bold.Scope & conventions
<section>with a small caption<h3>above the event, so the event row itself renders exactly as it would in product (the caption never sits insideTimeline.Body).FeatureFlagsdecorator enablingprimer_react_timeline_list_semantics(the future-state<ol>/<li>DOM; refs Timeline: Use list semantics for screen reader navigation #7910).Timeline.docs.jsonorbuild.ts) — individual timeline events are not consumer-facing components.data-*filtering taxonomy (github/primer#6663) is intentionally deferred; the hook location is documented in the file header.Changelog
New
Timeline.secret-scanning.features.stories.tsxandTimeline.secret-scanning.features.stories.module.css— Storybook Features stories recreating the Secret Scanning alert timeline events (7 groups, 29 variants).Changed
Removed
Rollout strategy
Stories-only change — no consumer-facing package code is added or modified, so no changeset is needed (the
skip changesetlabel is applied).Testing & Reviewing
@primer/doc-genbaseline error inscript/components-json/build.tsis unchanged).AlertTimeline.tsxswitch and its helpers; where the Figma audit was uncertain (deadREVOCATION, closure-reason set, Report attribution, Review/Cancel buttons), the live code won.Merge checklist