mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
94c0504bca0021b70d9ca8e111b7c19db9f5dbb7
37
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6be7641359 |
feat(codeartifact): list a package version's direct dependencies (#8474)
Adds ListPackageVersionDependencies, extracted from each format's own metadata
file: the POM for Maven, package.json for npm, the wheel/sdist metadata for
pypi, and the .nuspec for NuGet. Scoped to exactly npm/pypi/maven/nuget,
matching AWS's own documented Valid Values for this action's format
parameter; generic, cargo, ruby, and swift are rejected with a
ValidationException even though cargo's own sparse index already carries the
data, since AWS does not document cargo as a valid format for this specific
action.
A new RepositorySidecarManager#listPackageVersionDependencies default method
(throwing UnsupportedOperationException, the same convention
listPackageVersionAssetNames already uses) is overridden by all four valid
formats' sidecar clients:
- ReposiliteSidecarClient tries the version's standard release POM name
first, falling back to the real directory listing for a -SNAPSHOT
version's own timestamped filename (and surfacing a genuine fetch error
through that same fallback, rather than reporting it as an empty
dependency list), and parses it with a new PomDependencies helper. That
helper only ever walks direct children of a known element rather than
Document#getElementsByTagName, specifically so a managed version pin under
dependencyManagement or a conditionally-activated dependency under profiles
is never mistaken for a real, always-active dependency. One synthetic
"parent"-typed entry is emitted when <parent> is present. No ${property}
placeholder resolution on a dependency's raw version text, a documented
limitation.
- VerdaccioSidecarClient reads dependencies/devDependencies/
peerDependencies/optionalDependencies straight off the already-fetched
packument's version document, splitting a scoped dependency name the same
way CodeArtifactNpmDataPlane already does for the package's own name.
- BagetterSidecarClient reuses the same already-proven .nuspec fetch
fetchPackageVersionReadme falls back to, with NuspecXml extended with a new
dependencies() method that flattens every <group targetFramework> block
(and the older schema's bare <dependency> with no group wrapper) into one
list.
- PypiserverSidecarClient is new ground: a new PypiVersionMetadata helper
opens a real wheel via plain ZipInputStream, or an sdist via GZIPInputStream
plus a new minimal hand-rolled TAR reader (classic 512-byte headers only,
no long-name or PAX support) for .tar.gz/.tgz, or via ZipInputStream for a
.zip sdist, bounding the total bytes it will ever decompress while
scanning one archive so a small, highly compressible entry ahead of the
real metadata entry cannot force unbounded decompression. Only the exact
top-level dist-info/METADATA or PKG-INFO entry is matched, never a nested
one, so a wheel or sdist that vendors another package's own dist-info
alongside its own cannot have that vendored entry mistaken for the real
one. Requires-Dist headers are parsed with RFC822 continuation-line
folding, stopping at the blank line that ends the real header block so a
Requires-Dist-looking line inside the package's own long description is
never read as a real dependency. Any "; extra == ..." environment marker
is kept verbatim in versionRequirement rather than stripped, since
PackageDependency has no marker field. A release available only as a real
.tar.bz2/.tar.xz sdist is reported as having no dependencies rather than
attempted, since bzip2/xz decompression would need a new runtime
dependency this codebase deliberately avoids.
XmlParser gained a new parseDocument(byte[]) overload so a POM or .nuspec's
own raw bytes reach the parser directly: the existing String-based overload
pre-decodes as UTF-8 before the parser ever sees the original bytes, which
would silently corrupt or fail to parse a document that declares a different
encoding. PomDependencies and NuspecXml both now go through the byte-based
overload.
CodeArtifactService#listPackageVersionDependencies validates the format
against this narrower set before the shared validatePackageCoordinates call,
which already enforces the maven-namespace-required and
pypi/nuget-namespace-forbidden rules AWS documents for this action.
Pagination's cursor now folds in each entry's own original-list index as a
final tiebreaker, so two byte-for-byte identical dependencies (e.g. the same
NuGet package id declared under two different target-framework groups with
the same version requirement) never share a cursor and silently drop across
a page boundary.
Verified with standalone parser unit tests, per-client wire-contract tests
against a JDK HttpServer fake, CodeArtifactServiceTest dispatch and
validation cases, and a live Docker-gated round trip added to all four
existing format Docker integration tests, each publishing a real artifact
with real dependency metadata through the real sidecar container.
|
||
|
|
85492a4147 |
feat(codeartifact): retain Cargo crates from a same-domain upstream repository (#8423)
16f-UPSTREAM-REPO (#8261) gave every container-backed format its own repository-to-repository upstream importer except cargo, since cargo didn't exist yet when that PR merged. Adds cargo's own share of it. CodeArtifactCargoUpstreamRepositoryImporter mirrors CodeArtifactNuGetUpstreamRepositoryImporter's own claim/fence/walk shell (transitive search via resolveUpstreamSearchOrder, Archived/Disposed propagation, falling through to UpstreamExternalConnectionFetch for the last leg through a candidate's own external connection), reusing CodeArtifactCargoExternalConnectionImporter's own index-line/wire-body helpers directly rather than duplicating the index-shape to publish-shape mapping a second time. The one new piece: mergeUpstreamRepositoryVersions, a real multi-version sparse-index merge across the whole upstream chain, the same reason mergeExternalVersions exists for the external-connection side. Unlike pypi's own single-target additionalInternalFilenames, this walks every reachable upstream candidate in search order rather than stopping at the first one with anything to offer, since it is merging real version lines across however many hops the chain has; each candidate's own external connection, if it has one, is layered in too via a direct mergeExternalVersions call with that candidate as the repository argument. Wired into CodeArtifactCargoController's existing two call sites, matching every sibling controller's own "external connection or upstreams, never both" shape. A live Docker integration test proves the real synthesized wire body this importer builds from one Kellnr container's own sparse-index line is accepted by a second, genuinely different Kellnr container, not just internally consistent against mocks. |
||
|
|
15a632e446 |
feat(codeartifact): support the cargo (crates.io) registry format (#8370)
CodeArtifact's Rust/Cargo repositories had no native support at all: no sidecar, no wire protocol, no external connection. Adds it following the same shape as the existing Maven/npm/pypi/NuGet container-backed formats. KellnrSidecarManager/KellnrSidecarClient run a real Kellnr container per cargo-enabled repository and speak its native HTTP API for publish, download, and the sparse index. CodeArtifactCargoController implements the real `cargo` sparse-registry wire protocol (publish, download, sparse index lookup, config.json) and forwards Kellnr's own publish rejections (e.g. republishing an existing version, which the Cargo Book documents as permanently disallowed) verbatim rather than swallowing them into an opaque error. Adds the `public:crates-io` external connection via CargoExternalConnectionClient (real index.crates.io/static.crates.io wire calls) and CodeArtifactCargoExternalConnectionImporter, reusing the existing claim/fence/retention-origin machinery the same way NuGet's own importer does. Cargo's sparse index covers every version of a crate name in one file and a real cargo client always consults it first, so unlike the other formats' importers this one also merges real upstream-only version lines into the local index response (mergeExternalVersions), a read-only proxy step with no retention write of its own, so an upstream-only crate is actually visible to a client's dependency resolution before anything is retained. Fixes against the live Kellnr/crates.io protocols found while addressing review: KellnrSidecarClient now implements listPackages (its absence made every ListPackages call 500 once cargo joined the container-backed formats); sparse-index bucket paths are lowercased per the Cargo Book's own spec (crates.io's own index is case-sensitive about this even though a crate's real name isn't); the admin account behind Kellnr's internal publish token is given a fresh random password per container rather than Kellnr's own shared default; a stale cached publish token (e.g. after a silent container restart) is retried once rather than 401ing forever; both publish-body parsing and the external sparse-index fetch are now bounded against an oversized allocation; a renamed dependency's alias and real name are mapped correctly between the index and publish shapes, and features2/links/rust_version now survive a retained crate's synthesized metadata; the Kellnr image is pinned to the exact version this was built and tested against rather than a floating major tag. Known gaps, called out in docs/services/codeartifact.md: no repository-to-repository upstream importer yet for cargo (every other native format already has one), and no yank/owner/search routes. |
||
|
|
e286aef015 |
fix(codeartifact): resolve upstreams in AWS's order, through their external connections (#8356)
Three ways a read through upstream repositories differed from the User Guide: - Upstreams were searched breadth-first. "If an upstream repository has its own upstream repositories, the same logic is used to find a package version before moving to the next upstream repository": the guide's own example, my_repo with upstreams A and B, A with C and D and D with E, is searched my_repo, A, C, D, E, B. The walk is depth-first in each repository's listed order now. - A version an upstream had itself retained named that upstream as its origin, and one the upstream got from public:npmjs came back INTERNAL. A version's DomainEntryPoint is where it "originally entered" the domain, so a retained version now carries its upstream's own entry point: the external connection, EXTERNAL, or the repository it was published to, however many upstreams it came through. It is read again when the version's claim is confirmed, so a copy made while the upstream's own fetch is still finishing gets that fetch's connection. - An upstream's external connection was never consulted, so a version no upstream had fetched yet was a 404. AWS fetches it through the upstream's connection and retains it there and in the repository the request was made to. A miss at every upstream now tries the external connections of the upstreams in the same order, for npm, Maven, PyPI and NuGet, and a packument, Simple index or maven-metadata.xml read through such an upstream offers what its connection has. That fetch skips a version Archived or Disposed at the upstream, or here in the Simple index, reads this repository's fences before it starts, so a deletion during it is not undone, and passes on an npm client's ask for the full packument. The four formats share it in UpstreamExternalConnectionFetch. |
||
|
|
63607e899d |
fix(codeartifact): give every domain its root package group /* (#8355)
The User Guide: "Every domain in CodeArtifact automatically contains a root package group", /*, which "can be modified, but cannot be deleted". CreateDomain created no group, so on a fresh domain ListPackageGroups was empty, DescribePackageGroup and GetAssociatedPackageGroup answered ResourceNotFoundException for /*, a package no group reached had no group at all, and DeletePackageGroup /* succeeded on a group a caller had made. CreateDomain creates the root with the domain now. Its description is "Default root package group" and each of its restrictions is ALLOW, as recorded against AWS, so a group under it inherits from it rather than from nothing. CreatePackageGroup /* is refused as the group it is, and DeletePackageGroup /* with ValidationException "The root package group, '/*', cannot be deleted.", AWS's own sentence. A domain stored before this gets its root once storage is loaded at startup. |
||
|
|
d9a43012de |
feat(codeartifact): retain versions from repository-to-repository upstreams (#8261)
Repositories can already declare up to 10 same-domain upstream repositories via CreateRepository/UpdateRepository, but nothing ever consulted that list: a native package-manager request for a version missing locally 404ed even when an upstream had it, and CopyPackageVersions's includeFromUpstream flag was accepted on the wire but documented as a no-op. Adds a shared, cycle-safe breadth-first resolver over the upstreams graph (UpstreamRepositoryResolver), reused by validateUpstreams (now rejecting transitive cycles, not just direct self-reference, with an independent uncapped reachability check so a cycle whose closing edge sits beyond the resolution search cap still gets caught), by four new per-format importers (Maven/npm/pypi/NuGet) wired into each native controller's existing "local miss" hook, and by CopyPackageVersions's includeFromUpstream flag for both generic and container-backed formats. Widens the existing external-connection claim/fence/origin machinery with a RetentionOriginKind (EXTERNAL_CONNECTION vs UPSTREAM_REPOSITORY) so the same mechanism now also backs same-domain retention, and wires the previously unused INTERNAL_UPSTREAM package-group restriction type through isUpstreamRetentionBlocked the same way EXTERNAL_UPSTREAM already was. Each upstream-repository importer brackets every candidate it reads with the same beginUse/endUse lease DeleteRepository's own cleanup already respects, so a concurrent delete of a candidate can't race a read of it; resolves a version from its real staged byte count rather than an optional, sometimes -1 Content-Length header; and, for Maven, continues past a candidate whose own metadata names nothing eligible instead of stopping the whole search there, and allows SNAPSHOT versions through the metadata merge the same way the asset path already does. pypi's candidate selection also now checks for the exact requested filename, not just a version match, and never swallows a sidecar read failure silently. A generic version's upstream-origin claim is now cleared on delete, republish, or a later direct overwrite copy, so it never keeps reporting a stale source. npm's "treat a retained version as the package default" guard now also catches an upstream-repository claim, not just an external-connection one. |
||
|
|
a852078fc9 | feat(codeartifact): add Package Groups support (#8206) | ||
|
|
a3eea94899 |
fix(codeartifact): stream asset uploads instead of buffering them as byte[] (#8170)
PublishPackageVersion and the Maven, pypi, and NuGet wire-protocol endpoints all received the request body as a single byte[] before any size check ran, so the real, documented 5 GB asset quota never actually applied: an array is capped at ~2.147 GB (Integer.MAX_VALUE), so a legitimately-sized multi-GB asset either failed with an OOM or never got far enough to hit the quota check at all. Reworks the write path for all four formats to stream through a staged file instead of a resident array: - AssetDigestingInputStream computes MD5/SHA-1/SHA-256/SHA-512 and enforces the 5 GB cap in one pass while the body is read, rather than after it's fully buffered. - CodeArtifactService.stageAssetBody/deleteStagedAssetBody give every upload path a single, consistent staged-file lifecycle; existing byte[]-based entry points (CopyPackageVersions, small in-process metadata writes) are left as additive overloads, not replaced, so ~120 existing direct-call test fixtures keep working unchanged. - MultipartFormParser.extractFilePart streams a pypi/NuGet multipart body from disk in fixed-size chunks with a carried-over overlap window, so a boundary marker that straddles two reads is still found correctly, without ever holding the whole envelope (or the file part inside it) in one array. Text fields are bounded both individually and in aggregate, so a real long pypi description doesn't get rejected but many small fields together still can't accumulate the whole envelope on the heap. - Every sidecar write (Reposilite, pypiserver, BaGetter) now has a Path/InputStream-based overload alongside its existing byte[] one, using HttpRequest.BodyPublishers.ofFile/concat instead of a resident buffer. Verdaccio's own write streams the base64-encoded tarball through a piped JDK Base64 encoder instead of building one large encoded string, and a writer-side read failure now fails the publish outright instead of risking a truncated tarball published under hashes computed from the whole file. - Every large-transfer HTTP call site's timeout now scales with the content length (SidecarUriUtils.transferTimeout) instead of a flat 30 seconds, which a multi-GB transfer can legitimately exceed. Manually verified against a packaged jar running under a 1 GB heap cap: a 3 GiB Maven deploy, a 3 GiB pypi twine-shaped upload, and a 3.2 GB NuGet push each completed with no OOM and round-tripped byte-identical. Documents two related, pre-existing ceilings that this change does not and cannot remove on its own: the emulator's own global HTTP body-size cap (FLOCI_PROTOCOLS_MAX_REQUEST_SIZE, 2048 MB by default) still caps any single request below the real 5 GB quota until raised, and the generic format's in-memory storage mode still holds an asset as one byte[]. |
||
|
|
b3bee2d407 |
feat(codeartifact): retain npm packages from a public external connection (#7198)
npm's native registry route can now retain a missing package from a repository's own public:npmjs external connection and serve it, instead of always 404ing, mirroring the AWS-documented external-connection behavior already shipped for Maven (#6889) and NuGet (#7104). Unlike Maven's GAV layout and NuGet's {id}/{version}/{filename} content route, npm's own real wire protocol has no request shape that names one version: npm install <pkg>@<version> always fetches the bare package's full packument first (confirmed against pacote's own source, RegistryFetcher#packumentUrl, always the bare package path) and only picks the version out of its own versions map afterward. So this does two things together, not just one: - A bare packument read (the one every real npm install actually sends) merges the real registry's own versions and dist-tags into whatever Verdaccio already knows locally, computed fresh per request and never written to Verdaccio itself (its own publish protocol has no way to record a version's metadata without that version's real tarball bytes in the very same call, confirmed against a live container). Every newly-merged version's dist.tarball is rewritten to this repository's own proxy URL under a deterministic <bareName>-<version>.tgz shape; dist.shasum/dist.integrity are kept exactly as the real registry declared them, since there is no real content yet to hash locally. - A tarball download for a version not yet genuinely retained triggers the real fetch, the same claim/fence/origin-tracking machinery Maven and NuGet already use (closing the same race against a concurrent DeletePackageVersions/direct push), reusing CodeArtifactService's already-generalized claimRetainedVersionOrigin/retainAssetUnderVersionFence methods directly. New: NpmExternalConnectionClient (the outbound client for public:npmjs) and CodeArtifactNpmExternalConnectionImporter (the merge and retention logic), wired into CodeArtifactNpmDataPlane's existing raw proxy. Deliberately scoped the same way Maven/NuGet's own base PRs were: no caching/TTL on the merge fetch (a live check against the real registry on every packument read for a connected repository, matching the same no-caching fidelity level Maven's own maven-metadata.xml merge already ships with), and the documented but rarely-used single-version registry endpoint (GET /<pkg>/<version>) is not specially handled, since real npm install never sends it either. Update: fixed three issues Greptile's review caught, all specific to npm's own two-step retention (a plain cache-miss asset fetch, as NuGet/Maven's retention already was, is not enough here): - retainAssetUnderVersionFence's own write was always the fixed RepositorySidecarManager# storePackageVersionAsset call, which builds a minimal version document with no dependencies/ engines/scripts. Generalized it to take the actual write as a plain Runnable instead, so npm's own call can reuse the real registry's full-form version document verbatim (the same reuse-the-source-document treatment VerdaccioSidecarClient#copyPackageVersionAsset already gives a version copied from another repository), fetched once, only when a version is actually retained, via a new NpmExternalConnectionClient#fetchFullPackument. NuGet's own call site wraps the exact same plain storePackageVersionAsset call it always made. - Verdaccio always points a fresh package's dist-tags.latest at whichever version was retained most recently (confirmed live, nothing a retention write sends can suppress it), so a plain retention could silently move what an unpinned npm install or ListPackageVersions' defaultDisplayVersion resolves to. Fixed on both sides of that same bug: the merge now only lets an external dist-tag replace a local one that itself points at an externally-retained version, and CodeArtifactService#listPackageVersions ignores preferredDisplayVersion the same way when it names one. - A retained version's readme was never captured, so GetPackageVersionReadme 404ed on it even though the tarball existed; the full packument fetch above also captures the package's own readme (confirmed live: it only ever lives at the top of the full packument, never per version) the same way a native publish's own readme capture already works. Verified two ways beyond the automated suite: - A Docker-gated integration test retains a real package (is-even 1.0.0) from the real, live npmjs.com, through a real Verdaccio sidecar: a bare packument read merges the real version in without yet counting any bytes, a subsequent tarball fetch retains it and counts its bytes, a refetch does not double-count, mixed-case-irrelevant upstream-block enforcement blocks both the merge and the retention, a genuinely-missing package stays 404, the retained version's EXTERNAL origin reporting is confirmed against the real sidecar, and its real dependencies/ engines and readme are confirmed readable back from the real sidecar afterward. - Direct curl checks against the real registry.npmjs.org confirmed the exact packument/tarball URL shapes this client builds, including the %2F-escaped scope separator the packument endpoint specifically needs (unlike the tarball path, which uses a literal slash), and that the abbreviated packument form carries dependencies/engines but not scripts or any readme. Update: fixed a fourth issue from the same re-review, found once the three fixes above landed: mergedPackument always fetched the real registry's abbreviated form, even when the real npm client's own Accept header asked for the full one (the shape npm view <pkg> readme-style commands use), so a package the merge had not yet retained anything for showed no readme at all. The merge now honors that header, fetching the real full packument only when the request actually asked for it, and copies its package-level descriptive fields (readme among them) in the same never-override-local way everything else here already merges, with no change to the hot npm install path's own abbreviated fetch. Update 3: fixed a fifth issue from the same re-review: mergedPackument's own real registry fetch is a genuine network round trip, and nothing held any lock across it, so a DeleteRepository finishing its own cleanup while that fetch was still in flight let the later ensureReady call start a fresh container under an id the delete had already released, one nothing would ever release again. Added a re-check that the repository still exists right after that fetch, before this method ever touches the sidecar. This narrows the window back down to an ordinary check-then-act gap rather than one stretched out by a real network round trip, not a full fix: VerdaccioSidecarManager's own beginUse/endUse are no-ops today (unlike PypiserverSidecarManager's), so nothing here can fully close this yet. Filed #7204 to track giving it real in-flight-use tracking as its own, cross-cutting fix. Update 4: fixed a sixth issue from the same re-review: DisposePackageVersions deletes a version's real Verdaccio content outright, so versions.has(version) alone could not tell a disposed version apart from one never retained at all, and the merge could add a disposed version straight back in from the real registry's own still-unaware listing, even pointing dist-tags.latest at it. An unpinned npm install could then select it, only to have the download correctly, but confusingly, fail. The merge now excludes any externally-named version this repository has marked Archived or Disposed, reusing the same requireContainerBackedVersionDownloadable check the native download route itself already enforces. |
||
|
|
a03e88b451 |
feat(codeartifact): retain Maven packages from a public external connection (#6889)
GetAuthorizationToken-authenticated Maven GET/HEAD requests now retain a missing release version from the repository's own public:maven-* external connection (Maven Central, Clojars, CommonsWare, Google Android, Gradle Plugins), the way real CodeArtifact does, instead of always 404ing. Follows AWS's own documented rules: release versions only (SNAPSHOT is never imported through an external connection); the standard pom/jar/-javadoc.jar/-sources.jar set imported together on a standard request, a non-standard asset name imported individually and only on demand; a retained version's own origin checked against any later asset request for it, rejecting one from a different connection; package-level upstream:BLOCK respected; and a direct mvn deploy of a version already present in the connection rejected (ConflictException), matching AWS's documented publish-side behavior. Retained bytes are counted toward DescribeDomain's assetSizeBytes the same way a direct deploy already is, gated on the real deploy outcome rather than merely having fetched the bytes, and never double-counted on an idempotent-match retry. Verified against the real, live Maven Central in a Docker-gated integration test (junit 4.13.2), and manually with a real mvn client through a wildcard mirror. |
||
|
|
454d7b6ebd |
feat(codeartifact): add ListPackages for every format (#6622)
Lists every package a repository holds across all five formats, with each package's origin-control restrictions, filterable by format, namespace prefix, package-name prefix, and publish/upstream restriction. generic is enumerated by scanning stored package-version and origin-config records repository-wide; each container-backed format gets a new RepositorySidecarManager#listPackages primitive, confirmed live against each real sidecar: Reposilite has no list-everything endpoint, so Maven walks its directory tree, peeking one representative child per directory to tell a group/artifact directory apart from a plain namespace segment (both look identical one level up); Verdaccio's /-/all, pypiserver's root simple index, and BaGetter's Search resource (pressed into service for this admin listing only, not the native NuGet protocol) answer directly. |
||
|
|
5c7c84374b |
feat(codeartifact): add DeletePackageVersions for every format (#6559)
Permanently removes one or more versions of a package, real assets included. Confirmed against the wire model: the request shape has no versionRevisions field at all (unlike UpdatePackageVersionsStatus/DisposePackageVersions), only a single expectedStatus applied to the whole batch, and expectedStatus itself accepts the full, unrestricted PackageVersionStatus enum. Deleting is allowed from every status, Disposed included: the User Guide is explicit that "the only action that can be taken on a package version that has been disposed is for it to be deleted." Unlike DisposePackageVersions, which keeps a tombstone record so DescribePackageVersion keeps answering Disposed, a deleted version is "no longer in the repository" at all: the generic record is removed outright and a container-backed version's status override is cleared rather than replaced, so DescribePackageVersion/GetPackageVersionAsset 404 on it afterward and the freed coordinate can be freely republished. Reuses deleteContainerBackedVersionAssets as-is for the real sidecar deletion, byte accounting, and Maven metadata.xml cleanup, since those are identical regardless of which action triggered them. |
||
|
|
3053b35b84 |
feat(codeartifact): add UpdatePackageVersionsStatus and DisposePackageVersions (#6435)
Moves package versions between Published/Unlisted/Archived (UpdatePackageVersionsStatus) or permanently to Disposed with real asset deletion (DisposePackageVersions), for generic and every container-backed format. Both share the same all-or-nothing batch semantics, NOT_FOUND/MISMATCHED_REVISION/MISMATCHED_STATUS/NOT_ALLOWED error codes, and SKIPPED fallback confirmed against the User Guide's own worked examples. Container-backed formats (maven/npm/pypi/nuget) get a new in-memory status-override store, since none of their sidecars have a native status concept beyond existing-or-not; generic already had status/revision on its own record. GetPackageVersionAsset now 404s for Archived/Disposed versions (assets undownloadable per the User Guide), and ListPackageVersions correctly surfaces real Archived/Disposed/Unlisted data instead of the previously-unreachable filtering branch. Verified end to end against all four real sidecar containers, not just mocks. |
||
|
|
9e66185c9d |
feat(codeartifact): add ListPackageVersions for every format (#6204)
Lists a package's versions with status, revision, and origin, the second of the six missing list/lifecycle actions (ListPackageVersionAssets already shipped). Scoped to all five formats from the start, matching real AWS: none of the action's own format-field documentation carries a generic-only restriction. For generic, reads straight from the stored packageVersions records. Container-backed formats (maven/npm/pypi/nuget) have no such record, so each sidecar client gains a new RepositorySidecarManager.listPackageVersions primitive: Reposilite's artifact-level directory listing plus each version's own lastModifiedTime, Verdaccio's packument versions/time maps, pypiserver's per-project JSON releases keys plus a HEAD on each version's file for Last-Modified, and BaGetter's flat-container index.json plus the NuGet V3 Registration resource's catalogEntry.published (read only as an internal timestamp source, not as a registration endpoint exposed to real NuGet clients). Every container-backed version reports status Published, the same convention DescribePackageVersion's own bridge already established. Real-AWS behavior confirmed against the wire model and the User Guide before writing any code: default page size is 50 (not the 100 this codebase's other List actions use), sortBy=PUBLISHED_TIME is always applied (the only value that enum has) most-recent-first, Archived and Disposed versions are excluded unless the caller filters by that exact status (two sibling actions' own docs name this operation as the one that hides them), Unlisted stays included by default, and originType filtering to EXTERNAL/UNKNOWN always answers empty since Floci never ingests from an external connection. defaultDisplayVersion prefers npm's own dist-tags.latest, falling back to the most recently published Published version for every format (the only stated rule for Maven/PyPI; applied to generic/NuGet too as the best-justified inference, since AWS states no rule for those two). Verified live against all four real sidecar containers, not just mocks, with new Docker-gated tests per format (Maven 26/26, npm 25/25, pypi 24/24, nuget 17/17 overall), plus the fast CodeArtifactServiceTest suite (210/210). Checkstyle and docs-check clean. |
||
|
|
6027872078 |
feat(codeartifact): add ListPackageVersionAssets for every format (#5962)
Lists a package version's assets with size and SHA-256 hash, for generic (from its own packageVersions record) and maven/npm/pypi/nuget (bridged to each sidecar, reusing the listPackageVersionAssetNames/fetchPackageVersionAsset primitives CopyPackageVersions already built). Confirmed live against all four sidecars with Docker-gated tests; real AWS places no format restriction on this action either. First of the six list/lifecycle actions (item 10 in the design plan). Fixes caught by Qodo's review after opening the PR, verified against the wire model and the sidecar code before applying: the endpoint was registered as GET, but real CodeArtifact's ListPackageVersionAssets is a bodyless POST with query parameters, like every other List* action in this service (the Describe*/Get* actions are the ones that use GET) - switched the controller and its Docker-gated tests to POST. Also stopped fetching and hashing every asset in a container-backed version before paginating: asset names are now paginated first, and only the page actually being returned gets fetched and hashed. Added regression tests for the validation paths (missing fields, invalid format, and namespace requirements) that had none. |
||
|
|
5dcddc9dfa |
feat(codeartifact): bridge CopyPackageVersions to every sidecar format (#5888)
CopyPackageVersions only covered the generic format; maven, npm, pypi, and nuget each publish straight to their own sidecar and keep no packageVersions record this action could read from or write to. Bridges all four, each confirmed live against a real container: maven reuses Reposilite's existing mvn-deploy write path, while npm/pypi/nuget each speak their own real wire protocol directly (Verdaccio's packument PUT, pypiserver's twine-shaped multipart upload, and BaGetter's NuGet push), the same protocol each format's own data-plane proxy already forwards unmodified for a native client. CopyPackageVersions now supports every format CodeArtifact does, matching real AWS, which places no format restriction on this action at all. An overwrite deletes a conflicting existing asset immediately before rewriting it for every format, since each sidecar rejects a plain overwrite of differing content; a best-effort compensating cleanup restores or removes whatever one version's write itself touched if a later step in that same version fails, preserving the original error. A copied Maven version is also merged into the destination's maven-metadata.xml so real clients can discover it, and copied bytes feed the same byte-accounting mechanism native publishes already use. A copied npm or pypi version's readme is propagated from this service's own captured-at-publish-time record, since neither sidecar can answer for one after the fact. The synthesized revision for every container-backed format is truncated to fit versionRevisions' own 50-character limit, so a revision obtained from DescribePackageVersion can be handed straight back into a revision-pinned copy. Also closes a cross-version batch-write gap: source assets are verified against the real sidecar before any destination write in the same batch, the same split the generic path already uses. Fixes two more real-sidecar quirks found on review: pypiserver's own delete call removes every file sharing a release's exact name and version, not just the one asset name it was asked to delete, so a release carrying both an sdist and a wheel lost one of them on overwrite when assets were deleted one at a time, interleaved with the writes. Every destination asset a version already holds is now deleted up front, in its own phase, before any new content is written, which changes nothing for Maven/npm/nuget since their own deletes are already scoped to exactly the asset (or, for npm/nuget, the single asset a version ever holds) being removed. An npm copy also used to rebuild a minimal version document from scratch, dropping dependencies and anything else npm's own protocol carries beyond dist; it now reuses the source's own version entry verbatim, with only dist itself rewritten to point at the copy. |
||
|
|
faf344afd1 |
feat(codeartifact): add CopyPackageVersions for the generic format (#5854)
Copies one or more versions of a package between repositories in the same domain, matching AWS's documented all-or-nothing batch semantics: a version missing from the source fails NOT_FOUND, a version already identical at the destination is a silent no-op, a differing one fails ALREADY_EXISTS unless allowOverwrite is set, and any one failure reports every other requested version as SKIPPED rather than performing a partial copy. versionRevisions is checked against the source's actual revision (MISMATCHED_REVISION on a mismatch). Maven, npm, pypi, and nuget are not yet bridged, the same restriction PublishPackageVersion already has for those formats, and are documented as a known limitation. |
||
|
|
3db18d58a5 |
feat(codeartifact): add NuGet/BaGetter sidecar for the nuget format (#5790)
Bridges the nuget package format to a real per-repository BaGetter container, the same Manager/Client sidecar shape already established for Maven (Reposilite), npm (Verdaccio), and pypi (pypiserver): a real NuGet V3 push/install round trip through CodeArtifactNuGetController, GetPackageVersionAsset and GetPackageVersionReadme bridged to the live sidecar, and DeletePackage wired through the same CONTAINER_BACKED_FORMATS dispatch the other three formats use. GetPackageVersionReadme is answered live against BaGetter (its own readme-file and nuspec-description endpoints) rather than captured at publish time, since unlike Verdaccio and pypiserver, BaGetter can answer for a specific historical version after the fact. Pins bagetter/bagetter, the actively maintained fork of the original, long-stale loic-sharma/BaGet (no commits since mid-2024, every one of its own releases tagged -preview/-prerelease), confirmed directly against a live container for push/download/readme/delete semantics before relying on them. |
||
|
|
1ba977a14c |
feat(codeartifact): bridge DescribePackageVersion to Maven/npm/pypi sidecars (#5715)
Maven, npm, and pypi publish straight to their own sidecar and never create the generic-format packageVersions record DescribePackageVersion depended on, so it always 404ed for those three formats. Real CodeArtifact's PackageVersionDescription has no asset listing at all, so the bridge only needs a cheap per-sidecar existence check for the exact version, not asset enumeration: Verdaccio's packument already lists every version, Reposilite's own details API answers directory existence the same way container readiness probing already relies on, and pypiserver's per-project JSON listing already groups files by version. The revision is synthesized the same deterministic way GetPackageVersionAsset's own bridge already does, so describing a version and fetching one of its assets see the same value. |
||
|
|
8f907023b2 |
feat(codeartifact): implement GetPackageVersionReadme (#5644)
Supports npm, pypi, and nuget, matching AWS's own documented restriction for this action (not maven, Swift, generic, Ruby, or Cargo, which carry no readme in real CodeArtifact). Neither npm nor pypi can answer this live after the fact. A real Verdaccio packument GET hoists readme to the top level only, for the single most-recently-published version, and drops the per-version field from its own response entirely, even though a real npm client's publish envelope genuinely sends one per version (confirmed against a live Verdaccio 6.10.4 container with a captured real npm-publish fixture). pypiserver has no description field anywhere in its model or its RPC2 route (confirmed by reading pypiserver's own source at the pinned version), so it never had a live path to begin with. Both formats are therefore captured at publish/upload time instead: npm's per-version readme field is read off the real publish envelope by NpmPublishEnvelopeScanner and recorded after a successful forward to the Verdaccio sidecar, and pypi's is read off the upload form's description field the same way it already was. Both go through the same recordPublishedPackageVersionReadme method and the same packageVersionReadmes account-scoped store, cleaned up on DeleteRepository and DeletePackage the same way packageOriginConfigs already is. nuget is accepted as a valid format but always 404s, since nothing in Floci implements the real NuGet wire protocol and no nuget package version can ever exist here. Refactors validatePackageToken to delegate to a new non-throwing isValidPackageToken, reused by the readme capture path (fed raw publish/upload input, never through the JSON API's own validation) to guard the same escape-collision invariant escapeKeySegment depends on. Extracts the container-backed revision synthesis already used by GetPackageVersionAsset into a shared helper so GetPackageVersionReadme reports a consistent revision for the same version coordinate. |
||
|
|
6b0d0bc378 |
feat(codeartifact): compute DescribeDomain's assetSizeBytes for every format (#5484)
Was hardcoded to 0L unconditionally. Generic-format bytes are summed live from the still-existing PublishPackageVersion records (packageVersions), the same lazily-computed-not-cached pattern repositoryCount already uses. Scoped per still-live repository rather than one scan over the whole domain, matching every other read path's own per-repository prefix. Maven, npm, and pypi have no such record to sum: their publishes go straight to their own sidecar (Reposilite/Verdaccio/pypiserver) and never create one. Each proxy now reports its own successfully-written byte count directly through a new recordContainerBackedAssetBytes, keyed exactly like packageOriginConfigs (region/domain/repository/format/namespace/package, no version), only once it has already decided, in its own terms, that a real write just happened: - Maven: ReposiliteSidecarClient.deployArtifact now returns a DeployOutcome (status plus whether it actually wrote new content), so the idempotent-match short-circuit and a genuine redeployment:false conflict both correctly add nothing. CodeArtifactMavenController parses the GAV path into namespace/package name, including a group/artifact-level maven-metadata.xml upload, which it attributes correctly once the metadata filename itself (not the segment count) tells it apart from a real versioned asset. - npm: NpmPublishEnvelopeScanner's attachment digest loop now also counts the real decoded byte count alongside its SHA-512, so a multi-attachment publish is sized by its actual tarball bytes, not the base64-and-JSON envelope. Recorded only after Verdaccio's own response confirms a 200/201, off the event loop (vertx.executeBlocking, on principle, even though the call itself is cheap); the confirmed-republish short-circuit and a native Verdaccio rejection both add nothing. A native npm unpublish (Verdaccio's unpublish:$all, bypassing this service entirely) is detected separately and cleaned up the same way DeletePackage would have. - pypi: recorded after a real forwarded upload succeeds, under pypiserver's own PEP 503 normalized name so an upload and a later delete spelled differently still address the same count; the byte-identical idempotent short-circuit and the different-content 409 both add nothing. DeleteRepository and DeletePackage both clean up every format's own records (packageVersions and its asset content included) by the same name-based prefix/key, so a repository or package recreated under the same name never inherits a predecessor's bytes. A per-package deletion fence, bumped only by an actual delete (DeletePackage, or a native npm unpublish), replaces a sidecar existence re-check for the race between an in-flight publish's own accounting and a concurrent delete: comparing a snapshot taken before the real write against the fence's current value catches "deleted" and "deleted and republished under the same name" alike, with no network round trip needed to do it, so nothing here holds the service-wide lock across a sidecar call. containerBackedAssetBytes itself is kept in memory only, like the fence, not through StorageFactory: the sidecar content it counts does not survive a Floci restart either, so neither does the count. Verified against real Reposilite, Verdaccio, and pypiserver containers (not just mocks): each Docker-gated integration suite asserts assetSizeBytes increases by exactly the real published/uploaded byte count, stays unchanged across an idempotent retry, and drops back down after a real delete, native unpublish included. Known limitations documented: a maven-metadata.xml for a versioned snapshot is attributed to its version string rather than its real artifact name (still counted correctly in the domain total, just under a misnamed bucket nothing else looks up by name); unpublishing a single version of a multi-version npm package is not detected (this accounting is per-package, not per-version, so there is no narrower count to subtract from regardless). Addresses hectorvent's review on the PR: rebased to pick up #5102's Digests.sha256Hex (the tests were merging clean but failing to compile against current main), stopped containerBackedAssetBytes from surviving a restart the content it counts does not, and closed the native-npm-unpublish gap in the fence's own soundness argument. |
||
|
|
3ff5529fad |
feat(codeartifact): add PutPackageOriginConfiguration (#5381)
Sets a package's publish/upstream origin-control restrictions, matching AWS's documented behavior that this operation can create the package (with no versions) when it doesn't exist yet, so a caller can lock a package down before anything is ever published to it. DescribePackage now reflects a stored configuration instead of the fixed ALLOW/BLOCK defaults it previously always returned, and PublishPackageVersion rejects a publish with ConflictException once a package's origin configuration sets publish to BLOCK, the one publish path this operation can actually gate since PublishPackageVersion only ever accepts the generic format. Maven/npm/pypi publish through their own native wire protocols and are not yet gated by this setting, documented as a known limitation. The format/namespace coordinate validation shared with DescribePackage is extracted into one helper instead of being duplicated a second time. clear() (the Resettable reset path) now also clears the new store; it previously left an origin-config-only package (no versions) visible to DescribePackage after a reset that wiped everything else. DescribePackage's existence check for an origin-config-only package now short-circuits before the sidecar/generic check runs at all: for a container-backed format that check would otherwise start the real Maven/npm/pypi sidecar container just to answer a describe for a package nothing was ever actually published to. DeletePackage now agrees with DescribePackage on all of this instead of drifting from it. Its deletedPackage.originConfiguration reports the restrictions that were actually stored, not a hard-coded ALLOW/BLOCK; it clears the stored configuration as part of the delete, so a deleted package cannot resurrect as a zero-version one on the next DescribePackage; and it now recognizes an origin-config-only package (no version ever published) as something it can delete, rather than 404ing on a package DescribePackage itself reports as existing. DeletePackage's own namespace/format validation, previously a second inline copy of the same rules, now goes through the shared helper too. A rejected PutPackageOriginConfiguration now also has a test asserting an invalid/missing upstream value alone is rejected (the prior tests only exercised publish) and that a rejection, on either a package that didn't exist yet or one with a prior configuration, changes nothing. deleteRepository now also removes any packageOriginConfigs entries under that repository: unlike sidecarContainerIds, which already gets a fresh id on every creation specifically so a repository recreated under the same name never inherits the previous one's sidecar content, packageOriginConfigs was keyed purely by name, so a recreated repository would otherwise inherit a prior package's restrictions, including a publish:BLOCK the new repository's owner never set. |
||
|
|
ceab47e785 |
feat(codeartifact): add DeletePackage for all package formats (#5320)
DeletePackage deletes a package and every one of its versions, matching PackageSummary's own field name (package, not name, confirmed against the API reference) in the deletedPackage response. A nonexistent package answers ResourceNotFoundException instead of silently succeeding. Existence and deletion go where the package actually lives: stored generic-format versions and their asset bytes for generic, and each format's sidecar for maven, npm, and pypi. Validates package and namespace shape, and requires or rejects a namespace per format, the same boundary describePackage already enforces, before touching repository or sidecar state. Synchronized like every other mutating method on this service, so a publish and a delete racing the same generic package cannot interleave. Within one generic version's own delete, its metadata record is removed before its asset bytes are cleaned up, so a cleanup failure on one asset can never leave a surviving record pointing at bytes that are now gone; the failure is logged and the rest of the package's assets still get cleaned up. Verdaccio and Reposilite can each remove a whole package in one call, confirmed against live containers: Verdaccio needs the packument's own _rev appended as npm's real unpublish protocol does (a bare DELETE with no revision is not a route at all), Reposilite removes everything under the group/artifact directory in a single DELETE. pypiserver has no single whole-package route, but its own management endpoint (POST / with :action=remove_pkg) does delete a named version for real, confirmed live against the pinned v2.4.2 image: every version is listed first through the same image's PyPI JSON API endpoint, then each file removed under its own, unnormalized name (an sdist and a wheel of the same release can legitimately differ there, so deleting by one shared name alone could silently leave the other file behind). RepositorySidecarManager.deletePackage's default still throws UnsupportedOperationException for a sidecar that genuinely cannot do this, and the service turns that into a documented InternalServerException rather than claiming a success it cannot back up or leaving an unhandled 500. |
||
|
|
e452ce8671 |
feat(codeartifact): add DescribePackage for all package formats (#5308)
DescribePackage returns a package's format, namespace, name, and origin controls, and answers ResourceNotFoundException for a package that does not exist. Existence is checked where the package actually lives: stored generic-format package versions for generic, and each format's sidecar for maven, npm, and pypi. A package whose name merely starts with another's name does not match it. Origin controls are reported as publish ALLOW and upstream BLOCK, the default CodeArtifact assigns to a package whose first version was published directly. Floci never ingests packages from upstream and does not store origin controls, so these values are fixed. For maven, npm, and pypi the existence check starts that repository's sidecar if it is not already running, the same side effect the asset bridge has. RepositorySidecarManager gains packageExists, implemented by each sidecar client. |
||
|
|
583b2baf7f | feat(codeartifact): bridge GetPackageVersionAsset to Maven, npm, and pypi sidecars (#5019) | ||
|
|
fca7d87f2d | feat(codeartifact): add PyPI format support via pypiserver sidecar (#4998) | ||
|
|
cd89be4a80 |
fix(codeartifact): treat identical-content maven redeploy as idempotent (#4837)
Reposilite's own redeployment:false setting rejects a redeploy to an
existing GAV path unconditionally, even when the new content is
byte-identical to what is already there (confirmed against a real
instance). AWS's own CodeArtifact docs ("Overwriting package assets"
in the packages overview) say a republish of an asset whose content
matches what is already published succeeds because the operation is
idempotent; only a genuine content mismatch is a real conflict.
Reposilite has no content-aware mode of its own, so this fetches the
existing artifact first and short-circuits to a 200 on an exact match
rather than ever sending Reposilite a PUT it would reject regardless
of whether the retry was actually harmless.
|
||
|
|
48214e04e0 |
fix(codeartifact): extend idempotent asset republish to Published versions (#4708)
Two follow-ups hectorvent flagged on #4619, approved but marked as separate-PR material: Compares an existing asset's persisted SHA-256 instead of reading its bytes. The hash is normal metadata (not @JsonIgnore like the content field), so this needs no disk read, no in-memory-store lookup, and no special case for a backing file that happens to be missing - a stored hash never "goes missing" the way a file can, and a genuinely different republish still conflicts even when the file is gone, closing a gap the previous byte-comparison approach had. Extends the idempotent-retry allowance to an already-Published version. AWS's "Overwriting package assets" rule isn't scoped to Unfinished, and the terminal publish call (the one that actually finishes a version) is the likeliest one a client retries after a dropped response. A brand-new asset name against a Published version still always conflicts; only a byte-identical replay of an asset that's already there is idempotent. |
||
|
|
0232d5d224 |
fix(codeartifact): treat identical-content asset republish as idempotent (#4619)
PublishPackageVersion silently overwrote a generic-format asset's stored
bytes whenever the same asset name was republished to an Unfinished
package version, with no comparison against what was already there. AWS's
own docs ("Overwriting package assets" in the CodeArtifact packages
overview) say a republish is only rejected when the content actually
differs from what's already stored; byte-identical content succeeds
idempotently. Compares the new upload against the existing asset's real
bytes (read the same way GetPackageVersionAsset does, not the in-memory
PackageAsset.content field, which is @JsonIgnore and unreliable after a
reload) and now returns ConflictException on a genuine mismatch instead of
silently replacing the content.
|
||
|
|
3e6c7a3472 |
feat(codeartifact): serve the npm format through a real Verdaccio proxy (#4336)
GetRepositoryEndpoint for format=npm now returns a working registry endpoint: real npm/yarn/pnpm clients can publish to and install from it, proxied straight through to a real Verdaccio instance rather than reimplemented. Every request needs Authorization: Bearer <token> from GetAuthorizationToken, matching npm's own _authToken config and, unlike Maven's HTTP Basic support, Bearer only. Unlike Reposilite, Verdaccio has no native concept of multiple named repositories inside one instance, so each CodeArtifact repository gets its own container instead of sharing one, started lazily on first use and identified by a fresh id assigned at CreateRepository time so a repository deleted and recreated under the same name never inherits the previous one's packages. Each container is started with VERDACCIO_PUBLIC_URL set to that repository's own proxy URL so package metadata it returns (dist.tarball) points back through Floci instead of the container's own internal, client-unreachable address. VerdaccioSidecarManager implements the RepositorySidecarManager interface CodeArtifactService already generalized DeleteRepository's cleanup over, so a deleted repository's Verdaccio container is stopped and removed the same generic way Maven's Reposilite storage is released. The per-key container lifecycle (map of running containers, per-key start lock, health poll, restart-on-unhealthy, stop-all) has nothing Verdaccio-specific in it, so it is pulled out into PerKeyContainerPool for a future per-repository sidecar to reuse directly. CodeArtifactNpmDataPlane is a raw streaming proxy rather than a JAX-RS controller, since npm's wire protocol has no fixed path shape the way Maven's GAV layout does; Verdaccio already speaks that protocol correctly, so this only needs to authenticate the request and forward it. The publish/fetch integration test replays a real request the npm CLI sent during manual verification, captured with a tiny Node.js capture server, so it exercises the exact envelope shape (including a real gzip tarball attachment) npm publish actually produces; the full round trip was additionally verified by hand with the real npm CLI against a live Floci instance. |
||
|
|
94fc4c45bb |
feat(codeartifact): release a deleted repository's Maven storage (#4210)
DeleteRepository never cleaned up the Reposilite-side storage of a deleted repository; it was left behind, wasting space over a long-running process. Reposilite has no bulk-delete endpoint, but DELETE on a path recursively removes everything under it in one call, so this deletes each of the repository's top-level entries before removing it from the shared settings list, verified against a live instance. Order matters: the repository must stay registered while its files are deleted, since Reposilite 404s every path, including DELETE, for an id absent from its settings. Release is best-effort: the CodeArtifact-side metadata delete already committed by the time it runs, matching real CodeArtifact's own DeleteRepository (synchronous, always succeeds once the repository exists). A sidecar that is unreachable must not turn an already-successful delete into a 500, and must not leave the repository stuck, since a retry would just 404 against the already-deleted record. Introduces RepositorySidecarManager, a small interface every per-format sidecar can implement, and CodeArtifactSidecarRegistry, which discovers implementations via CDI. CodeArtifactService.deleteRepository releases storage generically over whatever formats a repository has sidecar ids for, so a future format's sidecar needs no change here. Reposilite is the first and only implementation for now; CodeArtifactRepository's mavenRepositoryId field becomes a sidecarContainerIds map for the same reason. |
||
|
|
0524d156d4 |
feat(codeartifact): serve the maven format through a real Reposilite-backed proxy (#4059)
GetRepositoryEndpoint for format=maven now returns a URL real Maven clients (mvn deploy, mvn dependency:get, Gradle) can publish to and resolve from directly, backed by a shared Reposilite sidecar container started lazily on first use. A CodeArtifact repository maps to its own Reposilite repository, provisioned automatically and never reused even across delete/recreate of a same-named repository, so a fresh repository can never inherit a previous one's artifacts. Adds GetAuthorizationToken (a token scoped to a domain, with the 900-43200s custom range; 0 falls back to 12 hours) and requires it on every Maven proxy request, either as the password of HTTP Basic credentials, the form AWS's Maven guide configures with username aws, or as a Bearer token. Maven requests are not SigV4-signed, so the region and account come from the token. Also enforces AWS's 5 GB asset size quota on the Maven endpoint, matching the existing PublishPackageVersion check. Artifacts do not survive a Floci restart; the service page documents this as a known limitation. |
||
|
|
2e038b5cfb |
test(codeartifact): pin ResourceNotFoundException on DeleteDomain of a missing domain (#4107)
AWS returns ResourceNotFoundException (404) when DeleteDomain targets a domain that does not exist, even though the API reference leaves it out of the operation's error list. Keep that behaviour, pin it with unit and integration tests, and note it in the docs and next to requireDomain. Closes #4000 |
||
|
|
2697868e86 |
fix(codeartifact): populate resourceId/resourceType on error responses (#3977)
Every ConflictException, ResourceNotFoundException, and ServiceQuotaExceededException the service threw carried a message only, but the wire model declares resourceId/resourceType on all three, and the AWS SDK exposes them as typed accessors. Populate them consistently using the resource's locally-unique name (domain name, repository name, package version, or asset name) as resourceId. Populating resourceId this way exposed a real crash: Map.of() rejects null values, so any request missing a required identifier (domain, repository, package, packageVersion, asset) turned what used to be a wrong-status ResourceNotFoundException into a raw NullPointerException / HTTP 500. Fixed by validating required identifiers up front (returning ValidationException, matching AWS) and by making the extendedData-building helper itself null-safe against a missing resourceId, so no single overlooked call site can reintroduce a 500. |
||
|
|
15ed62f8cb |
fix(codeartifact): enforce domains-per-account and repositories-per-domain quotas (#3949)
CreateDomain and CreateRepository accepted an unlimited number of domains and repositories, but AWS caps an account at 10 domains per Region and a domain at 1,000 repositories, returning ServiceQuotaExceededException once reached. |
||
|
|
bbaf3568c5 |
feat(codeartifact): support publishing and reading generic-format package versions (#3839)
Adds PublishPackageVersion, DescribePackageVersion, and GetPackageVersionAsset for CodeArtifact's generic package format, matching AWS's own wire restriction that PublishPackageVersion accepts only the generic format. Includes real asset hashing (MD5, SHA-1, SHA-256, SHA-512), SHA-256 integrity verification against the caller's x-amz-content-sha256 header, correct Unfinished/Published status transitions, and the documented AWS quotas for this action (350 assets per version, 5 GB max asset size), all returning ServiceQuotaExceededException when exceeded. Asset bytes are kept out of the JSON/WAL-backed package-version store (@JsonIgnore on PackageAsset.content) and instead go through a dedicated asset store, a disk file in persistent/hybrid/wal mode or a side map in memory mode, the same split S3Object/S3Service already uses for object bytes. Without this, a publish rewrote every asset of every package version on disk each time, growing quadratically under this action's own 350-asset/5GB quotas. The asset name is also validated against the wire model's AssetName pattern (no control characters), not just its length, since it is echoed back verbatim in the X-AssetName response header on GetPackageVersionAsset. Verified against the real botocore service-2.json wire model and the AWS CodeArtifact User Guide (including its PDF for the quotas table, since the HTML quotas page is JS-rendered). Live-verified with the real AWS CLI and the AWS SDK for Java v2 against a running Floci instance, including an exact byte-for-byte asset round-trip and the real ConflictException when republishing an already-Published version. |
||
|
|
66bcdaf675 |
feat(codeartifact): add CodeArtifact control-plane support (#3713)
Floci had zero CodeArtifact support: no service package, no docs, nothing. Any terraform apply touching aws_codeartifact_domain, aws_codeartifact_repository, or either permissions-policy resource failed outright. This adds the full CodeArtifact control plane: domain and repository CRUD, resource policies with optimistic-locking revisions, tags, and the fixed set of real AWS-hosted external (upstream) connections (public:npmjs, public:pypi, public:maven-central, etc.). Package publish/fetch endpoints per format (npm, PyPI, Maven, NuGet, generic) are intentionally out of scope here: this closes the terraform apply gap, not real package serving. ListTagsForResource (POST /v1/tags?resourceArn=) is CodeArtifact's one tag operation that addresses the resource with a query parameter on the bare path rather than a path segment, unlike every other V1TagsController/SharedTagsController handler. That method lives on V1TagsController itself rather than the shared AbstractTagsController base: SharedTagsController (mounted at /tags) already declares its own bare POST (tagResourceByBody, for TagResource), so a bare POST on the shared base collides with it and Quarkus refuses to start. CodeArtifact's handler is @V1Tags-qualified and only ever registered against V1TagsController, so the method belongs there. core/common stays service-free: CodeArtifactTagHandler registers itself as a bean the same way MskTagHandler does, and TagHandler gained a default for the lowercase key/value entry names CodeArtifact uses instead of AWS's usual capitalized Key/Value. Known, documented limitations (see docs/services/codeartifact.md): no cycle detection across upstream chains, no referential-integrity check when deleting a repository other repositories reference as an upstream, and no authorization check on cross-account domainOwner addressing (consistent with Floci's opt-in IAM enforcement elsewhere). Verified against the real botocore codeartifact service-2.json (protocol, exact querystring vs. body placement per operation, exact ARN format, epoch-seconds timestamps, real error shapes) and the live AWS API docs for behavioral rules not in the wire model (DeleteDomain blocked while repositories exist, the real fixed external-connection name/format list, PutDomainPermissionsPolicy's all-body field placement vs. the sibling repository operation's querystring placement). Live-verified three ways: - Unit tests including a concurrent-create race test proving the synchronized guard actually holds under contention, plus full-stack QuarkusTest/RestAssured integration tests. - A real terraform init/apply/plan/destroy cycle against a running Floci instance, independently confirming destroy actually tore the domain down via a follow-up describe-domain call. - A live AWS SDK v2 Java test exercising the real CodeartifactClient against a live instance. |