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: validate the Quota Burn catalog lists and announce the failure banner (#3932)

[._.]/ Adam Eivyeeb9bcd4a994
diff --git a/client/src/components/quotaBurn/FamilyCard.jsx b/client/src/components/quotaBurn/FamilyCard.jsx
index 9ba690b03e..59a20707a6 100644
--- a/client/src/components/quotaBurn/FamilyCard.jsx
+++ b/client/src/components/quotaBurn/FamilyCard.jsx
@@ -170,6 +170,12 @@ export default function FamilyCard({
<Banner
tone="warning"
icon={AlertTriangle}
+ // Announced, not just drawn: this banner appears AFTER the card is
+ // already on screen (the read resolves late, and a retry can put
+ // it back), so a screen-reader user gets no notification that the
+ // controls below just lost their choices without it.
+ role="status"
+ aria-live="polite"
title="Job choices could not be loaded"
actions={(
<button
diff --git a/client/src/pages/QuotaBurn.jsx b/client/src/pages/QuotaBurn.jsx
index aa438dc9e0..761fbab7ef 100644
--- a/client/src/pages/QuotaBurn.jsx
+++ b/client/src/pages/QuotaBurn.jsx
@@ -45,8 +45,17 @@ const READ_FAILED = Symbol('quota-burn-read-failed');
// A catalog the server answered with, but which is missing the job types the
// form needs, is indistinguishable from a failed fetch as far as the page is
// concerned — both leave every dropdown empty — so normalize to the same shape
-// and let the caller decide which message to show.
-const normalizeCatalog = (data) => ({ ...EMPTY_CATALOG, ...(data || {}) });
+// and let the caller decide which message to show. Each list is validated
+// rather than merely defaulted: a spread alone lets an explicit `null` through
+// (a partial payload, an older peer), and every consumer of this object reads
+// `.length` on it.
+const normalizeCatalog = (data) => ({
+ ...EMPTY_CATALOG,
+ ...(data || {}),
+ ...Object.fromEntries(Object.keys(EMPTY_CATALOG).map((key) => [
+ key, Array.isArray(data?.[key]) ? data[key] : [],
+ ])),
+});
export default function QuotaBurn() {
// Which family is expanded lives in the URL, not local state, so a specific
diff --git a/client/src/pages/QuotaBurn.test.jsx b/client/src/pages/QuotaBurn.test.jsx
index ed515ae62b..b3472553cd 100644
--- a/client/src/pages/QuotaBurn.test.jsx
+++ b/client/src/pages/QuotaBurn.test.jsx
@@ -398,6 +398,27 @@ describe('QuotaBurn catalog failure', () => {
expect(await screen.findByText(/The server returned no job types\./)).toBeInTheDocument();
});
+ it('survives a partial catalog payload whose lists are null', async () => {
+ // A spread over the empty default lets an explicit `null` through, and every
+ // consumer reads `.length` on these lists — so an older peer or a partial
+ // response would take the whole page down with a TypeError instead of
+ // reporting an unusable catalog.
+ api.getQuotaBurnCatalog.mockResolvedValueOnce({ jobTypes: null, apps: null, universes: null, imageModes: null });
+ renderPage('/devtools/quota-burn/grok');
+ expect(await screen.findByText(/The server returned no job types\./)).toBeInTheDocument();
+ expect(screen.getByText(/62% left/)).toBeInTheDocument();
+ });
+
+ it('announces the banner to assistive tech rather than only drawing it', async () => {
+ // It appears after the card is already on screen — the read resolves late,
+ // and a retry can put it back — so nothing announces it without a live region.
+ api.getQuotaBurnCatalog.mockRejectedValueOnce(new Error('Catalog request failed'));
+ renderPage('/devtools/quota-burn/grok');
+ const banner = await screen.findByRole('status');
+ expect(banner).toHaveAttribute('aria-live', 'polite');
+ expect(banner).toHaveTextContent('Job choices could not be loaded');
+ });
+
it('says nothing about the catalog when it loaded', async () => {
renderPage('/devtools/quota-burn/grok');
await screen.findByLabelText(/Add a preset job/);