Files
zooqueen 507f6165dc Rebuild the Convex example from the side of the merge that was current
The merge 26a9531 ("merge: upstream/main (sync, brand preserved)") took a
branded 817-line example and an 1196-line upstream rewrite of the same file
and interleaved them. Test bodies ended up under the wrong test names, an
afterEach landed inside a test body, and orphaned statements sat at top level
after a closing paren. Neither example.test.ts nor example.ts parsed. Only
the test file failed the unit gate, because example.ts is not a test suite --
it is the module the suite drives, so its damage showed up as a suite that
could not run rather than as an error of its own.

Both files are restored from the upstream side, which is the one that moved:
our side of the merge contributed only the brand rename, while upstream had
reworked feature flags into local evaluation (queries) with remote evaluation
split off into separate actions. That is what the shipped client does today,
so the upstream side is the one that describes it. The rename is reapplied on
top -- POSTHOG_ to INSIGHTS_, posthog-node to insights-node, components.posthog
to components.insights, PostHog to Insights.

Restoring the pair also gives example.ts back the testThrowError,
testEvaluateFlag, testEvaluateFlagPayload and testEvaluateAllFlags exports
that the scramble had dropped while App.tsx was still calling them.

Two things did not survive as-is. Events now post to ${host}/v1/e, not the
/batch/ route the tests were written against, so the helper that picks event
calls out of the fetch log matched nothing and every capture, identify and
captureException assertion read an empty event; the path is now a named
constant. And upstream had no groupIdentify or alias wrappers, so taking its
example.ts wholesale would have left the component's handlers for both with
no end-to-end coverage -- they are restored from our pre-merge side, moved to
the deterministic scheduler helper and the INSIGHTS_PROJECT_TOKEN the
component actually reads, plus a case for the group-derived distinct_id
fallback that nothing else exercised.

Verified: packages/convex pnpm test:unit completes in ~5s, 8 suites and 151
tests passing, where before the suite could not be parsed. Component coverage
rises to 84.65% of statements and 100% of functions. Repo-wide pnpm build is
34/34. No occurrence of the upstream brand remains in either file.
2026-08-12 20:32:13 -07:00
..

Example app — Convex backend

This is a minimal example showing how to use the @hanzo/convex component.

Files

  • convex.config.ts — Registers the Insights component
  • insights.ts — Initializes the Insights client
  • example.ts — A mutation that captures an event via insights.capture
  • schema.ts — Example app schema (empty for this demo)