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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): gate all POV no-arc findings on complete+fresh arc coverage
[._.]/ Adam Eivy4b0a2039fff5
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex efce5b426a..adfddd5d8f 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -1213,29 +1213,22 @@ export const EDITORIAL_CHECKS = [}if (holders.size === 0) return [];- // Detected arc directions (the #arc-transitions fallback). Empty when neither- // the dedicated arc model nor the editorial analysis has run — in that case we- // can't tell a justified POV from an unjustified one, so the no-arc check stays- // silent (degrade gracefully, no false positives). The structural drive-by- // check below reads only the outline, so it still runs.+ // Detected per-character arc directions (the #arc-transitions fallback),+ // keyed by normalized name for the holder lookup below. Trustworthiness is+ // governed by coverage completeness (canJudgeArcs), not by emptiness.const arcs = Array.isArray(ctx.editorialArcs) ? ctx.editorialArcs : [];const arcByName = new Map(arcs.map((a) => [normalizeName(a?.name), a]).filter(([k]) => k));- const haveArcModel = arcByName.size > 0;- // Whether every analyzable issue has been analyzed and is fresh (set by the- // runner from the editorial-analysis coverage). It gates only the- // *absent-from-arcs* finding: under partial coverage a POV holder can be- // missing from `arcByName` simply because their issue was never analyzed- // (a canceled/early-stopped batch), NOT because they lack an arc — flagging- // that absence would be a false positive. A character who IS present but- // reads flat was definitively analyzed, so that finding stands regardless.- const arcsComplete = ctx.editorialArcsComplete === true;- // We can judge POV justification when there are detected arcs to compare- // against OR when analysis is verified complete — a complete pass that- // detected zero arcs still means every POV holder genuinely lacks one, so- // an empty-but-complete model must not silently suppress the no-arc finding.- const canJudgeArcs = haveArcModel || arcsComplete;+ // Only cross-reference arcs when the editorial analysis is COMPLETE and+ // FRESH (every analyzable issue analyzed, none drifted — set by the runner+ // from the coverage stats). A partial batch (some issues never analyzed) or+ // a prose-staled snapshot yields unreliable arc directions: an absent holder+ // may simply be unanalyzed, and a "flat" reading may be outdated. In either+ // case we can't trust the cross-reference, so we fall back to the structural+ // drive-by check alone (graceful degradation). When coverage IS complete, an+ // empty arc set is meaningful — every POV holder genuinely lacks an arc.+ const canJudgeArcs = ctx.editorialArcsComplete === true;const findings = [];const flag = ({ severity, location, problem, suggestion, anchorQuote = '', issueNumber = null }) =>@@ -1249,15 +1242,13 @@ export const EDITORIAL_CHECKS = [const anchorQuote = typeof first?.anchorQuote === 'string' ? first.anchorQuote : '';// 1) Unjustified POV — narrates a viewpoint but has no detected arc. Only- // when we can judge arcs at all (else we can't tell). The absent-from-- // arcs sub-case additionally requires complete coverage so a not-yet-- // analyzed POV holder isn't mistaken for an arc-less one.+ // when arcs are trustworthy (complete + fresh coverage, gated above);+ // a holder reads "no arc" when their detected direction is flat or they+ // don't appear in the (complete) arc set at all.if (flagUnjustified && canJudgeArcs) {const arc = arcByName.get(holder.key) || null;const arcIsFlat = !arc || typeof arc.arcDirection !== 'string' || arc.arcDirection === 'flat';- // A present-but-flat character was definitively analyzed → real "no arc".- // An absent character is only "no arc" once coverage is complete.- if (arcIsFlat && (arc || arcsComplete)) {+ if (arcIsFlat) {flag({severity: ctx.severityDefault,location: where,diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex d44ba5fe30..1d46514b21 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -759,27 +759,25 @@ describe('pov.justified — deterministic check', () => {expect(findings[0].problem).toMatch(/not present in the detected arcs/);});- it('under partial coverage, suppresses the absent-from-arcs finding but keeps present-but-flat', () => {- // Arc analysis only partially complete: Flat was analyzed (reads flat), Ghost's- // issue was never analyzed (absent). Absent ≠ no-arc here, so Ghost must NOT be- // flagged unjustified; Flat (definitively analyzed) still is.+ it('under incomplete/stale coverage, suppresses ALL no-arc findings (arc data is unreliable)', () => {+ // Partial or prose-staled analysis → a present "flat" reading may be outdated+ // and an absent holder may simply be unanalyzed. Neither is trustworthy, so the+ // no-arc check stays silent; only the structural drive-by check would run.const findings = runPov([scene('Flat'), scene('Flat'), scene('Ghost'), scene('Ghost')],{ config: { driveByMaxScenes: 0 }, arcs: [{ name: 'Flat', arcDirection: 'flat', issueCount: 2 }], arcsComplete: false },);- const unjustified = findings.filter((f) => /no detected character arc/.test(f.problem));- expect(unjustified).toHaveLength(1);- expect(unjustified[0].problem).toMatch(/"Flat"/);- expect(findings.some((f) => /"Ghost"/.test(f.problem))).toBe(false);+ expect(findings).toEqual([]);});- it('once coverage is complete, the same absent POV holder IS flagged', () => {+ it('once coverage is complete, both the present-flat and absent POV holders are flagged', () => {const findings = runPov(- [scene('Ghost'), scene('Ghost')],+ [scene('Flat'), scene('Flat'), scene('Ghost'), scene('Ghost')],{ config: { driveByMaxScenes: 0 }, arcs: [{ name: 'Flat', arcDirection: 'flat', issueCount: 2 }], arcsComplete: true },);- expect(findings).toHaveLength(1);- expect(findings[0].problem).toMatch(/not present in the detected arcs/);+ expect(findings).toHaveLength(2);+ expect(findings.find((f) => /"Flat"/.test(f.problem)).problem).toMatch(/arc direction is flat/);+ expect(findings.find((f) => /"Ghost"/.test(f.problem)).problem).toMatch(/not present in the detected arcs/);});it('flags a drive-by (single-scene) POV via the inverse-imbalance check', () => {