Skip to content

feat(diagnostics): expand client log attribute registry - #649

Merged
Quick104 merged 1 commit into
mainfrom
feat/diagnostics-attr-registry-expansion
Aug 15, 2026
Merged

Quick104 merged 1 commit into
mainfrom
feat/diagnostics-attr-registry-expansion

Conversation

@Quick104

@Quick104 Quick104 commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

The Apple and Android clients are gaining substantial diagnostics instrumentation for startup, network, auth, and playback behavior. Those attributes have to be registered here first — this repo is the canonical source for the client diagnostics attribute registry.

This PR is also a bug fix. The Apple client has been emitting four playback attributes that were never registered here:

  • Self-hosted (this collector) silently drops unregistered keys — evidence lost, no error.
  • Hosted (silo-diagnostics) throws unregistered_log_attribute, which becomes a PermanentBundleError and marks the entire report rejected.

Making the canonical registry the superset fixes both.

Changes

Purely additive. No existing key changes type or is removed.

Category New keys
playback session_id, play_method, reason, position_ms
lifecycle phase, duration_ms, outcome, reason, launch_type
network outcome, error_code, attempt

Two type decisions worth reviewing

attrValueType has only attrString and attrInteger. Rather than add type machinery for two keys:

  • position_seconds (float) → position_ms (integer). The Apple emission site converts, clamping non-finite/negative to 0 and saturating at Int.max.
  • cold (bool) → launch_type (string). Values "cold" / "warm".

If you'd rather have a float/bool type in the registry, say so and I'll rework it — this was chosen to keep the collector simple.

Note for reviewers

playback.session_id and network.attempt are valid registry keys but also appear in silo-diagnostics' privacy.ts FORBIDDEN_KEYS. A hosted bundle carrying them fails the privacy_fields check while still processing to ready. Both clients therefore withhold them from hosted bundles; self-hosted reports keep them. That's handled client-side and needs nothing here.

Deployment ordering

This must ship before the clients. Self-hosted servers running the old contract.go will silently drop the new attributes, so the evidence just won't appear in self-hosted reports until they update. No breakage, but worth knowing.

Testing

TestAttrRegistryStaysInSync keeps the Go map and the JSON in lockstep — it's the reason the drift was caught. go test -count=1 ./internal/diagnostics/... passes; go build ./... clean.

Related

  • Silo-Server/silo-diagnostics — re-vendor + contract test
  • Silo-Server/silo-android — re-vendor, parity gate, hosted allowlist alignment
  • Silo-Server/silo-apple — the instrumentation this enables

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Expanded diagnostic reporting with playback session, method, reason, and position details.
    • Added network outcome, error classification, and retry-attempt details.
    • Added lifecycle phase, duration, outcome, reason, and launch-type details.

Adds the attribute keys the Apple and Android clients need to record
startup, network, auth, and playback behavior in diagnostics reports.

The four playback keys were already being emitted by the Apple client
but were never registered here, so they were silently dropped by this
collector and hard-rejected by the hosted one. Registering them makes
the canonical registry the superset it was always meant to be.

position_seconds is deliberately registered as position_ms (integer):
attrValueType has only string and integer, and a millisecond ordinal
avoids adding a float type for a single key. launch_type is a string
for the same reason, rather than a bool.

New keys:
  playback:  session_id, play_method, reason, position_ms
  lifecycle: phase, duration_ms, outcome, reason, launch_type
  network:   outcome, error_code, attempt

Purely additive; no existing key changes type or is removed.
TestAttrRegistryStaysInSync keeps the Go map and the JSON in lockstep.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 72a135cd-9240-47fa-bd8c-0d284f4bbf44

📥 Commits

Reviewing files that changed from the base of the PR and between febf5c4 and e4627b7.

📒 Files selected for processing (2)
  • docs/design/schemas/client-diagnostics/v1/attr-registry.json
  • internal/diagnostics/contract/contract.go

📝 Walkthrough

Walkthrough

The diagnostics schema and Go contract now register additional playback, network, and lifecycle attributes, including session data, outcomes, error classifications, retry attempts, durations, and launch types.

Changes

Diagnostics contract expansion

Layer / File(s) Summary
Attribute registry definitions
docs/design/schemas/client-diagnostics/v1/attr-registry.json
The registry adds playback session, delivery, reason, and position attributes; network outcome, error classification, and retry-attempt attributes; and lifecycle phase, duration, outcome, reason, and launch-type attributes.
Go contract registration
internal/diagnostics/contract/contract.go
The Go contract registers the new attributes with string or integer types across playback, network, and lifecycle categories.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e4627

This PR adds diagnostic attribute registrations without changing or removing existing keys, and no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the expansion of the client diagnostics log attribute registry.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/diagnostics-attr-registry-expansion

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

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