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: keep a Quota Burn read that threw distinct from one that answered with nothing (#3930)

[._.]/ Adam Eivy5f825dc20990
diff --git a/client/src/pages/QuotaBurn.jsx b/client/src/pages/QuotaBurn.jsx
index 9a4be23c23..2d072d9b55 100644
--- a/client/src/pages/QuotaBurn.jsx
+++ b/client/src/pages/QuotaBurn.jsx
@@ -38,6 +38,10 @@ const PENDING_POLL_MS = 4000;
const EMPTY_CATALOG = { jobTypes: [], apps: [], universes: [], imageModes: [] };
+// Distinguishes a read that THREW from one that resolved with nothing — the
+// two need opposite handling of the error state, and both are falsy.
+const READ_FAILED = Symbol('quota-burn-read-failed');
+
export default function QuotaBurn() {
// Which family is expanded lives in the URL, not local state, so a specific
// family's plan is linkable and survives a reload.
@@ -84,11 +88,16 @@ export default function QuotaBurn() {
// `silent: true` because the failure is rendered by this page's own banner
// rather than a toast — see client/src/CLAUDE.md's silent-vs-toasting rule.
const data = await api.getQuotaBurn(refresh, { silent: true })
- .catch((err) => { setLoadError(err?.message || 'The request failed.'); return null; });
- if (!data) return;
+ .catch((err) => { setLoadError(err?.message || 'The request failed.'); return READ_FAILED; });
+ // The sentinel — not a falsy check — is what separates the two: a read that
+ // FAILED must keep its message, while a read that merely answered with
+ // nothing has to clear the previous failure, or the banner goes on blaming
+ // a network error for what is now the server returning no plan.
+ if (data === READ_FAILED) return;
// Cleared on ANY successful read, including the polls: the last error no
// longer describes the page once the server has answered.
setLoadError(null);
+ if (!data) return;
// `status` is derived server-side and never edited here, so it is always
// safe to adopt; `config` is the form's own state and must not be rewound.
setStatus(data.status);
diff --git a/client/src/pages/QuotaBurn.test.jsx b/client/src/pages/QuotaBurn.test.jsx
index 51402ba7f0..e326be2c2a 100644
--- a/client/src/pages/QuotaBurn.test.jsx
+++ b/client/src/pages/QuotaBurn.test.jsx
@@ -480,6 +480,21 @@ describe('QuotaBurn save races', () => {
expect(screen.getByRole('button', { name: 'Retry' })).toBeInTheDocument();
});
+ it('stops blaming the network once the read succeeds with nothing', async () => {
+ // Both a thrown read and an empty one are falsy, so an early return keyed
+ // on falsiness would leave the first attempt's network error on screen
+ // describing what is now a server that simply answered with no plan.
+ const user = userEvent.setup();
+ api.getQuotaBurn.mockRejectedValueOnce(new Error('Network request failed'));
+ api.getQuotaBurn.mockResolvedValueOnce(null);
+ renderPage();
+
+ expect(await screen.findByText('Network request failed')).toBeInTheDocument();
+ await user.click(screen.getByRole('button', { name: 'Retry' }));
+ expect(await screen.findByText('The server did not return a plan.')).toBeInTheDocument();
+ expect(screen.queryByText('Network request failed')).not.toBeInTheDocument();
+ });
+
it('does not commit 0 when a number field is cleared to be retyped', async () => {
// Number('') === 0, which is below the server minimum for the interval and
// the dispatch cap — a 400 that also discards every co-pending edit.