Skip to content

docs(openspec): plan #2603 Type docker-py with types-docker - #3071

Merged
dan-petty merged 3 commits into
mainfrom
build/2603-type-docker-py-with-typeshed-s
Nov 1, 2026
Merged

dan-petty merged 3 commits into
mainfrom
build/2603-type-docker-py-with-typeshed-s

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Plans #2603

Plan: type docker-py with typeshed's types-docker. Add types-docker==7.2.0.20261006 to the dev group and requests==2.34.2 to the dependencies (already in the lockfile through docker-py; engine.py imports requests.HTTPError). Fix the 3 mypy errors that the stubs show in engine.py: catch requests.HTTPError, import get_current_context_name from docker.context.config, and return the client of _sdk_client through cast("EngineClient", ...). Delete the 9 now-unused # type: ignore[import-untyped] markers in engine.py, sandbox/host.py and commands/docker.py, and lower the src type: ignore ceiling from 51 to 40. tagged_image in registry.py uses docker-py's parse_repository_tag and resolve_repository_name, imported lazily. It keeps its refusals: a reference with no registry host, or one that docker-py rejects, is still a RegistryReadError. A reference with a digest now splits into the repository and the digest. The change has no spec delta.

Change: openspec/changes/2603-type-docker-py-with-typeshed-s/

@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 1, 2026 13:59
…eep refusals

The plan named a test path that does not exist, set the ceiling to a value
that the count does not give, and added a docker.io rule that breaks the
existing refusal tests. It also asked to align Protocols that cannot match
the stubs.

The plan now uses the real paths and the measured count of 40. It casts the
SDK client, declares requests, and keeps the refusals of tagged_image. It
drops the spec delta.
@dan-petty

Copy link
Copy Markdown
Owner

Plan fix for #2603. No evaluation entry existed for this pull request, so I evaluated the plan myself against origin/main.

Premise check: the premise holds. The 9 docker-py ignore markers exist. mypy with types-docker reports 12 errors: 9 unused ignores and 3 real errors.

What the new commit changes (plan files only):

  • The plan now states the real error ceiling that mypy reports.
  • The plan no longer asks for Protocol alignment.
  • The plan keeps the refusals.
  • The stale spec delta for argo-image-pin-drift is removed.
  • tasks.md lists the real paths and tests. The plan files carry the change metadata.

Confirmed findings: all defects above were reproduced with mypy and with path checks against origin/main, then fixed. Unconfirmed findings: none (no earlier evaluation entry).

Verification: openspec validate --strict, devops openspec check and tests/invariants/test_change_folders.py (17 passed) all pass. I built the corrected change in a scratch copy. mypy, deps, lockfile, docs, lint and the touched tests passed there. I then reverted that copy.

I merged origin/main into the branch before the push. No code, test or other change folder was touched.

@dan-petty

Copy link
Copy Markdown
Owner

Advisory pre-merge review (automated; a person decides).

Recommendation: hold. The plan files are sound, but the PR body states facts that the files contradict. The body becomes the squash commit message, so a person should fix the body first.

Severity Where Problem Evidence Fix
major PR body (squash commit message) The body describes a different plan than the files. The body says: "align the Protocols in sdk.py with the stubs, and keep one ignore for a name the stub lacks", "Remove the 8 now-unused import-untyped markers", "Lower the src type: ignore ceiling from 51 to 42", and "tagged_image now accepts references without a registry host by resolving them to docker.io". The files say the opposite. design.md line 9 casts the client and keeps the Protocols. design.md line 17 rejects Protocol alignment. proposal.md line 11 removes 9 markers and keeps none. proposal.md line 12 lowers the ceiling to 40. proposal.md line 51 keeps the refusal of a reference with no host. Rewrite the body from proposal.md: cast instead of Protocol alignment, 9 markers, ceiling 40, references with no host still refused, new requests dependency. Keep Plans #2603 and no closing keyword.
nit tasks.md task 1.3 The task says to return cast("EngineClient", ...) but names no cast import. src/devops_cli/docker/engine.py line 20 is from typing import TYPE_CHECKING, Any, ClassVar, Final. The lens applied the plan in a scratch copy: mypy passed only after cast was added to that import. Add "import cast from typing" to task 1.3.
nit proposal.md (What Changes) and design.md, digest decision The text says a digest reference splits into repository and digest. This holds only for <image>@sha256:.... The form <image>:<tag>@sha256:... still gives a wrong repository. No table row pins it. docker-py: parse_repository_tag('ghcr.io/example/app:v1@sha256:aaaa...') gives repository ghcr.io/example/app:v1. No consumer passes this form: argo/image_pins.py line 49 strips the digest first. Narrow the sentence to the @digest-only form, or add a refused-table row for :tag@digest.

What is good:

  • Every path in Reads and Changes exists at origin/main (0dbd092) or is a change file.
  • The premise holds. With types-docker 7.2.0.20261006, mypy reports 12 errors in 3 files on the base. After the plan edits, mypy prints "Success: no issues found in 630 source files". deptry reports DEP003 for requests without the new dependency. requests is already in uv.lock.
  • The marker count is 49 on the base and 40 after the edits. The ceiling test uses total > ceiling, so group 2 after group 1 is the right order.
  • The deviations from the issue (ceiling 40, cast, no kept marker) have evidence and appear in Rejected alternatives.
  • Group 3 starts with failing rows (scheme and digest). Groups 1 and 2 are manifest and marker changes with repeatable verify commands.
  • openspec validate --strict and devops openspec check pass.

Checks that were run:

  • Read PR docs(openspec): plan #2603 Type docker-py with types-docker #3071 body and head (63481b6) with devops gh api. Compared the body with proposal.md, design.md and tasks.md in the review worktree.
  • Confirmed line 20 of engine.py has no cast import.
  • Lens run (plan): mypy on a scratch copy with and without the plan edits, deptry, marker count with _collect_suppressions, docker-py parser outputs for each table row, openspec validate --strict, devops openspec check.
  • Not run: the full tests of group 3 in a scratch copy. The lens checked the parser outputs by hand.

dan-petty added a commit that referenced this pull request Nov 1, 2026
Plans #2610

This change replaces the `docker buildx imagetools inspect` subprocess
call in `devops k8s image-pins` with the project's own `tag_digest`
function, which sends a HEAD request of the manifest. Docker Hub does
not count HEAD requests against the anonymous pull allowance. Fourteen
of the 32 pins under `k8s/` are on Docker Hub, so each run no longer
spends 14 pulls from the shared allowance.

The change removes `inspect_command`, `ImagetoolsFake`, its contract
suite and its recordings. It moves `image_reference` to
`src/devops_cli/docker/registry.py`. Tests now double the registry at
the HTTP edge with `RegistryFake`, served by `stub_web`. No new tool pin
is needed.

The open plan for #2603 (pull request #3071) edits `tagged_image` and
`tests/docker/test_registry_tag_digest.py` too, and it keeps the refusal
of Docker Hub names. This plan removes that refusal. The pull request
that merges later must update the other plan or the code of the earlier
one.

Change: `openspec/changes/2610-devops-k8s-image-pins-resolves-with/`

---------

Co-authored-by: devops-cli-service[bot] <349441588+devops-cli-service[bot]@users.noreply.github.com>
Co-authored-by: Daniel Petty <[email protected]>
@dan-petty
dan-petty merged commit 29f6a96 into main Nov 1, 2026
20 checks passed
@dan-petty
dan-petty deleted the build/2603-type-docker-py-with-typeshed-s branch November 1, 2026 22:56
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