feat(platform): add the notification inbox and deterministic match search
This commit is contained in:
1 parent
5edff21d2d
commit
0b11021b16
169 files changed
+17083
-443
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
"lincodex/backend/config"
|
||||
"lincodex/backend/internal/adapter/secondary/postgres"
|
||||
"lincodex/backend/internal/domain"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/policy"
|
||||
)
|
||||
|
||||
@@ -45,13 +46,34 @@ func seedDemoPolicy(ctx context.Context, settings config.Config, logger *slog.Lo
|
||||
logger.Info("product policy already present; demo seed skipped",
|
||||
slog.String("policy_key", string(domain.ProductPolicyKey)),
|
||||
)
|
||||
return nil
|
||||
} else {
|
||||
logger.Info("demo product policy published",
|
||||
slog.String("policy_key", string(result.Version.Key())),
|
||||
slog.Int("policy_version", int(result.Version.Version())),
|
||||
slog.String("policy_kind", string(result.Version.Kind())),
|
||||
slog.String("policy_version_id", result.Version.ID().String()),
|
||||
)
|
||||
}
|
||||
logger.Info("demo product policy published",
|
||||
slog.String("policy_key", string(result.Version.Key())),
|
||||
slog.Int("policy_version", int(result.Version.Version())),
|
||||
slog.String("policy_kind", string(result.Version.Kind())),
|
||||
slog.String("policy_version_id", result.Version.ID().String()),
|
||||
)
|
||||
warnWithoutMatchingSection(ctx, postgres.NewPolicyStore(pool).Policies(), logger)
|
||||
return nil
|
||||
}
|
||||
|
||||
// warnWithoutMatchingSection tells the operator at startup that the match
|
||||
// search fails closed: the effective product policy has no matching section, and
|
||||
// the demo seed publishes only the first version. It only warns; a policy the
|
||||
// service cannot read must not stop startup either.
|
||||
func warnWithoutMatchingSection(ctx context.Context, policies outbound.PolicyRepository, logger *slog.Logger) {
|
||||
version, err := policies.GetEffective(ctx, domain.ProductPolicyKey, time.Now())
|
||||
if err != nil {
|
||||
logger.Warn("the effective product policy could not be checked for the matching section",
|
||||
slog.String("policy_key", string(domain.ProductPolicyKey)),
|
||||
)
|
||||
return
|
||||
}
|
||||
if version.Policy().Matching == nil {
|
||||
logger.Warn("the effective product policy has no matching section; match search answers with an internal error until an operator publishes it (make -C backend policy-publish ARGS='matching --actor operator:<handle>')",
|
||||
slog.String("policy_key", string(version.Key())),
|
||||
slog.Int("policy_version", int(version.Version())),
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user