Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor([issue-1628]): normalize check scope once in resolveCheckState

[._.]/ Adam Eivyc2fca6d5bb2b
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 04bdf0d7f4..56118bc0ab 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -6401,16 +6401,17 @@ export function resolveCheckState(settings) {
return getAllChecks(settings).map((check) => {
const row = stored[check.id] || {};
const enabled = typeof row.enabled === 'boolean' ? row.enabled : check.defaultEnabled !== false;
+ // Normalize the declared scope ONCE: `scopes` (#1628) is the full declared set
+ // the catalog/plan fan a dual-scope check across; `scope` is the PRIMARY scope
+ // (a string) so every single-value consumer keeps working unchanged. For a
+ // single-scope check the two agree (`scope === scopes[0]`).
+ const scopes = normalizeCheckScopes(check.scope);
return {
id: check.id,
label: check.label,
description: check.description,
- // `scope` is the PRIMARY scope (a string) so every single-value consumer
- // keeps working unchanged; `scopes` (#1628) is the full declared set the
- // catalog/plan fan a dual-scope check across. For a single-scope check the
- // two agree (`scope === scopes[0]`).
- scope: primaryCheckScope(check.scope),
- scopes: normalizeCheckScopes(check.scope),
+ scope: scopes[0] || null,
+ scopes,
kind: check.kind,
category: check.category,
// `severityDefault` is the registry baseline (what the override resets to);
diff --git a/server/services/pipeline/editorial/checkRunner.js b/server/services/pipeline/editorial/checkRunner.js
index 8476f78305..4741aa4978 100644
--- a/server/services/pipeline/editorial/checkRunner.js
+++ b/server/services/pipeline/editorial/checkRunner.js
@@ -828,8 +828,9 @@ export async function previewCustomCheck(seriesId, def, { providerOverride, mode
export async function buildEditorialCheckPlan(seriesId, { checkIds = null, settings } = {}) {
const resolved = settings || await getSettings();
const checks = getEnabledCheckRows(resolved, checkIds)
- // `scope` is the primary scope; `scopes` carries the full declared set so a
- // dual-scope check (#1628) previews under each of its granularities.
+ // `scope` is the primary scope; `scopes` (#1628) carries the full declared set
+ // so a consumer rendering the plan can group a dual-scope check by each of its
+ // granularities (the plan itself keeps one entry per check).
.map((row) => ({ id: row.id, label: row.label, kind: row.kind, scope: row.scope, scopes: row.scopes }));
return {
seriesId,