Skip to content

docs(openspec): plan #2610 use tag_digest HEAD for image pins - #3096

Merged
dan-petty merged 7 commits into
mainfrom
perf/2610-devops-k8s-image-pins-resolves-with
Nov 1, 2026
Merged

dan-petty merged 7 commits into
mainfrom
perf/2610-devops-k8s-image-pins-resolves-with

Conversation

@devops-cli-service

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

Copy link
Copy Markdown
Contributor

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/

@devops-cli-service
devops-cli-service Bot marked this pull request as ready for review November 1, 2026 19:38
@dan-petty

Copy link
Copy Markdown
Owner

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

Recommendation: hold. The plan sends Docker Hub images to a host that is not the Docker Hub registry, and the base spec and command module are left in conflict with the new code.

Severity Where Problem Evidence Fix
blocker tasks.md 1.2, design.md decision 4 _normalize_reference makes docker.io/library/<name>:<tag>. tag_digest then requests https://docker.io/v2/.... That host is not the registry, so all Docker Hub pins fail. src/devops_cli/docker/registry.py line 83 builds the URL from image.registry. curl -sI https://docker.io/v2/library/nginx/manifests/1.27 gives 302 to www.docker.com. curl -sI https://registry-1.docker.io/v2/library/nginx/manifests/1.27 gives 401 (the real registry). Add a host map (docker.io and index.docker.io to registry-1.docker.io) with a failing test first. Or return the item with this evidence.
major specs/k8s-image-pins/spec.md The delta has only ADDED requirements. The base spec still says the command uses docker buildx imagetools inspect. After archive, two requirements conflict. openspec/specs/k8s-image-pins/spec.md lines 20 and 35. Use MODIFIED for "Each pin resolves in its registry as an anonymous client" and "A dry run renders and resolves nothing". Copy the whole base requirement.
major tasks.md group 1 src/devops_cli/commands/k8s/image_pins.py imports inspect_command (lines 16, 86) for the dry-run text. The plan removes it and lists no change to this file, to MESSAGES.k8s.image_pins_dry_run, or to the dry-run test. The command module fails to import after group 1. git grep -n inspect_command src tests in the PR worktree. Add the command module, the message and the dry-run test to a group.
major tasks.md groups 1 and 3 (order) Group 1 removes inspect_command. tests/k8s/test_imagetools_contract.py (line 17) and tests/support/imagetools_recording.py (line 70) still import it until group 3. Tests fail between the groups. Same grep. Delete the fake, contract suite, recording and fixture in the same group, or earlier.
major tasks.md 3.1 The task says to remove an imagetools registration from tests/support/bootstrap.py. None exists. grep -n imagetools tests/support/bootstrap.py returns nothing. Remove bootstrap.py from the task.
major tasks.md groups 1-2 Missing steps. (a) No source for the httpx2 client in the k8s command (the argo command builds one with the egress factory). (b) A dry run must make zero requests. No task keeps this or tests it. (c) Group 2 deletes image_reference, but tests/k8s/test_image_pins.py lines 198-204 test it against the Docker SDK. No task handles this test. commands/k8s/image_pins.py calls resolve_image_pins(pins) with no client. State the client source and egress level. Add a no-request dry-run test. Say what happens to the SDK split test.
major tasks.md 1.1, 1.2, 2.1, 2.2 Group 2 is a refactor with no behavior change, but task 2.1 asks for a test that fails on the base. It cannot. Task 1.2 repeats the HEAD test of task 1.1. Verify commands use bare uv run pytest. Tests at tests/k8s/test_image_pins.py lines 240-330 already cover the classification and pass on the base. Name the existing tests as the check for group 2. Merge 1.1 into 1.2. Use uv run devops ci test <path>.
minor proposal.md Feasibility No command output is recorded. The issue asks for a measurement that an anonymous HEAD leaves ratelimit-remaining unchanged. The spec scenario for it has no task that tests it. The crane cost figures have no source. A lens measured two HEAD requests to registry-1.docker.io for ratelimitpreview/test: ratelimit-remaining stayed at 100;w=3600. The premise holds, but the proposal does not record it. Record the measurement. Drop the untestable scenario or mark it as a measured fact.
minor proposal.md Impact, tasks.md Stale text is not listed: the docstrings of src/devops_cli/k8s/image_pins.py (line 18) and the command, .github/workflows/ci.yml line 741, docs/SDLC.md line 232. All name docker buildx imagetools inspect. AGENTS.md rule 8 asks to fix them in the same pull request. git grep -n imagetools. Add the updates to a group.

