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 self-review: id collisions, a save indicator that can lie, dead prop
[._.]/ Adam Eivye02a4a46881e
diff --git a/client/src/components/quotaBurn/FamilyCard.jsx b/client/src/components/quotaBurn/FamilyCard.jsxindex 37c01e35b0..8acfae1ada 100644--- a/client/src/components/quotaBurn/FamilyCard.jsx+++ b/client/src/components/quotaBurn/FamilyCard.jsx@@ -38,7 +38,19 @@ export default function FamilyCard({// page is reloaded. The catalog fetch is best-effort (the page still renders// without it), so gate on it rather than minting an unsavable row.const canAddJob = catalog.jobTypes.length > 0;- const nextJobId = () => `job-${Date.now().toString(36)}`;+ // Ids key the React list AND pair each job with its server-side pending count,+ // so a duplicate is a real defect, not a cosmetic one. `Date.now()` alone can+ // repeat within the same millisecond (two adds from one handler, a preset add+ // immediately following a blank add), so disambiguate against the ids already+ // in the plan rather than trusting the clock to have ticked.+ const nextJobId = () => {+ const taken = new Set(jobs.map((job) => job.id));+ const base = `job-${Date.now().toString(36)}`;+ if (!taken.has(base)) return base;+ let suffix = 2;+ while (taken.has(`${base}-${suffix}`)) suffix += 1;+ return `${base}-${suffix}`;+ };const addJob = () => patchJobs([...jobs, {id: nextJobId(),enabled: true,@@ -51,10 +63,10 @@ export default function FamilyCard({// A preset job inherits the app the plan is already pointed at, when the plan// is unambiguous about it — otherwise a one-click "add a UX audit" lands as a// step that cannot run until the user notices the unset app picker.- const inheritedAppId = [...new Set(jobs.map((job) => job.params?.appId).filter(Boolean))];+ const targetedAppIds = [...new Set(jobs.map((job) => job.params?.appId).filter(Boolean))];const addPresetJob = (preset) => patchJobs([...jobs, jobFromPreset(preset, {id: nextJobId(),- appId: inheritedAppId.length === 1 ? inheritedAppId[0] : null,+ appId: targetedAppIds.length === 1 ? targetedAppIds[0] : null,})]);return (diff --git a/client/src/components/quotaBurn/PresetPicker.jsx b/client/src/components/quotaBurn/PresetPicker.jsxindex f728f6fa4e..0ea7f8051e 100644--- a/client/src/components/quotaBurn/PresetPicker.jsx+++ b/client/src/components/quotaBurn/PresetPicker.jsx@@ -15,7 +15,7 @@import { inputClass } from './fields';-export default function PresetPicker({ id, label, presets, jobType = null, onPick, disabled = false, hint }) {+export default function PresetPicker({ id, label, presets, jobType = null, onPick, hint }) {// Presets declare the job type they seed, so a plan with several job types// only ever offers the ones that can apply here.const rows = (presets || []).filter((preset) => !jobType || preset.jobType === jobType);@@ -28,7 +28,6 @@ export default function PresetPicker({ id, label, presets, jobType = null, onPicid={id}className={inputClass}value=""- disabled={disabled}onChange={(event) => {const picked = rows.find((preset) => preset.id === event.target.value);if (picked) onPick(picked);diff --git a/client/src/pages/QuotaBurn.jsx b/client/src/pages/QuotaBurn.jsxindex d4a588ddd4..cc6221d506 100644--- a/client/src/pages/QuotaBurn.jsx+++ b/client/src/pages/QuotaBurn.jsx@@ -47,6 +47,12 @@ export default function QuotaBurn() {// has actually landed — otherwise the user changes a model, clicks Burn, and// the server burns with the previous value.const [unsaved, setUnsaved] = useState(false);+ // Distinct from `unsaved`: the retry budget is spent and nothing is in flight+ // any more. Collapsing the two would leave the header's indicator saying+ // "Saving changes…" forever after a save gave up — a claim of progress that is+ // false, on the one control whose whole job is to tell the truth about+ // persistence.+ const [saveStalled, setSaveStalled] = useState(false);const [running, setRunning] = useState(false);const pendingRef = useRef(null);// Monotonic counter over local edits. Every server response records the value@@ -106,11 +112,13 @@ export default function QuotaBurn() {persistRef.current?.();} else {retriedRef.current = false;+ setSaveStalled(true);toast.error('Changes are still unsaved — edit a field to retry.');}return;}retriedRef.current = false;+ setSaveStalled(false);// The server's normalization is authoritative — adopt what it stored, but// only while no newer keystroke has landed. Then re-read status so pending// counts and skip reasons match the saved plan.@@ -135,6 +143,9 @@ export default function QuotaBurn() {const save = (patch) => {editSeqRef.current += 1;setUnsaved(true);+ // A new edit re-arms the debounce, so the previous give-up no longer+ // describes the current state.+ setSaveStalled(false);setConfig((prev) => mergeQuotaBurnPatch(prev, patch));pendingRef.current = mergeQuotaBurnPatch(pendingRef.current, patch);persist();@@ -167,8 +178,13 @@ export default function QuotaBurn() {{/* There is no Save button on this page, and nothing else said so — thesilence is what makes people reach for the nearest button-shapedthing (the per-job ▶, which spends quota) to "commit" an edit. */}- <span className={`text-[11px] ${unsaved ? 'text-amber-300' : 'text-gray-500'}`} aria-live="polite">- {unsaved ? 'Saving changes…' : 'Changes save automatically'}+ <span+ className={`text-[11px] ${saveStalled ? 'text-port-error' : unsaved ? 'text-amber-300' : 'text-gray-500'}`}+ aria-live="polite"+ >+ {saveStalled+ ? 'Not saved — edit a field to retry'+ : unsaved ? 'Saving changes…' : 'Changes save automatically'}</span><buttontype="button"diff --git a/client/src/pages/QuotaBurn.test.jsx b/client/src/pages/QuotaBurn.test.jsxindex e5274d1ef9..0df2b3fd50 100644--- a/client/src/pages/QuotaBurn.test.jsx+++ b/client/src/pages/QuotaBurn.test.jsx@@ -253,6 +253,24 @@ describe('QuotaBurn save races', () => {expect(api.saveQuotaBurn.mock.calls[1][0].families.grok.jobs[0].label).toContain('Z!');});+ it('stops claiming it is saving once the retry budget is spent', async () => {+ // The header indicator is the page's only persistent statement about+ // persistence (there is no Save button). Leaving it on "Saving changes…"+ // after both attempts failed asserts progress that is not happening.+ api.saveQuotaBurn.mockRejectedValue(new Error('400'));+ const user = userEvent.setup();+ renderPage('/devtools/quota-burn/grok');+ await user.type(await screen.findByLabelText('Name for step 1'), 'Z');+ await waitFor(() => expect(api.saveQuotaBurn).toHaveBeenCalledTimes(2));+ expect(await screen.findByText('Not saved — edit a field to retry')).toBeInTheDocument();++ // The next edit re-arms the debounce, so the give-up no longer applies.+ api.saveQuotaBurn.mockResolvedValue({ config });+ await user.type(screen.getByLabelText('Name for step 1'), '!');+ expect(screen.getByText('Saving changes…')).toBeInTheDocument();+ await waitFor(() => expect(screen.getByText('Changes save automatically')).toBeInTheDocument());+ });+it('flushes a pending edit on unmount instead of dropping it', async () => {// cancel() alone discards everything typed in the last debounce window —// navigating away 200ms after pasting a prompt lost it with no indicator.