Skip to content

Add Timeline event taxonomy source module#8180

Draft
janmaarten-a11y wants to merge 5 commits into
mainfrom
timeline-event-taxonomy-source
Draft

Add Timeline event taxonomy source module#8180
janmaarten-a11y wants to merge 5 commits into
mainfrom
timeline-event-taxonomy-source

Conversation

@janmaarten-a11y

@janmaarten-a11y janmaarten-a11y commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What

Moves the finished Timeline event categorization model from the Timeline redesign prototype (github/prototyping) into the Timeline package at packages/react/src/Timeline/taxonomy/. It is the working code behind the taxonomy docs relocated in github/primer#6888.

Every consumer reads from this one catalog instead of a hand-maintained per-surface list:

  • the data-* event contract (github/primer#6664), produced by toEventDataAttributes()
  • the flattened storage keys, produced by qualifyEventType / unqualifyEventType
  • grouping events by category for story and menu order, produced by eventTypesByCategory

Files

  • surfaces.ts: the list of Timeline surfaces plus SECURITY_ALERT_SURFACES. This is the plain-data part of the prototype's TimelineSurfaceContext; the React context and the rendering checks stay in the prototype.
  • actorType.ts: the user | bot split plus actorTypeForLogin.
  • eventCategories.ts: the category model (ToggleableCategory, SURFACE_CATEGORIES, surfacesForCategory, isToggleableCategory). Structure only: no menu labels, descriptions, or icons.
  • eventTaxonomy.ts: the five per-surface catalogs (License Compliance, Secret Scanning, Code Scanning, Dependabot, Issues) and the functions that read from them.
  • eventTaxonomy.test.ts: 32 tests. They check that every event's category is one its surface actually offers, that the key conversions convert back cleanly (including the issue_type_* events whose names start with the issue prefix), and that each surface marks actors correctly. They also cover actorTypeForLogin, surfacesForCategory, and isSecurityAlertSurface.
  • index.ts: re-exports the module's parts for local imports.

Scope

  • Internal only. Nothing is added to the public @primer/react exports yet, so there is no public API change and no changeset. The functions can join the public API later, once the model is agreed on.
  • No consumers changed. The per-surface Timeline stories and the Phase 3 Timeline Playground (github/primer#6664) can move to toEventDataAttributes() in later PRs. This PR adds the source only.
  • One small eslint.config.mjs override turns off camelcase for eventTaxonomy.ts. Its keys are REST event.type values, which are snake_case wire names rather than code identifiers. This follows the repo's existing per-file override pattern.

Validation

  • vitest run …/eventTaxonomy.test.ts: 32 passing
  • eslint and tsc --noEmit: clean

Integration testing

This change does not touch the public @primer/react surface, so the github-ui integration run has nothing to test:

  • The module is not re-exported from Timeline/index.ts or the package root, and it cannot be reached from any published entry point (., ./experimental, ./next, ./deprecated, ./test-helpers).
  • The public exports test (src/__tests__/exports.test.ts) passes with no taxonomy names in it, so the published API is unchanged from main.
  • The eslint.config.mjs override is dev tooling and never ships.

github-ui cannot import this module today, so nothing it uses changes. The integration checks can pass as-is, or take the integration-tests: skipped manually label for that reason. Full integration testing belongs to the later PR that adds these functions to the public API.

Provenance

Ported from github/prototyping src/packages/conversation/timeline.

Companion docs:

  • github/primer#6888.

Related:

Port the event categorization model from the Timeline redesign prototype
(github/prototyping) into the Timeline component package. Adds the surface,
actor-type, category, and event catalogs plus the projections that derive the
data-* event contract (github/primer#6654), the flattened registry keys, and
by-category grouping. Includes the catalog-fit test sweep (22 cases).

The module is internal-only for now: nothing joins the public @primer/react
export surface until the model is ratified. It gives the Phase 3 Timeline
Playground (github/primer#6664) and the per-surface Timeline stories one source
of truth to consume instead of hand-maintained per-surface lists.
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f580b33

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. If this doesn't work, you can also use the original workflow here. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 17, 2026
@github-actions
github-actions Bot temporarily deployed to storybook-preview-8180 July 17, 2026 03:40 Inactive
@janmaarten-a11y janmaarten-a11y added the skip changeset This change does not need a changelog label Jul 17, 2026
Keep the module to structural classification only. Remove the prototype
Viewing-menu and preferences presentation that no taxonomy logic or test uses:
refinements (hide resolved/outdated), category display metadata (CATEGORY_META
labels/descriptions/icons), per-surface menu microcopy, and surface labels. This
also drops the @primer/octicons-react import, so the taxonomy no longer pulls in
icons.

Generalize doc comments that pointed at prototype-internal files (the renderer
bookend helper, the flattened event-type union, session-local diffs), so the
module reads as standalone and canonical while keeping every citation to real
github-ui and dotcom source.
The catalog leaves, DELTA notes, source-of-truth notes, and one test
description framed the taxonomy as "the prototype's." Reword to canonical
phrasing so the module reads as a standalone Timeline source. Preserve all
delta counts, actor facts, and real source citations. Provenance banners and
the surfaces.ts extraction note stay as-is.
@github-actions
github-actions Bot requested a deployment to storybook-preview-8180 July 17, 2026 03:55 Abandoned
…ed helpers

Review pass finding: unqualifyEventType stripped the scope prefix whenever the
flattened key started with it, which corrupted the three raw issue leaves whose
names begin with the `issue_` scope token (issue_type_added / issue_type_removed
/ issue_type_changed became type_added etc.). This broke the documented
"already-unscoped key untouched" guarantee.

Strip the prefix only when the remainder is a real leaf of the scope's catalog,
so raw issue leaves pass through unchanged while a genuinely qualified key still
reverses. Add a regression test plus an Issue-leaf round-trip test.

Also add coverage for three exported helpers that had branching logic but no
direct tests: actorTypeForLogin, surfacesForCategory, isSecurityAlertSurface.
@github-actions
github-actions Bot temporarily deployed to storybook-preview-8180 July 17, 2026 04:04 Inactive
@janmaarten-a11y janmaarten-a11y added integration-tests: skipped manually Changes in this PR do not require an integration test and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jul 17, 2026
…y epic

The data-* event contract (data-event-type / data-event-scope / data-actor-type)
is owned by github/primer#6664 (Phase 3), whose "category taxonomy and data-*
tagging" section is the actual deliverable. github/primer#6654 is the broad
parity epic, not the contract. Fix the citations in all six banners plus the
toEventDataAttributes serializer note, and relabel #6654 as the parent epic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant