Skip to content

fix: normalize legacy flag names in telemetry and make doctor's logs check follow the drain wiring - #549

Merged
HugoRCD merged 3 commits into
mainfrom
fix/flag-merge-and-fs-sink
Aug 9, 2026
Merged

fix: normalize legacy flag names in telemetry and make doctor's logs check follow the drain wiring#549
HugoRCD merged 3 commits into
mainfrom
fix/flag-merge-and-fs-sink

Conversation

@evlogai

@evlogai evlogai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Two telemetry findings from production CLI data, fixed end to end.

1. --no-header split across two flag keys

Old CLI versions (@evlog/cli < 0.5.0) recorded raw citty args, so the flags breakdown tallied no-header and noHeader separately, and the _ positional bucket leaked through. The client sanitizer (@evlog/telemetry) has emitted a single normalized key since 0.5.0, but historical rows stay in the database as they were reported.

Flag keys are now normalized in the adoption breakdown (getAdoptionForFilter), which both the dashboard and the telemetry-adoption MCP tool use: kebab-case keys are camel-cased like the client does, _ is dropped, and rows that collapse onto the same key/value merge their counts. This covers historical and new rows.

  • apps/telemetry/shared/utils/adoption-shape.ts: normalizeFlagKey / normalizeFlagRows
  • apps/telemetry/server/utils/telemetry-queries.ts: flags breakdown goes through normalizeFlagRows

2. doctor never detects a logs sink

The logs check passed only when .evlog/logs existed, and the fs drain creates it lazily on first write, so every fresh setup reported "no local sink yet". The check is now driven by the drain wiring, not the filesystem:

  • a physical sink (.evlog/logs) is still reported with its file count;
  • a wired fs drain counts as a sink before the first event, since the drain creates the directory on first write. Doctor detects the wiring in the drain plugin (server/plugins/evlog-drain*.ts or any plugin under server/plugins) and the Next factory (lib/evlog.ts / src/lib/evlog.ts), or the EVLOG_FS_DIR / NUXT_EVLOG_FS_DIR env;
  • a project with no local drain gets no logs check at all — the fs drain is optional, and doctor no longer warns about a sink nothing expects. The cli.LOGS_SINK_MISSING catalog code is gone with the warning.

Tests

  • packages/cli/test/doctor.test.ts: wired drain → sink present before the first event; no drain wiring → check omitted (both failing regression first); env-configured drain dir; empty physical sink still present; debug findings no longer emit cli.LOGS_SINK_MISSING
  • apps/telemetry/test/adoption-shape.test.ts: normalization merges the two spellings and drops _

Checks

  • pnpm run lint: 22/22 tasks pass
  • pnpm run typecheck: 27/27 tasks pass
  • pnpm run test: 22/22 tasks pass

Closes #547

@changeset-bot

changeset-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: db6e40a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@evlog/cli Patch

Not sure what this means? Click here to learn what changesets are.

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

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, v0 Aug 9, 2026 8:40pm
evlog-render-lab Ready Ready Preview Aug 9, 2026 8:40pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
evi Ignored Ignored Preview Aug 9, 2026 8:40pm
evlog-telemetry Ignored Ignored Preview Aug 9, 2026 8:40pm
just-use-evlog Ignored Ignored Preview Aug 9, 2026 8:40pm

Request Review

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@pkg-pr-new

pkg-pr-new Bot commented Aug 9, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@evlog/cli@549
npm i https://pkg.pr.new/evlog@549
npm i https://pkg.pr.new/@evlog/nuxthub@549
npm i https://pkg.pr.new/@evlog/telemetry@549

commit: db6e40a

…iring a local sink

The fs drain is optional: it creates its directory lazily on first write, so a
wired drain is a sink before any event, and a project without one needs no
local sink at all. doctor now reads the drain wiring (drain plugin or the
Next factory) and the EVLOG_FS_DIR env instead of warning whenever
.evlog/logs is missing.
@evlogai evlogai Bot changed the title fix: normalize legacy flag names in telemetry and report the fs sink on fresh init fix: normalize legacy flag names in telemetry and make doctor's logs check follow the drain wiring Aug 9, 2026
@HugoRCD
HugoRCD merged commit 9eb98cf into main Aug 9, 2026
19 checks passed
@HugoRCD
HugoRCD deleted the fix/flag-merge-and-fs-sink branch August 9, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI telemetry: --no-header recorded under two flag names, and doctor never detects a logs sink

1 participant