Add Timeline event taxonomy source module#8180
Conversation
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.
|
|
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.
…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.
…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.
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:
data-*event contract (github/primer#6664), produced bytoEventDataAttributes()qualifyEventType/unqualifyEventTypeeventTypesByCategoryFiles
surfaces.ts: the list of Timeline surfaces plusSECURITY_ALERT_SURFACES. This is the plain-data part of the prototype'sTimelineSurfaceContext; the React context and the rendering checks stay in the prototype.actorType.ts: theuser | botsplit plusactorTypeForLogin.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 theissue_type_*events whose names start with theissueprefix), and that each surface marks actors correctly. They also coveractorTypeForLogin,surfacesForCategory, andisSecurityAlertSurface.index.ts: re-exports the module's parts for local imports.Scope
@primer/reactexports 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.toEventDataAttributes()in later PRs. This PR adds the source only.eslint.config.mjsoverride turns offcamelcaseforeventTaxonomy.ts. Its keys are RESTevent.typevalues, 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 passingeslintandtsc --noEmit: cleanIntegration testing
This change does not touch the public
@primer/reactsurface, so the github-ui integration run has nothing to test:Timeline/index.tsor the package root, and it cannot be reached from any published entry point (.,./experimental,./next,./deprecated,./test-helpers).src/__tests__/exports.test.ts) passes with no taxonomy names in it, so the published API is unchanged frommain.eslint.config.mjsoverride 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 manuallylabel for that reason. Full integration testing belongs to the later PR that adds these functions to the public API.Provenance
Ported from
github/prototypingsrc/packages/conversation/timeline.Companion docs:
Related:
data-*tagging github/primer#6664