diff --git a/docs/TELEMETRY.md b/docs/TELEMETRY.md index fa85d5e8f0..9b686659a5 100644 --- a/docs/TELEMETRY.md +++ b/docs/TELEMETRY.md @@ -260,5 +260,5 @@ LLM spans follow the OpenTelemetry GenAI semantic conventions, which live in `op - **Gateway slot wait**: A chat call to the LLM gateway first waits in the process for one of the gateway's backend slots. The wait is an INTERNAL `ai.llm.gateway_slot` span under the call's `ai.llm.dispatch` or `ai.llm.stream` span, with `llm.gateway.slots` and `llm.gateway.slot_wait_seconds`, and an observation of `devops_cli_ai_gateway_slot_wait_seconds`. The call's `llm.wall_seconds`, its time to first chunk and its spend's duration start once it holds the slot, so the wait is not counted as inference. - **Ollama slot wait**: A call to Ollama first waits in the process for a slot on one of its nodes, queued by priority: `high` first, `as_available` last. Each call observes its wait once in `devops_cli_ai_ollama_slot_wait_seconds`, by `priority` and by `outcome`: `ok` once it holds a slot, or `timeout` when its deadline passes with no slot. A call that finds a free slot observes about 0 s, so the quantiles cover every call. - **Private keys**: Anything the conventions do not define is written under `llm.*`, such as `llm.request.priority`, `llm.tokens_per_second` and `llm.usage.cost_usd`, never under `gen_ai.*`. -- **Check**: `tests/test_telemetry_semconv.py` reads every Python file under `src/devops_cli/`, comments and docstrings included. It fails on a quoted string starting with `gen_ai.` that is not a current attribute key or metric name in the snapshot, and on any f-string that builds one. -- **Refresh**: A person moves the pin with `devops telemetry semconv refresh --commit `, which needs weaver on PATH and network access, then fixes what the check reports. The gate never runs weaver. +- **Check**: `tests/telemetry/test_telemetry_semconv.py` reads every Python file under `src/devops_cli/`, comments and docstrings included. It fails on a quoted string starting with `gen_ai.` that is not a current attribute key or metric name in the snapshot, and on any f-string that builds one. +- **Refresh**: A person moves the pin with `devops telemetry semconv refresh --commit `, which needs weaver on PATH and network access, then fixes what the check reports. The devtools image `ghcr.io/dan-petty/devtools` has weaver in `/usr/local/bin`, and Renovate keeps its version current there. The gate never runs weaver. diff --git a/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/.openspec.yaml b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/.openspec.yaml new file mode 100644 index 0000000000..ce56180a94 --- /dev/null +++ b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-19 diff --git a/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/design.md b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/design.md new file mode 100644 index 0000000000..fa7fc76c75 --- /dev/null +++ b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/design.md @@ -0,0 +1,10 @@ +# Design + +## Decisions +- The hint names the devtools image `ghcr.io/dan-petty/devtools`, which has weaver in `/usr/local/bin`, and the weaver releases page. It names no version: the version lives in the mise files of dan-petty/devtools, which Renovate bumps. +- The hint text is `MESSAGES.telemetry.weaver_missing_hint`, as the install hints of npm and OpenSpec are in `MESSAGES`. The image name is the constant `CONST_DEVTOOLS_IMAGE` next to the other image names in `constants.py`. + +## Rejected alternatives +- Keep the version and add a Renovate regex manager on the constant. The owner rule of 2026-11-19 forbids a tool version in `src/` that a dependency update must change. +- Read the version from weaver at run time for the hint. The hint shows only when no weaver is on PATH, so no weaver can report a version. +- Add a version file under `src/` that the code reads. It puts a tool version back in `src/` that a dependency update must change. diff --git a/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/proposal.md b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/proposal.md new file mode 100644 index 0000000000..09f1e2a2b7 --- /dev/null +++ b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/proposal.md @@ -0,0 +1,28 @@ +# Proposal: #6423 + +## Why +`src/devops_cli/config/constants.py` holds a copy of the weaver version, `CONST_SEMCONV_WEAVER_VERSION = "0.26.1"`. Only the install hint of `devops telemetry semconv refresh` uses it. No Renovate manager updates this copy, so each weaver release makes the hint wrong. The owner rule of 2026-11-19 says that devops-cli is not a package manager: no tool version stays in `src/` that a dependency update must change. Closes #6423. + +## What Changes +- Delete `CONST_SEMCONV_WEAVER_VERSION`. +- The hint of the `DependencyError` that `devops telemetry semconv refresh` raises when weaver is not on PATH names the devtools image `ghcr.io/dan-petty/devtools` and the weaver releases page, with no version number. The hint text moves to `MESSAGES.telemetry.weaver_missing_hint`, and the image name becomes the constant `CONST_DEVTOOLS_IMAGE`. +- `weaver_package_argv` and its test stay: they test the argv that the code builds, not a version value. +- The hint is a message that a user sees, so the change has a spec delta. + +The change fits one pull request. + +## Capabilities +- `telemetry-semconv` (new): the GenAI semantic conventions snapshot and its refresh command. + +## Impact +- A user with no weaver on PATH gets a hint that stays correct after each weaver release. +- The weaver version lives only in `mise.toml` and `mise.lock` of dan-petty/devtools, which Renovate's `mise` manager bumps. + +## Feasibility +- `git grep -n SEMCONV_WEAVER_VERSION origin/main -- src` finds the constant at `src/devops_cli/config/constants.py:2134` and its only use at `src/devops_cli/telemetry/semconv.py:207`. +- `mise.toml` of dan-petty/devtools holds `"github:open-telemetry/weaver" = "0.28.0"`, and its `mise.lock` holds the URL and checksum of weaver for `linux-x64` and `linux-arm64`. Its README names the image `ghcr.io/dan-petty/devtools` and lists weaver among the tools that Renovate's `mise` manager updates. +- An anonymous request for the manifest of `ghcr.io/dan-petty/devtools:latest` returns HTTP 200, so the image is public. +- dan-petty/devtools#1, the dependency of this item, is closed. + +## Existing Tool Considered +Renovate's `mise` manager is the open, maintained tool that covers the need: it bumps weaver in `mise.toml` and `mise.lock` of dan-petty/devtools. This change builds nothing. It deletes the internal constant `CONST_SEMCONV_WEAVER_VERSION` and its use in the install hint. diff --git a/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/specs/telemetry-semconv/spec.md b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/specs/telemetry-semconv/spec.md new file mode 100644 index 0000000000..e78c3fd0b0 --- /dev/null +++ b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/specs/telemetry-semconv/spec.md @@ -0,0 +1,13 @@ +## Purpose +The pinned GenAI semantic conventions snapshot of devops-cli and its refresh command `devops telemetry semconv refresh`, which resolves the conventions with weaver. + +## ADDED Requirements + +### Requirement: The weaver install hint names no version +When no `weaver` is on PATH, the `DependencyError` of `devops telemetry semconv refresh` SHALL name the devtools image `ghcr.io/dan-petty/devtools` and the weaver releases page. The hint SHALL hold no weaver version number, because Renovate updates the version only in the devtools image. + +#### Scenario: Weaver is absent from PATH +- **WHEN** `devops telemetry semconv refresh --commit ` runs and no `weaver` is on PATH +- **THEN** the command exits 1 +- **AND** the message names `ghcr.io/dan-petty/devtools` and `https://github.com/open-telemetry/weaver/releases` +- **AND** the message holds no version number diff --git a/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/tasks.md b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/tasks.md new file mode 100644 index 0000000000..abdf0974a3 --- /dev/null +++ b/openspec/changes/archive/2026-11-19-6423-drop-weaver-version-hint/tasks.md @@ -0,0 +1,28 @@ +# Tasks + +## 1. The install hint names the devtools image and no version + +Kind: behavior. Changes: `src/devops_cli/telemetry/semconv.py`, `src/devops_cli/lang/en/messages.py`, `src/devops_cli/config/constants.py`, `tests/telemetry/test_telemetry_semconv.py`. + +- [x] 1.1 Test that with no weaver on PATH, the refusal names `ghcr.io/dan-petty/devtools` and the weaver releases page, and holds no version number + - Verification: `$ uv run devops ci test tests/telemetry/test_telemetry_semconv.py` +- [x] 1.2 Move the hint to `MESSAGES.telemetry.weaver_missing_hint` with the image `CONST_DEVTOOLS_IMAGE` and no version, and delete `CONST_SEMCONV_WEAVER_VERSION` + - Verification: `$ uv run devops ci test tests/telemetry/test_telemetry_semconv.py` + +## 2. No copied weaver version is left + +Kind: deletion. + +- [x] 2.1 Confirm that no code under `src/` or `tests/` names the deleted constant + - Verification: `$ ! git grep -n SEMCONV_WEAVER_VERSION -- src/ tests/` + +## 3. Documents + +Kind: documents. Changes: `src/devops_cli/docs/generator.py`, `docs/TELEMETRY.md`. + +- [x] 3.1 Name the devtools image as the source of weaver in `docs/TELEMETRY.md` (generated from `src/devops_cli/docs/generator.py`) + - Verification: `$ uv run devops docs generate --check` + +## Workflow follow-up + +- Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD). diff --git a/openspec/specs/telemetry-semconv/spec.md b/openspec/specs/telemetry-semconv/spec.md new file mode 100644 index 0000000000..df87c79a35 --- /dev/null +++ b/openspec/specs/telemetry-semconv/spec.md @@ -0,0 +1,15 @@ +# telemetry-semconv Specification + +## Purpose +The pinned GenAI semantic conventions snapshot of devops-cli and its refresh command `devops telemetry semconv refresh`, which resolves the conventions with weaver. + +## Requirements + +### Requirement: The weaver install hint names no version +When no `weaver` is on PATH, the `DependencyError` of `devops telemetry semconv refresh` SHALL name the devtools image `ghcr.io/dan-petty/devtools` and the weaver releases page. The hint SHALL hold no weaver version number, because Renovate updates the version only in the devtools image. + +#### Scenario: Weaver is absent from PATH +- **WHEN** `devops telemetry semconv refresh --commit ` runs and no `weaver` is on PATH +- **THEN** the command exits 1 +- **AND** the message names `ghcr.io/dan-petty/devtools` and `https://github.com/open-telemetry/weaver/releases` +- **AND** the message holds no version number diff --git a/src/devops_cli/config/constants.py b/src/devops_cli/config/constants.py index 85734cda54..9b45425d29 100644 --- a/src/devops_cli/config/constants.py +++ b/src/devops_cli/config/constants.py @@ -864,6 +864,10 @@ CONST_DEVCONTAINER_IMAGE_PREFIX = "mcr.microsoft.com/devcontainers/python:" CONST_DEVCONTAINER_PUBLISHED_IMAGE = "ghcr.io/dan-petty/devops-cli/devcontainer:latest" CONST_CANONICAL_OCI_SOURCE: Final[str] = "https://github.com/dan-petty/devops-cli" +# The public image of the development tools (dan-petty/devtools). Renovate keeps the version +# of weaver and of the other binary tools in its mise files, so an install hint names the image +# and no version. +CONST_DEVTOOLS_IMAGE: Final[str] = "ghcr.io/dan-petty/devtools" # The Secret Service gh, git and Python keyring use; dbus-x11 satisfies gnome-keyring's # session-bus dependency without pulling in systemd. Mirrors .devcontainer/Dockerfile. CONST_KEYRING_PACKAGES: Final[tuple[str, ...]] = ("gnome-keyring", "dbus-x11") @@ -2131,7 +2135,6 @@ class WebhookExposure(StrEnum): CONST_SEMCONV_GENAI_MODEL_DIR: Final[str] = "model" CONST_SEMCONV_RESOLVED_REGISTRY_FILE: Final[str] = "resolved.yaml" CONST_SEMCONV_WEAVER_BIN: Final[str] = "weaver" -CONST_SEMCONV_WEAVER_VERSION: Final[str] = "0.26.1" CONST_URL_WEAVER_RELEASES: Final[str] = "https://github.com/open-telemetry/weaver/releases" CONST_GIT_COMMIT_SHA_PATTERN: Final[re.Pattern[str]] = re.compile(r"[0-9a-f]{40}") # A quoted string in Python source whose text starts with the GenAI attribute namespace. diff --git a/src/devops_cli/docs/generator.py b/src/devops_cli/docs/generator.py index 3ec389b3b8..06b779f87c 100644 --- a/src/devops_cli/docs/generator.py +++ b/src/devops_cli/docs/generator.py @@ -15,6 +15,7 @@ from devops_cli.config.constants import ( CONST_CONFIG_BACKUP_INFIX, CONST_CONFIG_BACKUPS_KEPT, + CONST_DEVTOOLS_IMAGE, CONST_DOC_CREDENTIAL_NAME_WORD_PAIRS, CONST_DOC_CREDENTIAL_NAME_WORDS, CONST_DOC_CREDENTIAL_NAMING_WORD, @@ -1247,13 +1248,15 @@ def _llm_span_attribute_lines() -> list[str]: "- **Private keys**: Anything the conventions do not define is written under `llm.*`, " "such as `llm.request.priority`, `llm.tokens_per_second` and `llm.usage.cost_usd`, " "never under `gen_ai.*`.", - "- **Check**: `tests/test_telemetry_semconv.py` reads every Python file under " + "- **Check**: `tests/telemetry/test_telemetry_semconv.py` reads every Python file under " "`src/devops_cli/`, comments and docstrings included. It fails on a quoted string " "starting with `gen_ai.` that is not a current attribute key or metric name in the " "snapshot, and on any f-string that builds one.", "- **Refresh**: A person moves the pin with " "`devops telemetry semconv refresh --commit `, which needs weaver on PATH and " - "network access, then fixes what the check reports. The gate never runs weaver.", + "network access, then fixes what the check reports. The devtools image " + f"`{CONST_DEVTOOLS_IMAGE}` has weaver in `/usr/local/bin`, and Renovate keeps its " + "version current there. The gate never runs weaver.", "", ] diff --git a/src/devops_cli/lang/en/messages.py b/src/devops_cli/lang/en/messages.py index 3de5bce5c1..53a4e4eec7 100644 --- a/src/devops_cli/lang/en/messages.py +++ b/src/devops_cli/lang/en/messages.py @@ -1960,6 +1960,10 @@ class TelemetryMessages: "{path} now holds {attributes} attributes, {metrics} metrics and {spans} span types " "from {repo}@{commit} (weaver {weaver})." ) + weaver_missing_hint: str = ( + "The devtools image {image} has weaver in /usr/local/bin. Copy weaver from that image, " + "or install it from {releases_url}, and put it on PATH." + ) usage_ledger_unwritable: str = ( "devops-cli cannot write the usage-error ledger {path}: {reason}. " "Set telemetry.usage_ledger to false to stop the ledger." diff --git a/src/devops_cli/telemetry/semconv.py b/src/devops_cli/telemetry/semconv.py index 33d2880eb1..1280bd5e46 100644 --- a/src/devops_cli/telemetry/semconv.py +++ b/src/devops_cli/telemetry/semconv.py @@ -19,6 +19,7 @@ import yaml from devops_cli.config.constants import ( + CONST_DEVTOOLS_IMAGE, CONST_GIT_COMMIT_SHA_PATTERN, CONST_MAX_ERROR_DETAIL_LENGTH, CONST_PERM_REPO_FILE, @@ -30,7 +31,6 @@ CONST_SEMCONV_GENAI_REPO, CONST_SEMCONV_RESOLVED_REGISTRY_FILE, CONST_SEMCONV_WEAVER_BIN, - CONST_SEMCONV_WEAVER_VERSION, CONST_URL_WEAVER_RELEASES, ) from devops_cli.config.defaults import DEFAULT_SEMCONV_WEAVER_TIMEOUT_SECONDS @@ -41,6 +41,7 @@ TelemetryError, ValidationError, ) +from devops_cli.lang import MESSAGES from devops_cli.output.file_writer import write_text_file GENAI_SNAPSHOT_PATH = Path(__file__).with_name("semconv_genai.json") @@ -203,9 +204,8 @@ def refresh_genai_snapshot( if weaver is None: raise DependencyError( CONST_SEMCONV_WEAVER_BIN, - install_hint=( - f"Install weaver {CONST_SEMCONV_WEAVER_VERSION} from " - f"{CONST_URL_WEAVER_RELEASES} and put it on PATH." + install_hint=MESSAGES.telemetry.weaver_missing_hint.format( + image=CONST_DEVTOOLS_IMAGE, releases_url=CONST_URL_WEAVER_RELEASES ), ) with tempfile.TemporaryDirectory(prefix="devops-semconv-") as work_dir: diff --git a/tests/telemetry/test_telemetry_semconv.py b/tests/telemetry/test_telemetry_semconv.py index 1f67422f8e..cbe86409e9 100644 --- a/tests/telemetry/test_telemetry_semconv.py +++ b/tests/telemetry/test_telemetry_semconv.py @@ -3,6 +3,7 @@ from __future__ import annotations import json +import re import shutil import subprocess from collections.abc import Callable @@ -18,12 +19,14 @@ from devops_cli.commands.telemetry import app from devops_cli.config.constants import CONST_GIT_COMMIT_SHA_PATTERN from devops_cli.dry_run import set_dry_run +from devops_cli.exceptions import DependencyError from devops_cli.telemetry.semconv import ( GENAI_SNAPSHOT_PATH, current_genai_names, find_unknown_genai_literals, load_genai_snapshot, reduce_resolved_registry, + refresh_genai_snapshot, render_genai_snapshot, weaver_package_argv, ) @@ -186,8 +189,7 @@ def test_reducer_drops_deprecated_names_and_is_byte_stable( None, PINNED_COMMIT, _package_writes_fixture, - "Required dependency 'weaver' is not installed or not available in PATH. Install " - "weaver 0.26.1 from https://github.com/open-telemetry/weaver/releases", + "Required dependency 'weaver' is not installed or not available in PATH.", id="weaver-not-on-path", ), pytest.param( @@ -235,6 +237,24 @@ def test_refresh_refuses_and_leaves_the_snapshot_unchanged( assert snapshot_copy.read_bytes() == before +def test_missing_weaver_hint_names_the_devtools_image_and_no_version( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + """The hint names where weaver comes from, and no copied version that a weaver release makes wrong.""" + monkeypatch.setattr(shutil, "which", lambda name: None) + monkeypatch.setattr(semconv, "run_subprocess", _refuse_subprocess) + + with pytest.raises(DependencyError) as caught: + refresh_genai_snapshot(PINNED_COMMIT, snapshot_path=tmp_path / "semconv_genai.json") + + hint = caught.value.details["install_hint"] + assert ( + "ghcr.io/dan-petty/devtools" in hint, + "https://github.com/open-telemetry/weaver/releases" in hint, + re.findall(r"\d+\.\d+", hint), + ) == (True, True, []), hint + + def test_refresh_rewrites_the_snapshot_from_weavers_package( runner: CliRunner, monkeypatch: pytest.MonkeyPatch, snapshot_copy: Path ) -> None: