fix(cockpit): Spec 1C smoke-test fixes (nx run, env, hydration, posthog)#357
Merged
Conversation
Issues found during Chrome MCP local smoke and resolved iteratively. End-to-end verified: cockpit_did flows from React shell → iframe URL params → @ngaf/ cockpit-telemetry → PostHog with matching distinct_id. Both `cockpit:recipe_opened` and `cockpit:transport_connected` confirmed in PostHog. apps/cockpit/project.json + scripts/serve-example.ts 14 serve-* targets and the serve-example script invoked `nx serve <project>:serve:cockpit` which Nx parses as a project name and fails. Switched to `nx run <project>:serve:cockpit`. cockpit/<cat>/<cap>/angular/project.json (31 examples) cockpit build configuration now mirrors the example's `development` configuration (sourceMap, optimization:false, env file replacement) + overrides browser to main.cockpit.ts. The earlier copy of production settings triggered a CSS optimizer issue on the @ngaf/example-layouts imported tailwind layers when consumed via the cockpit iframe. apps/cockpit/src/lib/analytics/properties.ts(+spec) Drop the doNotTrack guard. The website's shouldCaptureAnalytics doesn't consider DNT and we want consistent guard semantics across both shells. DNT is a strong privacy signal for third-party tracking; cockpit shell analytics is first-party developer-funnel telemetry, governed by the captureLocal flag + localhost gate. apps/cockpit/instrumentation-client.ts Stay aligned with the updated shouldCaptureAnalytics signature. apps/cockpit/src/components/analytics-bootstrap.tsx (new) + layout.tsx Next.js's instrumentation-client.ts is loaded but its module body doesn't execute reliably in turbopack dev mode on this app layout. Added a client-side bootstrap component mounted from the root layout that calls posthog.init() in useEffect. Idempotent — re-renders no-op on `posthog.__loaded`. apps/cockpit/src/components/run-mode/run-mode.tsx Made RunMode a client component. The iframe src is now computed in useEffect rather than during render so getCockpitSessionId() (which generates a fresh UUID per process) doesn't produce different values between SSR and CSR. Eliminates the hydration warning that was visible on every cockpit page load. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Iteratively-discovered fixes from a local Chrome MCP smoke test against the merged Spec 1C work. End-to-end verified — `cockpit_did` propagates from the React shell through iframe URL params to `@ngaf/cockpit-telemetry` inside the Angular example, and both `cockpit:recipe_opened` (shell) and `cockpit:transport_connected` (iframe) arrive in PostHog with matching `distinct_id`.
Bugs fixed
What was verified end-to-end
`docs/superpowers/specs/gtm/2026-05-15-analytics-foundation-1c-cockpit-instrumentation-design.md` Phase 3.3 (Chrome MCP smoke) and the AGENT_LIFECYCLE registry path (PR #351) are now confirmed working in dev.
Test plan
🤖 Generated with Claude Code