Skip to content

fix(ai): allow public audience queries - #654

Open
sanskritisingh245 wants to merge 1 commit into
databuddy-analytics:mainfrom
sanskritisingh245:fix/public-audience-queries
Open

fix(ai): allow public audience queries#654
sanskritisingh245 wants to merge 1 commit into
databuddy-analytics:mainfrom
sanskritisingh245:fix/public-audience-queries

Conversation

@sanskritisingh245

@sanskritisingh245 sanskritisingh245 commented Aug 21, 2026

Copy link
Copy Markdown

Description

Fixes the public demo Audience tab failing with a 401 error.

The Audience tab requests timezone, language, browser_versions, and screen_resolution together with other public query types. These query types were missing from PUBLIC_QUERY_TYPES, causing the entire unauthenticated query batch to be rejected.

This change adds those query types to the public allowlist and adds test coverage for the public Audience queries.

Slice

Checklist
  • This branch started from current main and does not include another unmerged PR unless it is named above.
  • This is one independently reviewable slice; unrelated cleanup or refactors are in separate PRs.
  • Checked open PRs for overlapping files, contracts, schemas, or deployment configuration and made any dependency explicit.
  • Added tests for the new public Audience query types.
  • Verified the fix with unit tests and type checking.
  • Verified the unauthenticated /demo/<website-id>/audience flow in the browser.

Summary by cubic

Allows unauthenticated Audience queries in the public demo by allowlisting missing types. Previously, batching Audience queries with timezone, language, browser_versions, and screen_resolution triggered a 401; these types are now public-readable so /demo//audience loads as expected. Addresses #650.

  • Review notes
    • Adds timezone, language, browser_versions, and screen_resolution to PUBLIC_QUERY_TYPES in packages/ai/src/query/builders/index.ts.
    • Extends public access tests to cover Audience queries in packages/ai/src/query/builders/public-access.test.ts.

Written for commit 79f2d1e. Summary will update on new commits.

Review in cubic

@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

@sanskritisingh245 is attempting to deploy a commit to the Databuddy OSS Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – dashboard August 21, 2026 17:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – documentation August 21, 2026 17:02 Inactive
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
dashboard Skipped Skipped Aug 21, 2026 5:02pm
documentation Skipped Skipped Aug 21, 2026 5:02pm

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1575bc87-e61f-4fa3-ae38-8d843ca92eb2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes unauthenticated Audience queries for public websites by adding four existing query types to the public allowlist.

  • Allows timezone, language, browser_versions, and screen_resolution queries for public websites.
  • Extends public-access tests to cover the Audience query family.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable correctness or security issues identified.

Public access remains restricted to websites marked public, every query in a batch must be allowlisted, and the newly enabled builders retain mandatory website-level query scoping.

Important Files Changed

Filename Overview
packages/ai/src/query/builders/index.ts Adds four existing, website-scoped Audience builders to the public query allowlist without weakening private-website authorization.
packages/ai/src/query/builders/public-access.test.ts Extends allowlist coverage to assert that all four public Audience query types are marked public-readable.

Reviews (1): Last reviewed commit: "fix(ai): allow public audience queries" | Re-trigger Greptile

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.

1 participant