Repository navigation
[0.38] test(registry): enterprise registry lifecycle stage 1 (#3299) - #4015
Merged
Daniel Meppiel (danielmeppiel) merged 6 commits intoNov 21, 2026
Merged
Conversation
1 of 8 tasks
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fluffy-garbanzo
branch
from
November 20, 2026 00:40
5ad9c78 to
5a5e8b9
Compare
This was referenced Nov 20, 2026
Closed
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fluffy-garbanzo
branch
from
November 21, 2026 08:27
5a5e8b9 to
39c7c39
Compare
Move the duplicated Registry HTTP API handlers from the registry redirect and upgrade replay lifecycle tests into tests/utils/local_package_registry.py. The fixture serves exactly the PUT (or seeded) bytes keyed by package and version, enforces immutability, and can simulate an artifact outage or wrong bytes. Existing tests keep their assertions unchanged. Refs #3299 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Drive the installed CLI through producer publish (dependency first), employee direct registry install, cold-CI frozen replay with the producer Git host unreachable, artifact outage and wrong-bytes fail-closed, audit --ci, uninstall preserving an unrelated file, and registering and browsing a public HTTPS catalog against the shared loopback Registry HTTP API fixture. Marked integration, requires_apm_binary and lifecycle_smoke. Refs #3299 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Each networked step now asserts no request reached the producer Git host before its exit code, git may speak HTTPS so a Git fallback is observed rather than blocked locally, and the fault steps pin the archive-hash and HTTP 503 reasons so a bypassed archive hash is not masked by the tree hash. Refs #3299 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…owse egress_step clears observations per step, so the add step's credential egress was never asserted. Steps now take token_hosts and both catalog steps require that no host receives the registry token. Refs #3299 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…3299) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-fluffy-garbanzo
branch
from
November 21, 2026 08:34
39c7c39 to
dd4404f
Compare
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 21, 2026 08:48
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 08:48
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-fluffy-garbanzo
branch
November 21, 2026 08:52
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The registry fixture rejects valid encoded package/version requests and accepts invalid archives as successful uploads, allowing tests to diverge from the Registry HTTP API contract.
2 open issues
What changed in this PR
Adds stage 1 of #3299: installed-CLI coverage for enterprise package distribution through APM’s Registry HTTP API, using a local fixture rather than an external vendor service. Later marketplace lifecycle stages remain separate.
Changes:
- Introduces a shared registry fixture and migrates three existing lifecycle suites to it.
- Adds publish, install, cold frozen replay, failure, audit, uninstall and public catalog browsing scenarios.
- Documents the enterprise workflow and adds a changelog entry.
| File | Description |
|---|---|
tests/utils/local_package_registry.py |
Adds an in-memory registry with stored uploads, authentication and download faults. |
tests/integration/test_registry_redirect_origin_lifecycle.py |
Delegates registry responses to the shared fixture. |
tests/integration/test_registry_redirect_location_hardening_lifecycle.py |
Reuses the fixture while retaining redirect scenarios. |
tests/integration/test_enterprise_registry_lifecycle.py |
Adds producer, employee and cold-CI lifecycle coverage. |
tests/integration/test_auth_upgrade_lock_replay_lifecycle.py |
Reuses registry and deterministic archive helpers. |
docs/src/content/docs/reference/registries.md |
Documents enterprise publishing, installation and CI replay. |
CHANGELOG.md |
Notes the documented and tested enterprise workflow. |
Review effort: Balanced
Comment on lines
+116
to
+122
| tail = unquote(path[len(prefix) :]) | ||
| package, separator, rest = tail.partition("/versions") | ||
| if not separator or not package: | ||
| return _problem(404, "Not found", path) | ||
| if rest == "" and request.method in ("GET", "HEAD"): | ||
| return self._versions(package, path) | ||
| version, _, action = rest.lstrip("/").partition("/") |
Comment on lines
+154
to
+157
| if not request.body: | ||
| return _problem(400, "Empty archive", path) | ||
| artifact = RegistryArtifact(package, version, request.body, content_type) | ||
| self.artifacts[(package, version)] = artifact |
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…log replay The scripted Registry HTTP API gateway now serves only seeded packages (#4015 extracted it into tests/utils/local_package_registry.py), so the scenario seeds acme/widget 1.0.0 and simulates changed bytes with the registry's wrong-bytes download fault instead of swapping a served archive. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…log replay The scripted Registry HTTP API gateway now serves only seeded packages (#4015 extracted it into tests/utils/local_package_registry.py), so the scenario seeds acme/widget 1.0.0 and simulates changed bytes with the registry's wrong-bytes download fault instead of swapping a served archive. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…log replay The scripted Registry HTTP API gateway now serves only seeded packages (#4015 extracted it into tests/utils/local_package_registry.py), so the scenario seeds acme/widget 1.0.0 and simulates changed bytes with the registry's wrong-bytes download fault instead of swapping a served archive. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 21, 2026
…log replay The scripted Registry HTTP API gateway now serves only seeded packages (#4015 extracted it into tests/utils/local_package_registry.py), so the scenario seeds acme/widget 1.0.0 and simulates changed bytes with the registry's wrong-bytes download fault instead of swapping a served archive. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged
3 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
TL;DR
Stage 1 of #3299: one APMLifecycle scenario family drives the installed CLI through the enterprise registry path — producer publish, employee install, cold-CI
install --frozen,audit --ci, uninstall, and browsing a public HTTPS catalog. It runs against an APM-controlled loopback implementation of the documented Registry HTTP API, not a vendor service. The duplicated registry handlers in three existing lifecycle tests now use one shared fixture that serves exactly the uploadedPUTbytes, keyed by package and version.Refs #3299 — stage 1 only; the remaining stages are listed below. Passing stage 1 does not complete #3299.
Note
Lifecycle smoke runs on Linux PRs and in the merge queue. macOS ARM release validation selects
lifecycle_smokethroughMACOS_MARK_EXPR, so the new markers enroll the scenario in all three. No workflow file changes.Problem (WHY)
test_registry_redirect_origin_lifecycle.py,test_registry_redirect_location_hardening_lifecycle.py,test_auth_upgrade_lock_replay_lifecycle.py) each hand-rolled/versionsand/downloadhandlers for one hard-coded package, and none served the bytes from a realPUT.resolved_hashsits on top of a second tree-hash check (content_hash). If the archive hash is bypassed, the tree hash still rejects wrong bytes, so a test that only checks the exit code cannot tell the two apart.Approach (WHAT)
tests/utils/local_package_registry.py: the three documented endpoints with immutable versions (409), optional bearer auth, andoutage/wrong-bytesdownload faults.tests/integration/test_enterprise_registry_lifecycle.py, markedintegration,requires_apm_binaryandlifecycle_smoke. It uses isolated producer, employee and cold-CI environments.registry HTTP 503,archive sha256 mismatch).Implementation (HOW)
tests/utils/local_package_registry.py(new):LocalPackageRegistry.handle()is aScriptedHttpsProxyorigin handler. It storesRegistryArtifact(package, version, data, content_type),/versionsreturns spec-shaped digests (sha256:<hex>), and/downloadreturns the stored bytes. It also providesflat_registry_archive()(a deterministic zip builder) andsha256_digest().test_registry_redirect_origin_lifecycle.py,..._location_hardening_...,test_auth_upgrade_lock_replay_lifecycle.py: the gateways keep their redirect logic and delegate payloads to the shared registry. The consumer seedsacme/widget, and publish scenarios start empty, so aPUTstill returns201. The auth-upgrade archive is byte-identical to the old one, which the pinned fixture lock hashes require.tests/integration/test_enterprise_registry_lifecycle.py(new, 2 tests):acme/baseand thenacme/widget, which depends onacme/base#1.0.0.acme/widget#1.0.0withregistry.corp.urlset. The test assertssource: registry,version,resolved_url,resolved_hash(thePUTdigest),resolved_by, and that the deployed bytes equal the archive members.apm.yml,apm.lock.yamland the sentinel file. It runs--frozenthree times: artifact outage (fails), wrong bytes (fails), healthy (passes). After each failure the lockfile is unchanged and nothing is deployed. Thenaudit --ci -f jsonmust pass every check. The employee uninstalls and the unrelated sentinel must survive.https://catalog.corp.example/apm/marketplace.jsonand browses it. No registry token reaches the catalog host.docs/.../guides/registries.md: adds a ~25-line "Enterprise workflow" subsection in section 5.CHANGELOG.md: one line at the bottom of### Added.Diagrams
Legend: the actors and hosts in the main scenario. Dashed arrows are requests that must never happen; the egress check catches them.
sequenceDiagram participant P as Producer env participant E as Employee env participant C as Cold-CI env participant R as registry.corp.example (LocalPackageRegistry) participant G as github.com (producer Git, 503 recorder) P->>R: PUT acme/base 1.0.0, then acme/widget 1.0.0 E->>R: GET versions + download (install acme/widget#1.0.0) Note over E: lock pins resolved_url + resolved_hash E->>C: copy apm.yml, apm.lock.yaml, sentinel only C->>R: GET download (outage 503 -> fail, nothing deployed) C->>R: GET download (wrong bytes -> archive sha256 mismatch) C->>R: GET download x2 (frozen replay passes, lock byte-identical) C--xG: any request fails the step Note over C: apm audit --ci -f json, all checks pass Note over E: apm uninstall keeps the unrelated sentinelTrade-offs
--verbose. Without it, the default output for both an outage and a hash mismatch reads--frozen: restored MCP declarations differ from apm.lock.yaml ... package manifest not found, which is misleading. I pinned the verbose reason so the hash-bypass mutant cannot be hidden by the tree-hash check. I did not fix the default wording: it is outside this test-only scope and is reported to the coordinator for a separate issue.GIT_ALLOW_PROTOCOL=file:https). If git were limited tofile, a Git fallback would be blocked locally and never reach the recorder. With HTTPS allowed, it is observed as a producer-Git request. A sanity mutant that routes registry dependencies to Git hitgithub.comas expected.APM_E2E_TESTS=1in the child environment turns off the CLI's own update check, which would otherwise callapi.github.comand look like egress.githubsource is not installable from a registry until Registry-backed marketplace entries cannot install by name or replay with --frozen #4009, so the test only registers and browses.Benefits
--frozen→ audit → uninstall) runs through the installed CLI on every Linux PR, in the merge queue, and in macOS ARM release validation. It takes about 11s locally.PUT, not a pre-baked archive.EnterpriseRegistryWorld).Follow-up after #4022
main, tighten theci-frozen-outageandci-frozen-wrong-bytesassertions so they check the default message (without--verbose). [0.38] fix(registry): lockfile replay tolerates a mirror URL when the hash matches (#4013) #4022 fixes the misleading frozen-restore error.Pending stages (proposed text for the #3299 body)
Important
This PR does not edit #3299. The block below is the proposed issue-body text for the coordinator to apply.
Rebase onto v0.37.0 main (decision log)
CHANGELOG.md: the line moved under the new## [Unreleased]->### Addedabove[0.37.0](this is 0.38 work), reworded "registries guide" -> "registries reference".pytest.mark.e2e(installed CLI, like the sibling registry tests) andpromise("req-rg-001", "P-LAW-lockfile.frozen_preserves_bytes", "P-OWN-credential-origin-scope"), the archive-hash trust anchor, frozen replay keeping lock bytes, and the registry token staying on its origin -- each asserted by the scenario. Folded into the scenario commit so the docs commit stays last.Docs re-home after #3996
mainlayout)docs/src/content/docs/guides/registries.md, section 5, new "Enterprise workflow: publish, install, replay in CI" subsectiondocs/src/content/docs/reference/registries.mdsection 5 (links match that page)All
docs/**edits are in the last commit (docs(registries): ...), so the rebase or re-home touches only that commit.Issue and approved scope
Issue: Refs #3299
Human scope-approval comment: #3299 (comment) (
apm-scope:v1;scripts/governance/eligibility.cjs→state: record-present, trusted sha67936cd)Does this PR complete the issue, or what remains? No. It delivers stage 1. The pending stages and their owning issues are listed above.
Type of change
Testing
Scenario evidence
test_enterprise_registry_lifecycle.py::test_enterprise_registry_publish_install_frozen_replay_audit_uninstallapm audit --cipasses after the frozen replay; uninstall keeps unrelated files...::test_employee_registers_and_browses_public_https_catalogtest_registry_redirect_origin_lifecycle.py,test_registry_redirect_location_hardening_lifecycle.py,test_auth_upgrade_lock_replay_lifecycle.pyKilled-mutant runs (recorded)
Each mutant was applied to
src/, the scenario was run withAPM_BINARY_PATH=.venv/bin/apm(editable install), and the file was reverted withgit checkout.install/phases/resolve.py, in the lockfile-replay branch:requests.get("https://github.com/{repo}.git/info/refs?service=git-upload-pack"), errors swallowed (install otherwise succeeds)step=ci-frozen-outage reached hosts other than registry.corp.example: [('github.com', 'GET', '/acme/widget.git/info/refs')]deps/registry/extractor.py::verify_sha256:if actual != expected→if False and actual != expectedci-frozen-wrong-bytes:archive sha256 mismatchmissing; the tree-hash check rejected the bytes insteadintegration/cleanup.py:stale_target.unlink()→ unlink every file in the stale file's directoryAssertionError: uninstall deleted the unrelated sentinel fileadd(peer-review follow-up)marketplace/client.pyURL-catalog fetch: addAuthorization: Bearer $APM_REGISTRY_TOKEN_CORPwhenaddis inargvstep=add sent the registry token to {'catalog.corp.example'}A non-recorded sanity mutant (
resolve.py:if False and dep_ref.source == "registry") sent the employee install tohttps://github.com/acme/widget.gitthrough the recorder, which confirms that a real Git fallback is observable.Local validation commands
CI on
dd4404fa4(rebased on mainbfc09299f, after v0.37.0): see the checks tab; results are reported to the program manager.How to test
uv sync --frozen --extra devAPM_BINARY_PATH=.venv/bin/apm uv run --extra dev python -m pytest -q tests/integration/test_enterprise_registry_lifecycle.py→ 2 passedgit checkout -- src/uv run --extra dev python -m pytest -q -m 'lifecycle_smoke and not lifecycle_merge_group' tests/integration --collect-only -q | grep enterprise_registry→test_enterprise_registry_lifecycle.py: 2Changelog
## [Unreleased]inCHANGELOG.md: user-visible effect first, 25 words or fewer, ending with(#PR); breaking changes only under upgrade notes; no Highlights; see.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedCo-authored-by: Copilot [email protected]