fix(output): retain admitted scope through uploads and publication

TH
10m ago
+748-375

Summary

A daemon-produced artifact belongs to the tenant and lease of the request that produced it. A tenant-owned artifact, upload or materialized path serves only its own tenant. Remote callers choose the tenant and lease they send, so those values no longer decide who owns another request's output. Staged uploads are capped per tenant.

Before / after

  • Download of another request's output: 0.22 assigned the owner at finalize from the requesting tenant. Now trackDownloadableArtifact requires the producer's ArtifactOwner; a mismatch returns TENANT_OUTPUT_MISMATCH.
  • Untenanted entry: 0.22 served any tenant. Now exact tenant match only.
  • 33rd unconsumed upload for a tenant: 0.22 accepted it. Now UPLOAD_LIMIT_REACHED. trace stop, perf stop and perf report check tenant and lease.

Validation

Head daf62a2e3e. Production vs origin/0.22: +272/-193.

  • Unit-core on changed files plus 134 related daemon/proxy files: pass. Wire-compat: 52 passed.
  • Revert proof: with production restored from 0.22, 14 tests fail, including every new test.
  • Hosted CI owns lint, typecheck, Coverage and integration. artifact-tracking.ts is at the 1000-line cap.
  • Uploads carry the request tenant, so a tenanted CLI install works on a hookless daemon. Live tenanted proxy runs (install; trace and perf capture) in the PR comments.
  • Definitive typed upload refusals (authorization, lease or tenant scope, upload limit) reach the CLI with reason and hint, with no legacy fallback. Other failures, such as an expired ticket, keep the legacy upload.
  • Risk: uploads bind to tenant, not lease.