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

clarify that quota-burn scope faults resolve without a catalog, unlike existence checks (#6377)

[._.]/ Adam Eivy7fcb0628c2a5
diff --git a/server/lib/quotaBurnTaskRef.js b/server/lib/quotaBurnTaskRef.js
index 79aa807ad3..de55d8c46d 100644
--- a/server/lib/quotaBurnTaskRef.js
+++ b/server/lib/quotaBurnTaskRef.js
@@ -144,10 +144,13 @@ const unavailable = (code, reason) => ({ code, reason });
* invoke (shell jobs, system-managed-only actions); absent reads as true.
* custom: { [jobId]: { enabled, eligible, appId } }
*
- * An EMPTY catalog resolves nothing: with no `builtin`/`custom` map supplied the
+ * An EMPTY catalog answers only the questions that need one. Existence, enabled
+ * state and eligibility all go unjudged — with no `builtin`/`custom` map the
* step keeps whatever the normalizer already decided rather than being declared
- * dangling, so a caller that has not loaded the catalog yet cannot mass-orphan a
- * user's plan.
+ * dangling, so a caller reading the plan before the schedule store is up cannot
+ * mass-orphan a user's plan. Target SCOPE is the exception, and deliberately so:
+ * it is a property of the reference itself, decidable from the payload alone, so
+ * it is judged either way.
*/
export function resolveQuotaBurnStepAvailability(step, catalog = {}) {
// A legacy step's verdict is decided by the payload itself, not by the
@@ -166,9 +169,10 @@ export function resolveQuotaBurnStepAvailability(step, catalog = {}) {
return null;
}
- // Scope is checked BEFORE the catalog lookup so a hand-edited config that
- // dropped a required app reports the missing app rather than a confusing
- // "unknown task" — the type is fine, the target is not.
+ // Scope runs BEFORE the catalog lookup so a hand-edited config that dropped a
+ // required app reports the missing app rather than a confusing "unknown task"
+ // — the type is fine, the target is not — and so it still reports at all when
+ // the caller has no catalog to hand.
if (requiresManagedAppTarget(ref.taskType) && !ref.appId) {
return unavailable(QUOTA_BURN_UNAVAILABLE.MISSING_APP, `scheduled task "${ref.taskType}" must name a managed app`);
}
diff --git a/server/lib/quotaBurnTaskRef.test.js b/server/lib/quotaBurnTaskRef.test.js
index f71f1f4d40..283b0fa31b 100644
--- a/server/lib/quotaBurnTaskRef.test.js
+++ b/server/lib/quotaBurnTaskRef.test.js
@@ -60,11 +60,16 @@ describe('resolveQuotaBurnStepAvailability', () => {
expect(code({ kind: 'custom', jobId: 'job-2' })).toBe(QUOTA_BURN_UNAVAILABLE.DISABLED);
});
- it('resolves nothing when the catalog has not been loaded', () => {
+ it('withholds every catalog-dependent verdict when the catalog is missing', () => {
// A caller reading the plan before the schedule store is up must not
// declare every step dangling and wipe the page's plan.
expect(resolveQuotaBurnStepAvailability(step(builtin('ux')), {})).toBeNull();
expect(resolveQuotaBurnStepAvailability(step({ kind: 'custom', jobId: 'job-1' }), {})).toBeNull();
+ // Scope is the exception: it is a property of the reference itself, so a
+ // hand-edited step that dropped its required app is broken with or without
+ // a catalog and still says so.
+ expect(resolveQuotaBurnStepAvailability(step(builtin('pr-reviewer')), {})?.code)
+ .toBe(QUOTA_BURN_UNAVAILABLE.MISSING_APP);
});
it('leaves an un-migrated legacy step on its migration reason', () => {