Repository navigation
feat: scaffold native OpenAnalytics integration for EmDash - #1
Merged
Merged
Conversation
christopherjnelson
marked this pull request as ready for review
September 30, 2026 00:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EmDash administrators need a native plugin that keeps the OpenAnalytics read credential on the server and installs the browser tracker from the site's API-provided installation metadata. This PR establishes that foundation with
@blackswampai/emdash-openanalytics; embedded analytics UI is deferred.Implementation
openAnalytics()descriptor plus the namedcreatePlugin()runtime factory, verified against published EmDash 1.0.1.GET /v1/read/site. The client provides typed contract validation, a five-second timeout, redirect refusal, and safe errors for credentials, permissions, billing compatibility, missing sites, rate limits, and service failures.page:fragmentshook emits a structured async head script with the returned public key and collector URL. Missing/unsafe install data and disabled tracking suppress output; a stable fragment key prevents duplicates.Validation
All 37 tests pass on Node 22 and Node 24, along with typecheck, oxlint, oxfmt, build, package export/runtime metadata verification, artifact credential scanning, and npm package dry run. Frozen-lockfile installation succeeds.
Tests include real HTTP transport and the published EmDash runtime, SQLite adapter, encrypted settings handlers, permission/CSRF enforcement, and fragment renderer. They cover credential redaction, malformed contracts, error classes, self-hosting, configuration changes, missing installation fields, failed revalidation, disabled tracking, and deduplication. An independent GPT-6-Luna Medium reviewer found no unresolved production-code findings.
Initial scope and operating requirements
Connection validation is exposed as a documented server route; a setup button and embedded analytics remain future work. The host must configure
EMDASH_ENCRYPTION_KEYand renderEmDashHeadin the public layout. Installation metadata requires manual revalidation after rotation or origin changes, and statically rendered pages require rebuilding.Approximately 495 production LOC, 720 test LOC, nine source modules, no additional runtime dependencies beyond the EmDash peer, and one OpenAnalytics endpoint.