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

fix: foundation structure fix degrades gracefully on a locked arc (#2176)

Adam Eivyf33c8003a3d3
diff --git a/server/services/pipeline/foundationJudge.js b/server/services/pipeline/foundationJudge.js
index a96bb80440..f6a68337bb 100644
--- a/server/services/pipeline/foundationJudge.js
+++ b/server/services/pipeline/foundationJudge.js
@@ -520,8 +520,15 @@ export async function applyFoundationFix(seriesId, dimension, { finding = {}, pr
}
if (dimension === 'structure') {
+ // A locked arc is a constraint, not a fix target — resolveVerifyIssues throws
+ // on a locked arc, which would error the whole run. Degrade to a graceful
+ // "can't apply" so the gate pauses for human review instead (mirrors the
+ // no-linked-universe / fully-locked-cast paths above).
+ if (series?.locked?.arc === true) {
+ return { dimension, applied: false, reason: 'arc is locked (a constraint, not a fix target)' };
+ }
// Synthesize an arc finding from the judge's structure gap/fix and route it
- // through the existing arc-resolve owning service (respects the arc lock).
+ // through the existing arc-resolve owning service.
const findings = [{
severity: 'high',
location: 'arc',
diff --git a/server/services/pipeline/foundationJudge.test.js b/server/services/pipeline/foundationJudge.test.js
index 507b07216b..c53a4622b8 100644
--- a/server/services/pipeline/foundationJudge.test.js
+++ b/server/services/pipeline/foundationJudge.test.js
@@ -252,6 +252,13 @@ describe('applyFoundationFix — dimension → owning-service routing table', ()
expect(r).toMatchObject({ dimension: 'worldbuilding', applied: false });
});
+ it('reports applied:false (not a throw) for structure when the arc is locked', async () => {
+ seriesSvc.getSeries.mockResolvedValue({ id: 'ser-1', name: 'S', universeId: 'uni-1', locked: { arc: true } });
+ const r = await applyFoundationFix('ser-1', 'structure', { finding: { gap: 'g', fix: 'f' } });
+ expect(arcPlanner.resolveVerifyIssues).not.toHaveBeenCalled();
+ expect(r).toMatchObject({ dimension: 'structure', applied: false });
+ });
+
it('reports applied:false for character when no unlocked blank character exists', async () => {
universeBuilder.getUniverse.mockResolvedValue({ id: 'uni-1', characters: [{ id: 'locked', name: 'A', locked: true }] });
const r = await applyFoundationFix('ser-1', 'character', {});