Timeline: tag event stories with taxonomy data-* attributes (helper, all five surfaces, gap fixes) - #8216
Conversation
|
…ttributes Spread the event data-* contract from the taxonomy module onto every Timeline.Item in the License Compliance feature stories. This is the proof-of-pattern pilot for Phase 3 taxonomy tagging (github/primer#6664). Storybook-only, no consumer-facing change. Copilot-Session: ac5d1407-e965-4994-b6d5-fd1b8ec0cdef
…event stories with taxonomy data-* attributes Extend the taxonomy data-* tagging from License Compliance to the remaining four surfaces, so all five now carry the contract. Same approach: each Timeline.Item spreads toEventDataAttributes(), deriving category and visibility from that surface's catalog and resolving data-actor-type from the rendered login. Parked and shared events, and variants with no catalog leaf, are left untagged with inline comments. Storybook-only; no visual change.
…es; consume in stories
…rop stray Issues draft row
0196145 to
e5e13b9
Compare
There was a problem hiding this comment.
Pull request overview
This PR standardizes Timeline Storybook event stories by projecting taxonomy data-* attributes from the shared Timeline taxonomy catalogs, consolidating the per-surface attribute logic into a single internal helper, and closing a few taxonomy/story gaps discovered during the tagging pass.
Changes:
- Added a reusable internal helper (
eventDataAttributesFor) to generate the Timeline event taxonomydata-*attributes from the per-surface catalogs. - Updated all five Timeline event story surfaces to tag cataloged rows via the helper (leaving intentionally-uncataloged rows untagged and documented in-line).
- Expanded taxonomy coverage/behavior: added Secret Scanning
reportedleaf and classified the GitHub system identity (github/GitHub) as a bot.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/Timeline/Timeline.secret-scanning.features.stories.tsx | Applies taxonomy data-* attributes to cataloged Secret Scanning story rows via the shared helper; documents intentional untagged variants. |
| packages/react/src/Timeline/Timeline.license-compliance.features.stories.tsx | Applies taxonomy data-* attributes to all License Compliance rows via the helper (fully cataloged surface). |
| packages/react/src/Timeline/Timeline.issues.features.stories.tsx | Tags Issues rows via the helper; removes the invalid “Converted from draft” variant; documents intentional untagged variants. |
| packages/react/src/Timeline/Timeline.dependabot.features.stories.tsx | Tags Dependabot cataloged rows via the helper; documents shared/parked untagged groups (assignment/copilot work). |
| packages/react/src/Timeline/Timeline.code-scanning.features.stories.tsx | Tags Code Scanning rows via the helper and clarifies taxonomy mapping for visually-grouped variants. |
| packages/react/src/Timeline/taxonomy/index.ts | Re-exports the new helper from the Timeline taxonomy module. |
| packages/react/src/Timeline/taxonomy/eventTaxonomy.ts | Adds Secret Scanning reported leaf and clarifies Secret Scanning taxonomy comments. |
| packages/react/src/Timeline/taxonomy/eventTaxonomy.test.ts | Extends bot-login classification coverage to include github. |
| packages/react/src/Timeline/taxonomy/eventDataAttributes.ts | Introduces eventDataAttributesFor helper that projects data-* attributes from SURFACE_TAXONOMIES. |
| packages/react/src/Timeline/taxonomy/eventDataAttributes.test.ts | Adds unit tests for helper behavior (actor resolution, omissions, auditOnly preservation, category derivation). |
| packages/react/src/Timeline/taxonomy/actorType.ts | Classifies the github system identity as a bot for data-actor-type purposes. |
Review details
Suppressed comments (3)
packages/react/src/Timeline/Timeline.issues.features.stories.tsx:582
- This JSX comment is a single very long line, which hurts readability and can trip max-len linting. Please wrap it to match the surrounding comment style used throughout this stories file.
{/* Untagged: verified against the redesign prototype (github/prototyping janmaarten-a11y/timeline-redesign-v1) as an intentional exclusion, this variant is not modeled as a distinct catalog leaf (the catalog has only 'marked_as_duplicate'); no leaf -> no data-* tag. */}
packages/react/src/Timeline/Timeline.issues.features.stories.tsx:604
- This JSX comment is a single very long line, which hurts readability and can trip max-len linting. Please wrap it to match the surrounding comment style used throughout this stories file.
{/* Untagged: verified against the redesign prototype (github/prototyping janmaarten-a11y/timeline-redesign-v1) as an intentional exclusion, this variant is not modeled as a distinct catalog leaf (the catalog has only 'marked_as_duplicate'); no leaf -> no data-* tag. */}
packages/react/src/Timeline/Timeline.issues.features.stories.tsx:1845
- This JSX comment is a single very long line, which hurts readability and can trip max-len linting. Please wrap it to match the surrounding comment style used throughout this stories file.
{/* Untagged: a rolled-up event (labeled + unlabeled in one row) verified against the redesign prototype (github/prototyping janmaarten-a11y/timeline-redesign-v1) as an intentional exclusion, not modeled as a distinct catalog leaf; no leaf -> no data-* tag. */}
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
| {/* Converted from draft */} | ||
| <VariantSection label="Converted from draft"> | ||
| <Timeline aria-label="Issue timeline"> | ||
| <Timeline.Item> | ||
| <Timeline.Badge> | ||
| <Octicon icon={IssueDraftIcon} /> | ||
| </Timeline.Badge> | ||
| <Timeline.Body> | ||
| <UserActor href="#" muted /> | ||
| {'converted this from a draft issue '} | ||
| <MutedTime date={new Date('2022-07-21T08:30:00Z')} href="#" /> | ||
| </Timeline.Body> | ||
| </Timeline.Item> | ||
| </Timeline> | ||
| </VariantSection> |
There was a problem hiding this comment.
is this meant to be removeD?
There was a problem hiding this comment.
Good catch, apparently Copilot got overly hungry! converted_from_draft is a real issue event via Projects v2. Restoring it...
converted_from_draft is a real issue-timeline event (Projects v2 draft-issue conversion; github/github issue_timeline_items union). It has no taxonomy catalog leaf yet, so the row is restored untagged, matching the other uncataloged variants, rather than removed.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Part of github/primer#6664 (epic github/primer#6654).
This PR does three related things for the Timeline event stories, all Storybook-only with no consumer-facing behavior change:
data-*attributes.The staged helper
Every
<Timeline.Item>for a cataloged event spreads thedata-*set produced by a single helper,eventDataAttributesFor(scope, type, login?), in a new dedicated filepackages/react/src/Timeline/taxonomy/eventDataAttributes.ts. It looks up the event's category and visibility from that surface's catalog (so the stories stay in sync with the source of truth rather than hand-typing values), resolves the actor as person-or-bot from the login, and returns the attribute set. It replaces the five near-identical inline wrappers the stories used to define.The helper is type-safe: the compiler enforces that the event type is a real leaf of the given surface, and a new surface added to the catalog works with the helper automatically. It stays internal to the Timeline module (not exported from the package), so a future public export or a lift into
Timeline.Itemis a small, contained follow-up.One deliberate hardening over the old inline versions: the helper never emits
data-actor-typefor a structurally actor-less event, even if a login were passed. This changes nothing for the current rows (they already pass no login), verified by a before/after equivalence check showing zero difference across all tagged rows.What each row carries
Per rendered
<li>:data-event-scope,data-event-type(the unscoped leaf),data-event-category,data-event-visibility(defaults toprimary; Issues metadata events carryauditOnly), anddata-actor-type(userorbot, omitted when the row has no actor).Gaps closed (verified against the redesign prototype)
Before tagging, the untagged rows were checked against the redesign prototype (github/prototyping, the source the taxonomy was ported from). The prototype confirmed that most untagged rows are intentional exclusions, not gaps: the Secret Scanning delegated-bypass flow, the Secret Scanning dismissal-cancelled event, and the Issues "marked/unmarked as canonical/duplicate" variants are deliberately not modeled as distinct events, so they stay untagged (their inline comments now say so). That left three real changes:
reportedleaf to Secret Scanning (categoryfindings) and tagged the "reported this secret" event, which is a real user-facing event that previously had no leaf. Also corrected a misleading comment:validity_changedis the token-verification event, not the report event.user, which is wrong for filtering automated versus human activity. It now resolves tobot, which flips exactly four Secret Scanning rows (the detection event and the three automated validity rows). A distinctsystemactor type is a possible future refinement.Testing
Validated with the repo's own gates: prettier, eslint, and type-check (15/15) all pass with zero new errors. The taxonomy test suite (39 tests) passes, including new coverage for the helper: person-versus-bot resolution, the omitted-actor case,
auditOnlypreservation, the actor-less hardening, and category derivation. Each surface was rendered headlessly to confirm the expected attributes, and a before/after equivalence check confirmed the staging refactor changed no attributes and the gap-closing changes moved only the expected rows.These files stay out of
Timeline.docs.jsonandbuild.tsby design.