Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

fix(tracking): report OM events to the OpenDesign project

罗高97490516dc42
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index c4458300..634a2bc7 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -163,7 +163,7 @@ flowchart LR
当前交付标准:连接可验证、模板可定位、工程可继续编辑、预览与源文件一致、导出存在真实文件、检查结果有证据。相关实现由 `tests/`、`npm run test:studio` 的原生单元/DOM 与宿主回归、类型检查、设计检查和按需浏览器验证覆盖;没有执行的检查不能记为通过。
-The runtime includes a default-on, explicit-event tracking package shared by MCP and Studio. A persistent user preference and environment overrides can disable collection for the whole installation. Studio submits allowlisted events to the local service; Node adds a random installation identity before asynchronous ingestion into the isolated OpenMotion PostHog project. That project enriches coarse country/region/timezone and then discards raw IP addresses. The implementation covers tool results, selected domain operations and selected Studio interactions; it does not establish a product analytics baseline or implement every proposed event. See [tracking configuration, privacy and coverage](../../tracking/README.md).
+The runtime includes a default-on, explicit-event tracking package shared by MCP and Studio. A persistent user preference and environment overrides can disable collection for the whole installation. Studio submits allowlisted events to the local service; Node adds a random installation identity before asynchronous ingestion into the existing OpenDesign PostHog project. OM events carry product=openmotion; queries must distinguish products. An OM-only transformation preserves coarse country/region/timezone and removes raw IP and precise location after the existing GeoIP transformation, without changing other OpenDesign events or global project settings. The implementation covers tool results, selected domain operations and selected Studio interactions; it does not establish a product analytics baseline or implement every proposed event. See [tracking configuration, privacy and coverage](../../tracking/README.md).
The following product measures still require agreed observation windows and validated evidence:
diff --git a/shared/tracking-config.json b/shared/tracking-config.json
index d9e40f8f..20939264 100644
--- a/shared/tracking-config.json
+++ b/shared/tracking-config.json
@@ -1,6 +1,6 @@
{
- "projectId": 722078,
+ "projectId": 420348,
"host": "https://us.i.posthog.com",
- "token": "phc_km8e76b2uwbAEEZ8wF3pmxSQ9b5s9izFsaZsktie3Qsq",
+ "token": "phc_u5dHWkwdqN626opkbbjDKk7xNzxR2UsJbdQqx3DncbjU",
"geoip": true
}
diff --git a/tests/source-install.test.ts b/tests/source-install.test.ts
index 7019b13b..2ce0cc91 100644
--- a/tests/source-install.test.ts
+++ b/tests/source-install.test.ts
@@ -20,7 +20,7 @@ test('public Motion sources contain no company endpoints, workstation paths or e
if (file === 'shared/tracking-config.json') {
const config = JSON.parse(content);
assert.deepEqual(Object.keys(config).sort(), ['geoip', 'host', 'projectId', 'token']);
- assert.equal(config.projectId, 722078); assert.equal(config.host, 'https://us.i.posthog.com');
+ assert.equal(config.projectId, 420348); assert.equal(config.host, 'https://us.i.posthog.com');
assert.equal(config.geoip, true); assert.match(config.token, /^phc_[A-Za-z0-9_]+$/);
} else assert(!/phc_[A-Za-z0-9]{20,}/.test(content), 'Embedded upstream ingest identifier in ' + file);
const users = [...content.matchAll(/\/Users\/([\w.-]+)\//g)].map(match => match[1]);
diff --git a/tracking/INTEGRATION.md b/tracking/INTEGRATION.md
index c89ccf05..175b0d44 100644
--- a/tracking/INTEGRATION.md
+++ b/tracking/INTEGRATION.md
@@ -154,8 +154,11 @@ The current installation identity may retain `utm_source`; landing-to-installer
`--source` propagation is separate work and an unknown source remains null. An event
addition must not claim that acquisition plumbing is already implemented.
-GeoIP country/first-level region/geographic timezone are added by the OM PostHog
-receiver before IP discard. Do not add client IP lookups or collect IP in callers.
+Events go to the existing OpenDesign project (420348), with `product=openmotion`.
+Filter OM queries by that property and exclude OM from unrelated shared reports.
+An OM-only receiver transformation preserves coarse GeoIP and removes raw IP and
+precise location after the existing GeoIP transformation; non-OM events are unchanged.
+Do not add client IP lookups or collect IP in callers.
Device timezone is separate from GeoIP timezone; VPN/proxy egress may differ.
See [configuration, privacy and limits](README.md) and [coarse GeoIP](posthog-geoip.hog).
@@ -218,8 +221,8 @@ Keep test-run UUIDs stable for one run and start a fresh UUID for another. Do no
override a user's saved preference or remove their force-off variables to make a
test pass. Use a separately owned test launch; record an intentional opt-out case.
-Exercise the actual action, then query the exact `test_run_id` in the OpenMotion
-PostHog project. A read-authorized connector/account is needed; the distributed
+Exercise the actual action, then query the exact `test_run_id` and `product=openmotion`
+in the OpenDesign PostHog project. A read-authorized connector/account is needed; the distributed
public capture token cannot query events. For example, replace the UUID below:
```sql
diff --git a/tracking/README.md b/tracking/README.md
index 9747ca04..1ea8ff08 100644
--- a/tracking/README.md
+++ b/tracking/README.md
@@ -9,8 +9,10 @@ For new events, start with the [integration guide and agent task template](INTEG
## Reporting and user control
-Reporting is **on by default** using the isolated OpenMotion project. The single
-public, write-only project token and ingestion host are distributed in
+Reporting is **on by default** into the existing OpenDesign project (420348).
+OM events carry `product=openmotion`; OM reports must filter by that property,
+and shared-project reports must distinguish OM from other products. The project's
+public, write-only token and ingestion host are distributed in
`shared/tracking-config.json`; it contains no read/admin credentials and is never
included in the browser bundle. Users do not need to supply a key or opt-in flag.
@@ -31,6 +33,10 @@ For another collector, supply both `OPENMOTION_POSTHOG_HOST` and
collectors default to zero-IP mode; `OPENMOTION_GEOIP=1` requires that collector to
discard IP after enrichment. Never supply a personal `phx_` API key.
+Keep the OM-only receiver transformation active while geo-enabled clients report
+to this shared project. Before removing it, stop OM collection or switch those
+clients to zero-IP mode. Do not revoke the shared OpenDesign token as an OM rollback.
+
Use `OPENMOTION_TRACKING_ENV=test` and a UUID in
`OPENMOTION_TRACKING_TEST_RUN_ID` for isolated ingestion checks; filter these records
out of product dashboards. Normal environments are `production` and `development`.
@@ -56,17 +62,21 @@ a separate change. Unknown source remains null.
Common fields include schema/product/app version, environment, entrypoint/runtime,
platform/architecture, OS/version, runtime locale, device IANA timezone and UTC offset
-(east of UTC is positive). The default project runs [coarse GeoIP](./posthog-geoip.hog)
-before the **Discard client IP data** setting removes the IP from stored events.
-Only country code/name, first-level region code/name and geographic timezone are
-added. No city, postal code, coordinates or person-location updates are generated.
+(east of UTC is positive). After OpenDesign's existing GeoIP transformation, the
+[OM-only transformation](./posthog-geoip.hog) matches `product=openmotion`, derives
+country/first-level region/geographic timezone and removes raw IP, precise GeoIP
+and person-location updates before storage. The transformation has both an event
+filter and a source-code guard; non-OM events pass through unchanged. Existing
+OpenDesign transformations and the project's global IP setting are unchanged.
Lookup failures leave geographic fields unknown. GeoIP describes the observable
network egress; VPNs/proxies can change it. Device timezone is a separate setting.
Network intermediaries still see the connection address. Operators must keep the
-project's IP-discard policy enabled; it is a receiver requirement, not a guarantee
-enforced by a public capture token. Custom zero-IP mode retains the fixed address
-`0.0.0.0`, because a null property is replaced with the request IP. Person profiles,
-autocapture, session replay and upstream engine telemetry are not enabled.
+OM transformation enabled after GeoIP; it is a receiver requirement, not a guarantee
+enforced by a public capture token. The earlier standalone OM project's test data
+is retained and is not migrated or deleted. Custom zero-IP mode retains the fixed address
+`0.0.0.0`, because a null property is replaced with the request IP. OM requests no
+person profiles and emits no autocapture or session replay; other OpenDesign
+producers retain their own settings. Upstream engine telemetry stays disabled.
Runtime and TypeScript event contracts whitelist required fields, enums, UUIDs and
bounded counts. No prompts, messages, source files, URLs, local paths, titles, raw
diff --git a/tracking/posthog-geoip.hog b/tracking/posthog-geoip.hog
index e4287551..2ad31efc 100644
--- a/tracking/posthog-geoip.hog
+++ b/tracking/posthog-geoip.hog
@@ -1,27 +1,39 @@
-// OpenMotion GeoIP: coarse region only. Project IP discard must be enabled.
-if (event.properties?.$geoip_disable or empty(event.properties?.$ip)) {
+// OpenMotion only: enrich coarse location, then remove IP and precise GeoIP.
+if (event.properties?.product != 'openmotion') {
return event
}
-let location := geoipLookup(event.properties.$ip)
-if (not location) {
- return event
-}
-let returnEvent := event
-if (location.country) {
- returnEvent.properties.$geoip_country_code := location.country.isoCode
- returnEvent.properties.$geoip_country_name := location.country.names?.en
-}
-if (location.location) {
- returnEvent.properties.$geoip_time_zone := location.location.timeZone
+let props := {}
+for (let key, value in event.properties) {
+ if (key != '$ip' and key != '$set' and key != '$set_once' and not startsWith(key, '$geoip_')) {
+ props[key] := value
+ }
}
-let regionSet := false
-if (location.subdivisions) {
- for (let index, region in location.subdivisions) {
- if (not regionSet) {
- returnEvent.properties.$geoip_subdivision_1_code := region.isoCode
- returnEvent.properties.$geoip_subdivision_1_name := region.names?.en
- regionSet := true
+props.$geoip_disable := true
+props.$process_person_profile := false
+props.location_source := 'unknown'
+if (not event.properties?.$geoip_disable and not empty(event.properties?.$ip)) {
+ let location := geoipLookup(event.properties.$ip)
+ if (location) {
+ props.location_source := 'geoip'
+ if (location.country) {
+ props.$geoip_country_code := location.country.isoCode
+ props.$geoip_country_name := location.country.names?.en
+ }
+ if (location.location) {
+ props.$geoip_time_zone := location.location.timeZone
+ }
+ let regionSet := false
+ if (location.subdivisions) {
+ for (let index, region in location.subdivisions) {
+ if (not regionSet) {
+ props.$geoip_subdivision_1_code := region.isoCode
+ props.$geoip_subdivision_1_name := region.names?.en
+ regionSet := true
+ }
+ }
}
}
}
+let returnEvent := event
+returnEvent.properties := props
return returnEvent