artifact: refresh manifest at runtime without restart (atomic snapshot + auto-refresh)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Start with artifact/registry.go and artifact/manifest.go, tracing how LoadManifest and RegisterFromConfig populate the manifest table and how Get/Latest read it. Then locate the existing registry tests and run them before making changes. Done when Reload validates a fresh table and preserves the last-good snapshot on errors, readers use an atomic snapshot, and the opt-in poller stops on context cancellation and logs failures.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
The artifact registry reads the manifest (manifest.json) exactly once, at startup: LoadManifest → RegisterFromConfig populates the registry's in-memory manifest table, which is then treated as read-only for the lifetime of the process (see artifact/registry.go, artifact/manifest.go).
As a result, any change to the manifest table — adding a new artifact row, or changing a version/path — is invisible until the process is restarted.
Note this is narrower than "the manifest isn't synced":
- Artifact content is already live.
loadAndParsecallsloader.Load(...)on everyGet/Latest, so editing the bytes of an already-registered artifact is picked up without a restart. - The manifest table (id/kind/version → path) is frozen at startup. Only new/changed rows require a restart.
For backends where artifacts are expected to evolve independently of binary deploys (e.g. a repo- or bucket-backed registry), requiring a restart to pick up a new manifest row undercuts the point of an external, versioned registry — the artifact lifecycle should be decoupled from the deployment lifecycle.
Proposed Solution
Make the manifest table refreshable at runtime, without blocking readers and without pushing any new responsibility onto individual loaders (the refresh policy lives in the registry, above the Loader interface).
-
Atomic snapshot swap (foundation). Move the manifest table behind an
atomic.Pointer[snapshot](sync/atomic, available on the repo's Go version). Readers on the hot path (Get/Latest) do a single lock-free atomic load. A snapshot is immutable once published. -
Reload(ctx) error. Re-fetchmanifest.jsonthrough the existing loader, build a fresh table, validate every row, and only then atomically swap it in. On any error, return it and keep the last-good snapshot — a transient fetch/parse failure must never blank the catalog. -
StartAutoRefresh(ctx, interval). A registry-owned background poller that callsReloadeveryinterval, stopping whenctxis cancelled.interval <= 0is a no-op (feature off), so it is strictly opt-in. The interval comes from the application's config and is passed in here — it is a registry concern, not a loader concern, so loaders stay unaware of refresh entirely.
Failures during polling are logged (slog) and leave the current snapshot in place.
Why an atomic snapshot instead of a mutex: this is a read-heavy / write-rare workload (many Gets between infrequent refreshes) where the whole table is replaced as a unit and slight staleness is acceptable — the textbook case where a copy-on-write snapshot swap avoids taxing every read with lock overhead.
Out of scope (separate follow-ups):
- Artifact content caching (versioned paths are immutable and cacheable indefinitely;
Latest/unversioned entries want a TTL). - Any specific trigger wiring beyond the poller (signal handler, admin endpoint, webhook) — the app can drive
Reloaddirectly if it wants those.
Alternatives
RWMutexguarding the table. Correct, but blocks readers during the swap and taxes everyGetwith read-lock overhead to guard against a write that almost never happens. Rejected in favor of the lock-free snapshot.- Explicit
Reload()only, no poller. Smallest surface, but pushes the "when to refresh" burden onto every consumer. KeepingReload()public still allows this, so the poller is additive rather than exclusive. - Restart / rolling redeploy to pick up manifest changes. The status quo. Acceptable for file-mounted deployments where a manifest change already coincides with a redeploy, but defeats the decoupling for registries backed by an independently-updated source.
- Per-loader refresh. Would duplicate the same polling logic across every backend and leak a registry-level policy into the
Loaderinterface. Rejected — refresh belongs in the registry.
- Lenguaje dominante
- Go
- Estrellas
- 6
- Forks
- 8
- Merge medio
- 21 h 36 min
- PR fusionados (30 d)
- 42
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenNSW/core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholdersAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
nsw-sl cleanup Type/Improvement
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
remote: let the host inject a logger, and log with one consistent policyPosiblemente ocupada @mushrafmim la tomó hace 5 días. AbiertoType/Improvement
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
Los mantenedores suelen responder en 1 día
Todos los issues de OpenNSW/core
Issues similares
-
agent-research-finding chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jordansmall/spindrift#7370 ·
Los mantenedores suelen responder en 1 día
-
☢️ Bug v3
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
The repo's gates check is clean and runs need no swapsPosiblemente ocupada @turbot-agent-fleet la tomó hoy. Abiertoagent:ready
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
turbot/tailpipe#677 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
needs-kind needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
crossplane-contrib/provider-keycloak#806 ·
Los mantenedores suelen responder en 1 día