Skip to content

add linked project ids to session-start telemetry#37

Open
Grappeggia wants to merge 9 commits intomainfrom
feature/vercel-project-link-telemetry
Open

add linked project ids to session-start telemetry#37
Grappeggia wants to merge 9 commits intomainfrom
feature/vercel-project-link-telemetry

Conversation

@Grappeggia
Copy link
Copy Markdown

@Grappeggia Grappeggia commented Apr 7, 2026

Summary

  • read linked Vercel project metadata from local .vercel/project.json during session start
  • include the linked project and org IDs in the existing base telemetry batch when available
  • keep the change scoped to session start only

Testing

  • bun run build:hooks
  • bun test tests/session-start-profiler.test.ts -t \"session-start telemetry helpers\"

Resolve project and org ids from local .vercel metadata and refresh them hourly on prompts so dashboard attribution stays accurate without extra API calls.
Prefer per-prompt roots over stale session env state and keep refresh retries alive until project IDs have actually been sent, so long-lived sessions do not misattribute or silently drop project telemetry after transient failures.
Remove cached project link state when a session starts without a linked project, clear that state on clear/compact, and add regression coverage for prompt refreshes and cleanup paths.
Re-resolve linked Vercel project metadata when the working root changes and emit tombstones when sessions become unlinked so dashboard attribution does not stay stale.
Use the hook payload root during session start and preserve linked-project session state across clear and compact events so attribution and unlink tombstones stay accurate.
@Grappeggia Grappeggia requested a review from Melkeydev April 8, 2026 00:25
@Grappeggia Grappeggia marked this pull request as ready for review April 8, 2026 00:25
Avoid session-start link resolution and state writes when base telemetry is disabled, and centralize Vercel project link state construction so session-start and prompt refreshes share one clearer code path.
Only read .vercel/project.json during session start and include the linked project and org IDs in the existing base telemetry batch. Drop the prompt refresh and session state lifecycle changes so the PR stays focused on the minimum telemetry addition.
@Grappeggia Grappeggia changed the title Refresh linked Vercel project telemetry in long sessions add linked Vercel project IDs to session-start telemetry Apr 8, 2026
@Grappeggia Grappeggia changed the title add linked Vercel project IDs to session-start telemetry add linked project ids to session-start telemetry Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@Melkeydev Melkeydev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to uptick the version numbers

}

export function readLinkedVercelProject(projectRoot: string): VercelProjectLink | null {
const projectJsonPath = join(projectRoot, ".vercel", "project.json");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for all operating systems?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node:path.join(projectRoot, ".vercel", "project.json") is cross-platform, so this works on macOS, Linux, and Windows.
I pushed a follow-up that validates the behavior by:

  • preferring the hook payload root before reading .vercel/project.json
  • adding coverage for valid, malformed, and incomplete linked-project metadata
  • adding a session-start telemetry test that verifies payload-root attribution
  • bumping the plugin version to 0.32.1

Resolve session-start roots from hook payloads and add focused cross-platform coverage so linked Vercel project IDs are attributed correctly on macOS, Linux, and Windows. Bump the published plugin manifests for the follow-up change.
Keep the payload-root and telemetry coverage changes, but drop the dedicated cross-platform CI matrix to avoid adding permanent workflow cost for a narrow fix.
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.

2 participants