fix(servicekit): report apply status only for kinds the process re-applies live

Issue: archie-core-mt91
This commit is contained in:
sam committed 2026-10-13 15:28:43 +11:00
1 parent dee78a876a
commit 8ecda341e0
3 files changed
+10 -4

No files matched your search

+1 -1
View File
@@ -24,7 +24,7 @@ func (b *boot) runtimeConfig(ctx context.Context, base config.Config) (config.Co
if settings := b.executionSettings.Load(); settings != nil {
applyExecutionBudgets(cfg, *settings)
}
})
}, nil)
}
func (b *boot) loadRuntimeConfig(ctx context.Context) error {
+1 -1
View File
@@ -209,7 +209,7 @@ func (b *server) openState(ctx context.Context) error {
}
func (b *server) runtimeConfig(ctx context.Context, base config.Config) (config.Config, map[string]int64, error) {
return servicekit.RuntimeConfig(ctx, b.controlPlane, b.applyStatus, b.secrets, b.log, base, nil)
return servicekit.RuntimeConfig(ctx, b.controlPlane, b.applyStatus, b.secrets, b.log, base, nil, gatewayRuntimeKinds)
}
// connectNATS joins the broker task actions travel over. The daemon owns the
+8 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log/slog"
"slices"
"github.com/samcharles93/archie-core/internal/app/controlplane"
"github.com/samcharles93/archie-core/internal/config"
@@ -15,8 +16,10 @@ import (
// RuntimeConfig layers the control plane's stored settings over base, lets
// adjust apply the caller's own live settings, then validates the result and
// resolves its provider secrets. The outcome is reported for every layered
// kind, so a refused document keeps the version still running on the record.
func RuntimeConfig(ctx context.Context, cp *controlplane.Client, status *applystatus.Reporter, secrets *secret.Registry, log *slog.Logger, base config.Config, adjust func(*config.Config)) (config.Config, map[string]int64, error) {
// kind in reportKinds (every kind when nil), so a refused document keeps the
// version still running on the record and a process never reports a kind it
// does not re-apply live.
func RuntimeConfig(ctx context.Context, cp *controlplane.Client, status *applystatus.Reporter, secrets *secret.Registry, log *slog.Logger, base config.Config, adjust func(*config.Config), reportKinds []string) (config.Config, map[string]int64, error) {
cfg, versions, err := cp.RuntimeConfig(ctx, base)
if err != nil {
return config.Config{}, nil, err
@@ -26,6 +29,9 @@ func RuntimeConfig(ctx context.Context, cp *controlplane.Client, status *applyst
}
report := func(applyErr error) {
for kind, version := range versions {
if reportKinds != nil && !slices.Contains(reportKinds, kind) {
continue
}
status.Report(ctx, kind, version, applyErr)
}
}