Timeline: tag event stories with taxonomy data-* and split the taxonomy into core and GitHub layers - #8216
Conversation
|
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
…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
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>
Separate the internal Timeline taxonomy module into a product-agnostic core and a GitHub-specific layer. The core (taxonomy/core) holds the generic data-* schema, the serializer, and a new createEventDataAttributesFor factory. The GitHub layer (taxonomy/github) holds the concrete surfaces, category model, per-surface event catalogs, actor-classification rule, and the bound eventDataAttributesFor helper, which is now a one-line instantiation of the core factory. The emitted data-* attributes stay byte-identical, the taxonomy barrel keeps the same external symbols, and the module remains internal (no public export, no changeset).
b250250 to
d080c50
Compare
Address code-review nits on the taxonomy core/github split, all comment and type only with no behavior change. Drop the now-redundant `as EventTaxonomyEntry` cast in the core factory (the generic catalog constraint already resolves the entry type). Declare the factory's projector signature once by inferring the function's return type from its fully-typed arrow instead of repeating the annotation. Reword the core serializer docs so they describe serializing an already-projected input rather than modeling the taxonomy axes. Call the taxonomy barrel a module entry point rather than a public one, since it stays internal. Give the GitHub catalogs file a header that names the per-surface event catalogs it holds so the filename and contents read consistently.
Flow the stranded word in the core serializer module header so the sentence about the GitHub-specific values reads on continuous lines. Comment only, no code or behavior change.
Part of github/primer#6664 (epic github/primer#6654). Everything here is internal to the Timeline module and Storybook-only: there is no consumer-facing change, nothing is added to the package's public exports, and there is no changeset.
This PR does two things. It tags the five Timeline surface story sets (License Compliance, Code Scanning, Dependabot, Secret Scanning, Issues) with the taxonomy data-* attributes through one shared helper, and it organizes the taxonomy folder into two clearly separated layers: a generic core that any product could reuse, and a GitHub-specific layer that holds GitHub's own values. The taxonomy folder encodes GitHub product knowledge (which surfaces are security alerts, the per-surface event catalogs, which logins are bots), and the team agreed that Primer should own the generic data-* schema and its serializer while the GitHub-specific values live in a wrapper that can eventually move into github-ui. This split draws that line now, while the module is still internal, so the later move is a small, contained step.
The two layers
What each row carries
Every event row spreads the data-* set produced by eventDataAttributesFor(scope, type, login?): data-event-scope, data-event-type (the unscoped leaf), data-event-category and data-event-visibility (both read from that surface's catalog, so the stories stay in sync with the source of truth instead of hand-typing values), and data-actor-type (user or bot, resolved from the login and omitted when the row has no actor). The helper is type-safe: the compiler enforces that the event type is a real leaf of the given surface, and it never emits data-actor-type for a structurally actor-less event even if a login is passed.
Behaviour is unchanged
Testing
The repo's own gates pass: prettier, eslint with zero warnings allowed, and type-check. The taxonomy tests pass, including new core tests for the serializer and the factory (person-versus-bot resolution, the omitted-actor case, the actor-less suppression, auditOnly pass-through, and category derivation from the catalog) alongside the moved surface tests. A render-and-diff equivalence check across every tagged row confirmed the reorganization changed no attributes.