[Nx graph] Split platform-activity-tracking into api (facade, 24 dependents) + impl (pipeline, app-registered) so impl churn stops invalidating a third of the graph #740

Closed
opened 2026-07-20 18:24:07 +00:00 by spikerj · 1 comment
Owner

Problem

platform-activity-tracking has 24 direct / 33 transitive dependents — the widest fan-in in the workspace (it's where #733 detonated). But those 24 dependents only ever call the tracking surface: graph-wide tally shows 257× .track(, 22× .withDomain(, 12× .trackOnce(, 10× .trackDebounced(, 5× .trackToggle( — and 86 of 89 import statements pull only ActivityTrackingService. Nothing outside the lib touches totalTracked, flush(), the manifest machinery, the auth-gate/beacon tokens, or NavigationActivityService (app shell only).

Result: every change to the flush pipeline, manifest fetch, or unload beacon invalidates lint/test/typecheck for a third of the workspace, and pulls @spikersoft/environment + platform-loading into all 24 dependents' transitive graphs (that's most of platform-loading's 2-direct/34-transitive spread).

Change

Split into two layer:platform libs:

  • platform-activity-tracking-api — abstract ActivityTrackingService facade (track/trackOnce/trackDebounced/trackToggle + concrete withDomain), DomainTracker type, TrackDirective. Tree-shakable no-op default (house default-open style: tests/Storybook/standalone keep working with zero providers). Takes over the existing @spikersoft/platform-activity-tracking alias — the 86 import sites in 24 dependent libs need no changes.
  • platform-activity-tracking-impl (new alias @spikersoft/platform-activity-tracking-impl) — the real pipeline: queue/flush/beacon service, ActivityManifestService (its #733 imperative-promise carve-out moves verbatim — background fetches stay promises, never resource()), ACTIVITY_AUTH_GATE / ACTIVITY_BEACON_HEADERS tokens, NavigationActivityService, and provideActivityTracking() binding the facade to the impl. Imported only by the app (main.ts registration).

Outcome

Impl churn invalidates impl + spikersoft instead of 24+ projects; environment/platform-loading leave the dependents' transitive closure. Blast radius to be re-verified from the fresh graph after merge.

## Problem `platform-activity-tracking` has **24 direct / 33 transitive dependents** — the widest fan-in in the workspace (it's where #733 detonated). But those 24 dependents only ever call the tracking *surface*: graph-wide tally shows 257× `.track(`, 22× `.withDomain(`, 12× `.trackOnce(`, 10× `.trackDebounced(`, 5× `.trackToggle(` — and **86 of 89 import statements pull only `ActivityTrackingService`**. Nothing outside the lib touches `totalTracked`, `flush()`, the manifest machinery, the auth-gate/beacon tokens, or `NavigationActivityService` (app shell only). Result: every change to the flush pipeline, manifest fetch, or unload beacon invalidates lint/test/typecheck for a third of the workspace, and pulls `@spikersoft/environment` + `platform-loading` into all 24 dependents' transitive graphs (that's most of platform-loading's 2-direct/34-transitive spread). ## Change Split into two `layer:platform` libs: - **`platform-activity-tracking-api`** — abstract `ActivityTrackingService` facade (`track`/`trackOnce`/`trackDebounced`/`trackToggle` + concrete `withDomain`), `DomainTracker` type, `TrackDirective`. Tree-shakable no-op default (house default-open style: tests/Storybook/standalone keep working with zero providers). **Takes over the existing `@spikersoft/platform-activity-tracking` alias — the 86 import sites in 24 dependent libs need no changes.** - **`platform-activity-tracking-impl`** (new alias `@spikersoft/platform-activity-tracking-impl`) — the real pipeline: queue/flush/beacon service, `ActivityManifestService` (its #733 imperative-promise carve-out moves verbatim — background fetches stay promises, never `resource()`), `ACTIVITY_AUTH_GATE` / `ACTIVITY_BEACON_HEADERS` tokens, `NavigationActivityService`, and `provideActivityTracking()` binding the facade to the impl. Imported **only** by the app (`main.ts` registration). ## Outcome Impl churn invalidates `impl + spikersoft` instead of 24+ projects; `environment`/`platform-loading` leave the dependents' transitive closure. Blast radius to be re-verified from the fresh graph after merge.
Author
Owner

Resolved in spikersoft-angular PR #470 (merged to master). Facade lives in platform-activity-tracking-api (keeps the un-suffixed alias — 86 import sites untouched); pipeline in platform-activity-tracking-impl, bound once in main.ts via provideActivityTracking(). Graph-verified post-split: impl-only churn affects {impl, spikersoft, spikersoft-web} instead of 25+ projects. Closing.

Resolved in spikersoft-angular PR #470 (merged to `master`). Facade lives in `platform-activity-tracking-api` (keeps the un-suffixed alias — 86 import sites untouched); pipeline in `platform-activity-tracking-impl`, bound once in `main.ts` via `provideActivityTracking()`. Graph-verified post-split: impl-only churn affects {impl, spikersoft, spikersoft-web} instead of 25+ projects. Closing.
Sign in to join this conversation.