Skip to content

feat: record a per-machine run ordinal and score delta for evlog map - #565

Closed
evlogai[bot] wants to merge 5 commits into
mainfrom
EVL-285/map-telemetry-run-ordinal
Closed

feat: record a per-machine run ordinal and score delta for evlog map#565
evlogai[bot] wants to merge 5 commits into
mainfrom
EVL-285/map-telemetry-run-ordinal

Conversation

@evlogai

@evlogai evlogai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes EVL-285.

What

evlog map today records the shape of a single scan. This adds the two numbers that turn those isolated snapshots into a trajectory question: does running evlog map make scores go up?

  • mapRunOrdinal — monotonic counter, incremented on every local map run
  • mapScoreDelta — signed score change against the previous run on this machine, absent on the first run

The state lives in the CLI's telemetry data directory (~/.config/evlog-cli/telemetry/run-state.json), keyed by command name only. It is per machine, not per project: nothing about the project, git remote or path is hashed into it (a remote-URL hash would be trivially re-identifiable). The counter resets on evlog telemetry disable, is never written while telemetry is off, and is omitted in ephemeral CI where the machine id is already absent.

Both are numbers, so they pass the value-shape rule without any CLI allowlist change.

Implementation

  • packages/telemetry: new advanceRunState / purgeRunState in src/run-state.ts. It shares the consent check and isEphemeralCI predicate (now exported) with the machine id, so the two omissions stay in lockstep. telemetry disable now purges this state via purgeTelemetryState (renamed from purgeOutbox).
  • packages/cli: recordMapRun calls advanceRunState and emits the two fields; mapTelemetryFieldNames now covers them.
  • apps/telemetry: registers the two keys in the ingest allowlist. Unknown keys are dropped at ingest, and the repo's guard test (allowed-tools.test.tsmapTelemetryFieldNames()) was the thing that would have caught a missing entry, so both went in together.
  • apps/docs: cli/telemetry documents the fields and says plainly that the counter is per machine.

Checks

  • @evlog/telemetry tests: 69 passed (incl. new run-state.test.ts and run-state.ci.test.ts)
  • @evlog/cli tests: 454 passed
  • apps/telemetry tests: 190 passed (incl. the allowlist guard)
  • eslint clean on packages/telemetry, packages/cli, apps/telemetry
  • tsdown build (the typecheck path for both packages) passes

Manual verification

Ran the real CLI against a fixture with a temp config dir and EVLOG_TELEMETRY_DEBUG=1:

  • run 1 → mapRunOrdinal: 1, no delta
  • run 2 → mapRunOrdinal: 2, mapScoreDelta: 0
  • EVLOG_TELEMETRY=0 → no fields, no run-state.json
  • evlog telemetry disable → state file removed; re-enable + next run → ordinal 1 again

evlog map now records mapRunOrdinal and mapScoreDelta: the run's place in
the local sequence and the signed score change since the previous map run
on that machine. The counter lives in the CLI's telemetry data directory,
keyed by command name only, so it is per machine rather than per project;
there is no per-project history to protect anyone from the trade that a
per-project trajectory would require. The delta is absent on the first
run, both fields are omitted in ephemeral CI and while telemetry is off,
and telemetry disable purges the counter so a re-enable starts fresh.

The run-state facility lands in @evlog/telemetry as advanceRunState so the
consent, ephemeral-CI and opt-out rules are shared with the machine id.
@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5e945e2

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

This PR includes changesets to release 2 packages
Name Type
@evlog/telemetry Minor
@evlog/cli Minor

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

@evlogai
evlogai Bot requested a review from HugoRCD August 11, 2026 20:32
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
evi Ready Ready Preview Aug 11, 2026 9:48pm
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
evlog-docs Skipped Skipped Aug 11, 2026 9:48pm
evlog-render-lab Skipped Skipped Aug 11, 2026 9:48pm
evlog-telemetry Skipped Skipped Aug 11, 2026 9:48pm
just-use-evlog Skipped Skipped Aug 11, 2026 9:48pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

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

commit: 5e945e2

The counter tests simulate a stable machine, but on a GitHub Actions
runner std-env reports CI and the machine id is unset, so the counter is
correctly treated as ephemeral and every assertion got undefined.
Pinning EVLOG_TELEMETRY_MACHINE_ID makes the stable-machine path
deterministic in any environment.
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog August 11, 2026 21:25 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evi August 11, 2026 21:25 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs August 11, 2026 21:25 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry August 11, 2026 21:25 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-render-lab August 11, 2026 21:25 Inactive
@evlogai evlogai Bot closed this Aug 11, 2026
@evlogai evlogai Bot reopened this Aug 11, 2026
Main gained the per-kind and per-sensitivity map telemetry (EVL-286)
while this branch was in flight, plus a docs and dependency change. The
merge keeps both features: run-state fields and kind/sensitivity tallies
coexist in mapTelemetryFields, the docs page documents both, and the
ingest allowlist carries both key sets.
Main moved again (evi sandbox-path and parent-span fixes). The merge is
clean: those commits only touch apps/evi, which the map-telemetry change
does not overlap with, so the PR stays conflict-free and up to date.
@vercel
vercel Bot temporarily deployed to Preview – just-use-evlog August 11, 2026 21:47 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-telemetry August 11, 2026 21:47 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-docs August 11, 2026 21:47 Inactive
@vercel
vercel Bot temporarily deployed to Preview – evlog-render-lab August 11, 2026 21:47 Inactive
@HugoRCD HugoRCD closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant