Skip to content

feat: detection providers + CLI plugin with docker variant detect - #3

Merged
achimnol merged 1 commit into
topic/core-variantfrom
topic/providers-detect
Aug 9, 2026
Merged

feat: detection providers + CLI plugin with docker variant detect#3
achimnol merged 1 commit into
topic/core-variantfrom
topic/providers-detect

Conversation

@achimnol

Copy link
Copy Markdown
Member

Summary

Stacked PR 3/7 (base: #2). Adds the hardware-detection side and the CLI plugin skeleton:

  • pkg/providers: Provider interface (namespace → feature → preference-ordered values), DetectAll merging with warning collection (a failing provider never aborts detection).
    • x86_64: psABI microarchitecture levels (v1–v4) computed from CPUID flags via golang.org/x/sys/cpu; flag set extracted into a struct so tests construct arbitrary CPUs.
    • nvidia: parses the nvidia-smi banner; expands cuda_version_lower_bound ("built for CUDA ≥ X") into the explicit satisfiable-release list so pkg/variant's intersection rule applies unchanged. Missing binary = namespace absent; broken driver = warning.
    • aarch64: v8 baseline.
    • Properties-file mock (--properties-file / DOCKER_VARIANT_PROPERTIES_FILE) — the deterministic-detection mechanism all later e2e tests and the demo rely on.
  • cmd/docker-variant: cobra root with the docker-cli-plugin-metadata handshake and docker variant detect (--json or ns :: feature :: values triples).

Testing

  • Unit tests: level computation matrix (incl. AVX-without-v2-base edge case), banner parsing, bound expansion, DetectAll merge/warning/empty-namespace behavior, properties-file validation.
  • Smoke-tested on this machine: handshake JSON OK; detect reports x86_64 :: level :: v4,v3,v2,v1 and degrades the GPU-less nvidia-smi to a warning as designed.

https://claude.ai/code/session_01D383U8kkQkJc1yzyC5H5Nk

pkg/providers implements compiled-in detection (ADR-5): x86-64
microarchitecture levels via CPUID (psABI v2/v3/v4 checks), a minimal
aarch64 baseline, and NVIDIA CUDA via nvidia-smi banner parsing — the
cuda_version_lower_bound predicate is expanded into the explicit list of
satisfiable known releases so the generic intersection rule applies.
A JSON properties file (--properties-file or
$DOCKER_VARIANT_PROPERTIES_FILE) substitutes for live detection in
tests, CI, and the demo. Provider failures are surfaced as warnings,
not fatal errors.

cmd/docker-variant is the Docker CLI plugin entry point: the
docker-cli-plugin-metadata handshake plus `docker variant detect`
(text triples or --json).

Claude-Session: https://claude.ai/code/session_01D383U8kkQkJc1yzyC5H5Nk
@achimnol
achimnol merged commit 59eef20 into main Aug 9, 2026
1 check passed
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.

1 participant