feat(npm): account for virtual tarball copy faults and drain failures
What this MR does
This MR replaces the two interim paths of part 3.
recordVirtualTarballCopybooks how a committed copy ended. A fault on the source read books against that source:upstream_unavailablefor a live relay,internal_server_errorfor a stored blob.- The handler holds one kill log, so the deadline-kill Error line is rationed per repository.
kill_log.mdlists the virtual tarball route as a fourth holder. - A new counter,
gitlab_artifact_registry_npm_virtual_tarball_deadline_kills_total, counts every kill before the kill log is consulted. It is cataloged inmetrics.mdanddocs/dev/observability.md. - A chunked relay that ends short is aborted through
abortStreamedRelay, so that the client cannot read it as complete. - A cold
HEADwhose drain fails goes toresolveDrainFailure(part 2). An upstream cut serves the cached copy of the winner when one exists. Every other failure answers by whose failure it is:503with the health wait,503withRetry-After: 1,500, or499.
The comments in remote_tarball.go and remote_tarball_kill_log.go now name the callers that exist.
The remote and virtual copy switches point at each other, and #1535 tracks one shared switch.
Tests
The rest of virtual_tarball_faults_test.go: the shared kill log, the cold HEAD drain cases, the copy-ending cases, and the truncated-relay cases over HTTP/1.1 and HTTP/2.
Size
This part has about 150 lines of production code and about 940 lines of tests. The tests are the ported fault cases of the remote tarball suite, and they cannot move to a smaller part without their production arms.
Split of !3111 (merged)
This MR is one part of a split of !3111 (merged) into six stacked MRs. Each part targets the branch of the part before it, so each diff shows only that part. Merge the parts in order: 1, 2, 3, 4, 5, then !3111 (merged) itself as part 6.
| Part | MR | Contents |
|---|---|---|
| 1 | !3150 (merged) | npm_files.created_at to the hosted tarball winner |
| 2 | !3147 (merged) | Resolver re-entry on a virtual drain failure |
| 3 | !3148 (merged) | VirtualTarballHandler, not wired |
| 4 | !3149 (merged) | Copy-fault accounting, kill log, cold HEAD drain failure |
| 5 | !3151 (merged) | Usage events |
| 6 | !3111 (merged) | Slot wiring, run recipe, docs |
Before review, the six parts together were byte-identical to the original !3111 (merged) diff (same git patch-id --stable).
The review fixes on this part are not in that diff.
The spec coverage table, the rulings (E1 to E22), and the spec gaps stay in the description of !3111 (merged).
E2E scenario catalog and user documentation
This part adds no e2e scenario and changes no file in docs/user/.
Nothing wires the virtual tarball handler before part 6, so the route still answers 501 and no client-visible behavior changes.
Related to #898 (closed)