Skip to content

feat: 馃毀 opt-in telemetry endpoint for the AI plugin - #5180

Draft
sorensensig wants to merge 3 commits into
digdir:test-ai-registryfrom
sorensensig:feat/ai-telemetry-endpoint
Draft

feat: 馃毀 opt-in telemetry endpoint for the AI plugin#5180
sorensensig wants to merge 3 commits into
digdir:test-ai-registryfrom
sorensensig:feat/ai-telemetry-endpoint

Conversation

@sorensensig

Copy link
Copy Markdown
Contributor

Part of #5166 (AI-readiness), the receiving side of the plugin's opt-in telemetry. Independent of the twin-registry stack: branches off main and can merge in any order.

  • POST /api/plugin-telemetry, a resource route following the /api/consent pattern
  • accepts only the aggregate shape the plugin's /ds-telemetry command builds: install id, plugin version, lookup counts (which contracts agents fetch and whether they were found), guard-denial counts
  • strict allowlist validation: any unknown field anywhere rejects the whole request, so the endpoint cannot receive code, prompts or file paths even from a malicious client; row types are limited to primitives; 32KB body cap; no cookies, no auth
  • accepted aggregates are written to the application log as one plugin-telemetry: JSON line; storage or a dashboard is deliberately a follow-up decision for the team
  • plugin side is consent-first and off by default (designsystemet 0.4.0: opt-in telemetry with first-run consent聽sorensensig/ai-corner-store#43): data stays local until a user explicitly sends it here

馃毀 Draft: the plugin only gains a send step once this endpoint's final URL exists, so the two land in either order but activate together.

Checks

  • I have read the contribution guidelines
  • I have added a changeset (run pnpm changeset if relevant): not relevant, www app route only

馃 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

鈿狅笍 No Changeset found

Latest commit: 4a5f8cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

POST /api/plugin-telemetry accepts the aggregate the plugin's /ds-telemetry
command builds, validated against a strict allowlist: any unknown field
rejects the request, so the endpoint cannot be talked into storing code,
prompts or paths. No cookies, no auth; 32KB body cap; accepted aggregates go
to the application log as one JSON line. Storage/dashboarding is a follow-up
decision.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sorensensig
sorensensig force-pushed the feat/ai-telemetry-endpoint branch from 01b91f8 to 9f21b21 Compare August 13, 2026 10:25
@mimarz
mimarz changed the base branch from main to test-ai-registry August 13, 2026 12:02
sorensensig and others added 2 commits August 13, 2026 14:47
Review findings: 'period' was allowlisted but never validated (arbitrary
nested content passed), row string fields had no length caps (one query
field could carry the whole 32KB), rows accepted arrays and empty objects,
and the body cap measured UTF-16 length rather than bytes. Every field now
has a per-field validator (bounded strings, bounded integer counts, real
booleans), rows require their identifying field, and the cap checks
Content-Length first and encoded bytes after.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.

1 participant