Skip to content

feat: add audience collection mode - #55

Merged
francoischalifour merged 8 commits into
mainfrom
feat/audience-collection-pr
Nov 9, 2026
Merged

francoischalifour merged 8 commits into
mainfrom
feat/audience-collection-pr

Conversation

@francoischalifour

@francoischalifour francoischalifour commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

What

Add immutable mode: :audience for scalar, hash, and batch tracking. Audience events send only mode, event, timestamp, and properties; per-event options and hash or batch fields cannot override the client's mode. identify and alias are ignored (with a stderr warning when debug is enabled), and distinct_id is not required. Caller properties pass through unchanged. Product mode remains the default, and an invalid mode raises ConfigurationError before a transport is created.

The HTTPX origin: fix that was originally part of this PR is now in #57.

Why

Server callers need restricted event collection without product identifiers. Custom properties remain the application's responsibility, and server HTTP context does not represent individual visitors.

Checklist

  • Public client specs cover scalar, hash, and batch audience payloads, mode enforcement over per-event overrides, identity-call suppression, whole-batch validation, retries, and unchanged product behavior.
  • Public signatures (RBS/RBI), README setup guidance, and changelog updated.

Comment thread lib/altertable/adapters.rb Outdated
timeout: { operation_timeout: @timeout },
headers: @headers,
base_url: @base_url
origin: @base_url

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is surprising

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted. It fixed an existing HTTPX invalid URI: /track failure that also affects product mode on main, so it belongs in a separate fix(httpx) PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split out into #57 with a loopback test.

Server requests carry no visitor page context, cookies, or ambient
credentials, so drop URL rewriting, endpoint credential checks, and
transport tests. Caller properties now pass through unchanged.
@francoischalifour

Copy link
Copy Markdown
Member Author

Scope change following the spec update: server-tier audience mode is now only the wire shape (mode, event, timestamp, properties) plus no-op identify/alias. URL sanitization, endpoint credential checks and the audience transport changes are removed; caller properties pass through unchanged.

francoischalifour added a commit that referenced this pull request Nov 9, 2026
Every request through the HTTPX adapter fails on `main` with
`HTTPX::Error: invalid URI: /track` (httpx 1.7.3): the client was
configured with `base_url:`, which httpx does not use to resolve
relative request paths. Configuring it with `origin:` resolves `/track`,
`/identify` and `/alias` against the base URL, like the Faraday and
Net::HTTP adapters.

Adds a loopback delivery spec that posts a real track request through
each adapter; it fails for HTTPX before this change.

Split out of #55, where it was flagged as
unrelated to audience mode.
@francoischalifour
francoischalifour merged commit 7ecb88c into main Nov 9, 2026
7 checks passed
@francoischalifour
francoischalifour deleted the feat/audience-collection-pr branch November 9, 2026 14:12
@francoischalifour
francoischalifour restored the feat/audience-collection-pr branch November 9, 2026 14:16
@francoischalifour
francoischalifour deleted the feat/audience-collection-pr branch November 9, 2026 14:17
francoischalifour added a commit that referenced this pull request Nov 9, 2026
## What

Deprecate the `environment` option. It is still accepted (with a
debug-mode warning) and the public default constant is retained, but it
is ignored for routing and never sent: request payloads no longer
include an `environment` field for scalar, hash, batch, identify, or
alias calls. Nested business properties named `environment` are
preserved. README, changelog, and RBS/RBI typings mark the option as
deprecated.

## Why

An environment-bound Product Analytics API key now selects the
destination. Callers using unbound legacy keys must replace them before
upgrading.

Stacked on #55 (audience collection); this PR contains only the
environment slice.

## Checklist

- [x] Client specs verify the deprecated option is accepted and
`environment` is omitted from scalar, hash, batch, identify, and alias
requests while nested properties are preserved.
- [x] Audience and product specs updated for the removed field.
- [x] Changelog and README updated; the compatibility impact (unbound
keys require migration) is noted in the changelog.
francoischalifour pushed a commit that referenced this pull request Nov 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.4.0](altertable/v1.3.0...altertable/v1.4.0)
(2026-11-09)


### Features

* add audience collection mode
([#55](#55))
([7ecb88c](7ecb88c))
* deprecate analytics environment routing
([#56](#56))
([020e3bf](020e3bf))


### Bug Fixes

* **httpx:** resolve request paths against the base URL
([#57](#57))
([f3473fb](f3473fb))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants