mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #84] [MERGED] test(image): cover ACR referrer discovery at the regctl boundary #167
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#167
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/84
Author: @johnsonshi
Created: 7/30/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @yingdi-shan
Base:
main← Head:test/acr-referrer-discovery-coverage📝 Commits (3)
0accb6ctest(image): cover ACR referrer discovery at the regctl boundary0bb6d2etest(resolver): correct multi-referrer comment to match resolver behaviour5f5e61ctest(resolver): locate fake regctl fixtures relative to $0📊 Changes
1 file changed (+228 additions, -8 deletions)
View changed files
📝
src/image/resolver.rs(+228 -8)📄 Description
Summary
Follow-up for code quality on the review feedback in
https://github.com/kvcache-ai/AgentENV/pull/58#pullrequestreview-4805170907.
Both non-blocking suggestions from that review are addressed here. This PR changes no
production code — it is test-only.
1. Coverage now starts at the regctl boundary, not at the parser
The review noted that coverage started at
parse_overlaybd_referrer, so reintroducing--filter-artifact-typeto theregctl artifact listcommand would leave tests green whilebreaking ACR discovery.
discover_overlaybd_referrer_lists_referrers_unfiltered_and_finds_acr_streaminginstalls a fakeregctlthat records its argv and replays a canned referrers index, then asserts the listing isunfiltered and that the ACR referrer is returned.
I verified the test actually closes the gap by mutation — reintroducing the flag:
All seven parse-level tests stay green; only the new test fails. That is exactly the regression
the review described.
The same fake-regctl harness also covers the failure path, which previously had no test: a
registry error must surface as an error rather than
Ok(None), sinceOk(None)would silentlydowngrade to a local pull-and-convert.
2. Fixtures use literal wire values
Fixtures now use the literal artifactType strings rather than the implementation constants, so an
unintended edit to a constant is caught instead of being mirrored into the fixture.
overlaybd_referrer_artifact_types_match_published_wire_valuesadditionally pins both constantsand their preference order, so a typo fails with a readable diff rather than only surfacing as a
missed referrer.
3. Fake regctl fixtures are located relative to
$0The fake
regctlscript originally interpolated absolute fixture paths into single-quoted shellliterals.
TempDiris created beneathTMPDIR, so aTMPDIRcontaining an apostrophe or newlinewould break the generated script rather than fail cleanly.
The script now derives its own directory from
$0and reachesargv,stdoutandstderrthrough a quoted shell variable, so no filesystem path is embedded in shell source. This matches
the fully static fake-helper script already used in the ACR client tests
(
snapshot::repository::backends::common::acr::client). Verified by running the resolver testsunder
TMPDIR="/tmp/it's a dir".Wire format verified against a real registry
Rather than trusting the fixture, I re-derived it from a live ACR registry with the same command
the code issues:
The artifactType literal matches byte-for-byte, so the fixture is faithful.
On platform selection, measured against the same registry:
regctl artifact liststreamtest:v1— multi-arch tag, resolves to an indexamd64+arm64streamtest@sha256:c4116d4d…— thelinux/amd64childamd64onlyresolve_fetched_manifestpassesfetched.selected_image_refinto discovery, andoci_imagepins that to the platform-resolved manifest digest via
image_ref_with_digest(¤t_ref, &manifest_digest). Discovery therefore never receives anindex, and the subject it does receive carries exactly one referrer, for the right architecture.
parse_overlaybd_referrer_selects_first_of_acr_per_platform_referrerskeeps the two-referrerpayload as a defensive lock on first-match selection.
The discovery path these tests cover was also exercised end to end against a live Premium ACR
registry and an AKS cluster, where a sandbox booted from an ACR artifact-streaming image — though
that exercises the production change from #58 rather than anything in this test-only PR.
Test results
cargo fmt --checkclean,cargo clippy --all-targets -- -D warningsclean.origin/main(8174bd9)The 3 failures are pre-existing and identical on unmodified
main(snapshot::p2p::tests::local_overlaybd_layers_*and
…::acr::source_image::tests::plans_descriptorless_sparse_overlaybd_delta_for_dense_export);they appear environment-specific to my aarch64 container and are unrelated to this change. Net
+4tests, no regressions.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.