Files
Sean Oliver f0f2b57939 test(telemetry): cover every ad click id in first-touch attribution (#51774)
## Problem

The ad click ids we send to PostHog for first-touch attribution have no
direct tests. A typo in a param name (say `getParam('opref')`) would
silently drop that click id and CI would stay green. Also, nothing in CI
ran `packages/common` tests at all, apart from `sentry.test.ts`.
GROWTH-1326.

## Solution

- First-touch click ids are now one exported list,
`FIRST_TOUCH_CLICK_ID_KEYS`, instead of 11 hand-written `getParam`
lines. Same ids, same output.
- New `telemetry.test.ts` checks that list equals `CLICK_ID_KEYS` plus
`bfcid`, and that every id in it comes back from
`getFirstTouchAttributionProps`.
- `first-referrer-cookie.test.ts` checks `buildFirstReferrerData`
extracts every `CLICK_ID_KEYS` entry, and that `bfcid` stays out of that
pre-consent list.
- Added a `test` script to `packages/common` and a `pnpm --filter common
test` step to `library-tests.yml`, which already triggers on
`packages/common/**`.

## Review instructions

1. Check the Library checks job runs the common tests (13 files).
2. Add a made-up id to `FIRST_TOUCH_CLICK_ID_KEYS` only, then run `pnpm
--filter common test`. It fails.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-09 09:37:28 -08:00

62 lines
1.9 KiB
YAML

name: Library checks
on:
# No branch filter: a stacked pull request targets the branch below it, and
# skipping its checks until the stack reaches master defeats the point.
pull_request:
paths:
- 'apps/ui-library/**'
- 'blocks/vue/**'
- 'packages/ui/**'
- 'packages/ui-patterns/**'
- 'packages/common/**'
- 'packages/icons/**'
- 'packages/shared-data/**'
- 'packages/api-types/**'
- 'packages/config/**'
- 'packages/tsconfig/**'
- 'packages/eslint-config-supabase/**'
- 'patches/**'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'package.json'
- '.github/workflows/library-tests.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
run_install: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm --filter common test
- run: pnpm --filter library test
- run: pnpm --filter library build:registry
- name: Check generated registry
run: |
registry_changes="$(git status --porcelain --untracked-files=all -- apps/ui-library/public/r apps/ui-library/__registry__)"
if [ -n "$registry_changes" ]; then
printf '%s\n' "$registry_changes"
echo 'Run pnpm --filter library build:registry and commit the generated registry files.'
exit 1
fi
- run: pnpm --filter library build