Checks that I ran or confirmed:

  • Read the lens result, then checked the code in the PR worktree: tagged_image and tag_digest in src/devops_cli/docker/registry.py, the inspect_command users, tests/support/bootstrap.py, the base spec and the change files.
  • Ran curl -sI against docker.io and registry-1.docker.io. The blocker is reproduced.
  • The lens reported that devops openspec check passes, the title is short, the body says Plans #2610 with no closing keyword, and all listed paths exist. I did not run these again. openspec validate --strict was not run.

The premise of the issue (an anonymous HEAD is free of the pull limit) is true. The plan needs the fixes above before it can be built.

The first plan sent Docker Hub names to the host docker.io, which
answers 302 to www.docker.com. The corrected plan maps them to
registry-1.docker.io, reads digest references, moves the one reference
split to the registry module, and keeps the dry run free of requests.
It reuses RegistryFake and stub_web, orders the groups so the tests
pass after each, and carries a MODIFIED spec delta.
Write the design as merged: drop the sentence about the first draft. Add the Reads and Changes line to group 5 of the tasks. Name the overlap with the plan of #2603 in the Feasibility section.
@dan-petty

Copy link
Copy Markdown
Owner

Evaluation of plan #2610 and the fixes pushed to this branch.

Changes in the plan:

Confirmed findings (all fixed): the host map, the digest reference read, the dry run text, the first draft sentence, the group 5 line, the #2603 overlap.

Unconfirmed findings: none left open.

Premise: an anonymous HEAD to Docker Hub does not use the pull allowance. A GET does. I measured ratelimit-remaining with curl (two HEADs: 99 then 99; two GETs: 98) and with tag_digest (98 before, 98 after, three digests read).

Verification: openspec validate --strict, uv run devops openspec check and tests/invariants/test_change_folders.py pass. The pre-push hook passes. I merged origin/main into the branch.

@dan-petty

Copy link
Copy Markdown
Owner

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

Recommendation: merge after minor fixes. The plan for #2610 is sound, and the findings below are small gaps in the verification steps, the CI path filter and the PR body.

Severity Where Problem Evidence Fix
minor openspec/changes/2610-.../tasks.md, task 4.1 verification The check greps only for imagetools. The old claim "Docker Hub counts each read ... as an anonymous pull" holds no imagetools, so the check passes while the claim stays. At the PR head, grep -rn -i 'counts each read' finds README.md:227, docs/CLI_REFERENCE.md:1214, docs/commands/k8s.md:512, src/devops_cli/commands/k8s/image_pins.py:45 and k8s/README.md:999. docs/SDLC.md:232 holds "run the job again after the hour". Add greps for counts each read and after the hour to the verification of 4.1 and 4.2.
minor .github/workflows/ci.yml lines 758-762 (image-pins paths filter), versus tasks.md groups 1 to 3 The plan moves image_reference and the resolver to src/devops_cli/docker/registry.py. The filter matches only k8s/**, src/devops_cli/**/image_pins.py and ci.yml. A later change to registry.py does not run the image-pins job. Before this plan, the resolver was in a file that the filter matched. The filter has three patterns. src/devops_cli/docker/registry.py matches none of them. The plan does not mention this gap. Add src/devops_cli/docker/registry.py to the filter and to the spec scenario. Or write in design.md why the gap is accepted.
nit PR body The body says "13 pulls" and "an httpx2 client". The proposal measured 14 of 32 pins on Docker Hub, and the design uses RegistryFake with stub_web. The body becomes the squash commit message. Proposal Feasibility: pinned 32 hub 14. design.md names RegistryFake and stub_web. Change the body to 14 pulls and name RegistryFake and stub_web.

Dropped finding: the lens also noted that task 3.1 puts command tests in tests/k8s/test_image_pins.py and not in tests/commands/k8s/. The existing tests already sit in tests/k8s/, so the plan keeps the current layout. This is not a defect.

Checks that I ran or weighed:

  • Re-ran the grep for counts each read and after the hour at the PR head. Result: the stale text exists in the paths listed above.
  • Read the image-pins paths filter in .github/workflows/ci.yml. It does not match registry.py.
  • Confirmed that src/devops_cli/docker/registry.py exists and that tasks 1.1 and 2.2 move code into it.
  • Lens checks that passed: every named path exists or is deleted by the plan; openspec validate --strict is valid; uv run devops openspec check passes; the premise holds (32 pinned images, 14 on docker.io; a HEAD request to docker.io gives 302 and to registry-1.docker.io gives 401); no newer commit touches the module, tests or spec; MODIFIED requirements keep both original scenarios; dry run returns no output, so no image reaches the resolver; the verify commands exist; group sizes are small; test-first order holds; the title is a valid Conventional Commit; the body has Plans #2610 and no closing keyword.

Task 4.1 and 4.2 now search for the stale text "counts each read" and "after the hour", not only the word imagetools. A new task 4.3 adds src/devops_cli/docker/registry.py to the paths filter of the image-pins job.
@dan-petty

Copy link
Copy Markdown
Owner

Fixes for the three review findings (commit f7e4b1b, merged with the current main):

  1. Tasks 4.1 and 4.2 now search for imagetools, Docker Hub counts, counts each read and after the hour. The checks print the stale lines on the base and nothing after the task. The tasks edit the text in docs/SDLC.md, k8s/README.md, the ci.yml comment and the help text that the three generated documents copy.
  2. New task 4.3 adds src/devops_cli/docker/registry.py to the image-pins paths filter in .github/workflows/ci.yml, and to the path list in docs/SDLC.md. It has a verification command. The proposal says the same.
  3. The PR body now says 14 pulls (14 of 32 pins, counted again) and names RegistryFake with stub_web. It keeps the sentence about the overlap with plan build(deps): Type docker-py with types-docker #2603 (PR docs(openspec): plan #2603 Type docker-py with types-docker #3071).

@dan-petty

Copy link
Copy Markdown
Owner

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

Recommendation: hold. Task 4.3 breaks an existing test, and no task fixes that test. Fix the plan first, then it can merge.

Reviewed head: f7e4b1b.

Severity Where Problem Evidence Fix
major tasks.md group 4 (task 4.3 and the Changes line); tests/invariants/test_workflow_contracts.py lines 1270-1274 Task 4.3 adds - 'src/devops_cli/docker/registry.py' to the paths filter of the job image-pins. An existing test compares that filter to an exact string of three paths. No task edits this test. Group 4 cannot end green as written. The test asserts "filters": "pins:\n - 'k8s/**'\n - 'src/devops_cli/**/image_pins.py'\n - '.github/workflows/ci.yml'\n". grep -n test_workflow_contracts in the change folder finds the file only as a verification command (tasks.md lines 39 and 43) and as a "must keep passing" item (proposal.md line 37). It is never a file to edit. The test docstring (line 1248) says "the command's two modules". Add tests/invariants/test_workflow_contracts.py to the Changes line of group 4. In task 4.3, name the edit: add the new filter line to the expected filters string and fix the docstring. Fix the proposal line 37.
minor specs/k8s-image-pins/spec.md of the change; openspec/specs/k8s-image-pins/spec.md lines 38-42 Task 4.3 changes the paths filter. The base spec states the exact filter in the scenario "The job's steps". The delta has no MODIFIED entry for the requirement "The CI job checks a pull request that changes the pins". After the archive, the main spec lists three paths and ci.yml lists four. Base spec line 42: "paths filter on k8s/**, src/devops_cli/**/image_pins.py and .github/workflows/ci.yml". The proposal (line 20) says the delta "modifies two requirements"; neither is this one. Add the whole requirement to the MODIFIED section, with src/devops_cli/docker/registry.py in the scenario. Change "two requirements" to "three" in the proposal and the Capabilities list.

Notes (not findings): the Feasibility text cites origin/main at 6e8b4ca, and origin/main is now aad0115. The design leaves TaggedImage.tag open for a digest-only image. Group 2 must decide between an empty string and an optional field.

Checks that I ran (and lens checks that I accepted):

  • Read lines 1244-1280 of tests/invariants/test_workflow_contracts.py in a worktree at the PR head. The exact filter string is there.
  • Searched the change folder for test_workflow_contracts. It appears only in verification text and in the proposal "must keep passing" list.
  • Read the base spec scenario at openspec/specs/k8s-image-pins/spec.md line 42.
  • Checked that the PR head SHA from the API equals the worktree HEAD (f7e4b1b).
  • Lens result on the plan: all 24 existing paths exist at origin/main. Two anonymous HEADs of ratelimitpreview/test returned ratelimit-remaining: 100;w=3600 with a docker-content-digest. collect_image_pins gives 32 pins, 14 on Docker Hub. openspec validate 2610-devops-k8s-image-pins-resolves-with --strict is valid. uv run devops openspec check passes. The PR body has "Plans perf(k8s): use tag_digest HEAD for image pins #2610" and no closing keyword. Test-first order is correct for groups 2 and 3.

Task 4.3 now edits the exact paths-filter string in tests/invariants/test_workflow_contracts.py, so group 4 ends green. The spec delta modifies the requirement for the CI job and lists the registry module in the filter.
@dan-petty

Copy link
Copy Markdown
Owner

Fixes for the re-review (commit e136e0d):

  1. Task 4.3 now edits the exact filters string in tests/invariants/test_workflow_contracts.py and the test docstring. The test file is in the Reads and Changes lines of group 4. The check of 4.3 greps both files and runs that test. The proposal says that task 4.3 edits the test.
  2. The spec delta now modifies the requirement "The CI job checks a pull request that changes the pins". Its scenario lists four paths, with src/devops_cli/docker/registry.py. The proposal says "three requirements" and lists the new one.
  3. Proof in a scratch worktree at the old head: with the filter line added in ci.yml and in the test, test_workflow_contracts.py passes (90 passed). With the ci.yml edit alone it fails (1 failed). So the edits must go in one commit.

devops openspec check, tests/invariants/test_change_folders.py (17 passed) and openspec validate 2610-devops-k8s-image-pins-resolves-with --strict pass.

@dan-petty

Copy link
Copy Markdown
Owner

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

Recommendation: merge. The plan is sound, its premise holds, and I found no finding above nit. The four nits can be fixed in this PR or in the first implementation commit.

Severity Where Problem Evidence Fix
nit tasks.md 3.2 The delete list does not name _error_line. It becomes dead code when the old resolve_image is rewritten. src/devops_cli/k8s/image_pins.py line 308 defines it. Line 328 is the only call, inside resolve_image. git grep -n _error_line -- src tests shows no other use (_format_error_line in roadmap/run.py is a different function). Add _error_line to the delete list of 3.2. Add ! git grep -n _error_line -- src tests to its verification.
nit tasks.md 3.2 and 3.3 After 3.2 the repo does not type-check. Task 3.2 deletes inspect_command. The fake-file tests that import it are deleted only in 3.3. tests/k8s/test_imagetools_contract.py lines 17, 31, 49 and 62 use inspect_command. tests/support/imagetools_recording.py line 70 imports it. Move the deletion of the fake files and their tests into 3.2, or put 3.3 first.
nit tasks.md 3.2 and 4.2 The rule in openspec/config.yaml says a group that changes a command or message regenerates the docs. The plan puts the regeneration in 4.2. This conflicts with the rule "documentation comes last". The plan does not say which rule it chose. openspec/config.yaml line 37. The docs row of devops ci runs devops docs check. Add devops docs generate --sync-readme to the verification of 3.2, or write one sentence in group 4 that says the regeneration waits.
nit design.md decision "Read a digest reference in tagged_image"; tasks.md 2.1 The plan adds digest (default None) to TaggedImage. It does not say what tag holds for a digest-only reference. src/devops_cli/docker/registry.py lines 36-41: tag: str has no default. tag_digest builds the manifest URL from tag. State the type of tag for a digest-only reference. State that tag_digest puts the digest in the URL when it is present.

Checks that I ran or confirmed (lens plan, verdict ok):

  • Every path in the Reads and Changes lines, the task code spans and the verify commands exists in the worktree. The devops subcommands that the tasks use exist.
  • Premise: a HEAD to docker.io/v2/library/nginx/manifests/1.27 gives 302. registry-1.docker.io gives 401 with a Bearer challenge. Two anonymous HEAD requests with a token leave ratelimit-remaining at 100;w=3600 and return docker-content-digest.
  • collect_image_pins gives 32 pinned images, 14 on Docker Hub, 0 local, 0 latest, 2 managed. The stale-text grep for 4.2 gives 10 lines in 9 files, as the plan says.
  • openspec validate --strict says the change is valid. uv run devops openspec check passes. The three MODIFIED requirements exist in the base spec and are copied whole.
  • The reused fakes (RegistryFake, stub_web) exist and the tests in 3.1 can be built without a new fake.
  • Test order: groups 2 and 3 start with a test that fails on the base. All verify commands use uv run devops ci test.
  • PR hygiene: the title is a Conventional Commit. The body says "Plans perf(k8s): use tag_digest HEAD for image pins #2610" and has no closing keyword. The overlap with the plan for build(deps): Type docker-py with types-docker #2603 (PR docs(openspec): plan #2603 Type docker-py with types-docker #3071) is named.
  • I re-read the evidence for the first nit in the worktree (git grep) and for the fourth nit in registry.py.

@dan-petty
dan-petty merged commit de06211 into main Nov 1, 2026
19 checks passed
@dan-petty
dan-petty deleted the perf/2610-devops-k8s-image-pins-resolves-with branch November 1, 2026 22:46
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