Skip to content

Add 'info' JSON-RPC method exposing PET version and git SHA #465

@eleanorjboyd

Description

@eleanorjboyd

Summary

The Python Environments extension cannot today attribute its pet.refresh / pet.resolve telemetry by PET commit — every insiders build embeds whatever PET was current at build time, and there is no way to read the PET version back from the binary at runtime. This blocks bisecting regressions like the May 25, 2026 one (extension team reported pet.refresh p90 +91% darwin / +44% win32 on v1.33 insiders vs v1.30 stable, but had no way to confirm which PET SHA shipped in each build).

Proposed JSON-RPC method

// Request:  { jsonrpc: "2.0", id: <n>, method: "info", params: {} }
// Response: { jsonrpc: "2.0", id: <n>, result: InfoResponse }

interface InfoResponse {
  petVersion: string;        // crate version from Cargo.toml, e.g. "0.5.3"
  petGitSha: string;         // short SHA, baked in at build time
  petBuildTimestamp: string; // ISO 8601
  schemaVersion: string;     // JSONRPC schema version, e.g. "1"
}

Implementation

  • Extend build.rs (already used to embed Windows resources) to stamp GIT_SHA and BUILD_TIMESTAMP via env!().
  • crate::version::PET_VERSION from env!("CARGO_PKG_VERSION").
  • New handle_info in crates/pet/src/jsonrpc.rs. No locking, no I/O — pure const response.
  • Document in docs/JSONRPC.md.

Acceptance criteria

  • info request returns within 1ms.
  • Response fields populated in both cargo build and cargo build --release.
  • Documented in docs/JSONRPC.md with TypeScript interface.
  • Integration test in crates/pet/tests/.

Context

Filed in response to the Python Environments extension team's May 25, 2026 regression report. The team has good telemetry on pet.refresh / pet.resolve durations but cannot tie those events to PET commits because the binary doesn't expose its version. Adding info is a small, additive change that unblocks future bisects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions