Skip to content

feat(analytics): report AI provider kinds and the last AI chat in the usage report - #3853

Closed
datlechin wants to merge 2 commits into
mainfrom
feat/heartbeat-ai-usage
Closed

datlechin wants to merge 2 commits into
mainfrom
feat/heartbeat-ai-usage

Conversation

@datlechin

@datlechin datlechin commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The daily usage report (heartbeat) gains two fields, so the share of active Macs that use AI can be measured before a hosted AI add-on is built:
    • ai_providers: the kinds of AI provider set up while AI is on, for example ["claude", "ollama"]. Kinds only, never a name, model, endpoint or key. Omitted when AI is off or has no provider.
    • ai_chat_sent_at: when the user last sent an AI chat message on this Mac, set in AIChatViewModel.startStreaming() once the connection's AI policy has let the message through. Overwritten on every message, unlike the write-once activation timestamps.
  • first_query_executed_at lost its only caller when DatabaseManager.execute(query:) was removed in fix(structure): save schema changes on the editing tab's own connection (#2015) #2016, so it has stayed nil on every Mac since that change (2026-08-04): 11 of 22,387 heartbeats in the last 7 days carried it, against 21,101 with connection_succeeded_at. A successful editor run marks it again in MainContentCoordinator.recordHistory.
  • The server side is TableProApp/license#118, which adds the two columns. An older server drops unknown keys, so the order of deploys does not matter.

Test plan

  • verify.sh package TableProCore for TableProAnalyticsTests: 11 passed, including the new AnalyticsAIUsageFieldTests (snake_case keys, omitted when nil, protocol defaults)
  • verify.sh test MacAnalyticsProviderTests FirstQueryAnalyticsTests: 9 passed. FirstQueryAnalyticsTests fails on main: a successful editor run leaves firstQueryExecutedAt nil
  • verify.sh lint on every changed Swift file: 0 violations

… usage report

The daily heartbeat now carries ai_providers, the kinds of AI provider set up
while AI is on (never a name, model, endpoint or key), and ai_chat_sent_at,
when the user last sent an AI chat message. Together they say how many active
Macs use AI, which a hosted AI add-on depends on.

The first-query timestamp had no caller since DatabaseManager.execute(query:)
was removed, so it stayed nil on every Mac. A successful editor run marks it
again, where its history is recorded.
@datlechin datlechin closed this Oct 26, 2026
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