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

address review (codex r3): send single-field partials, merge per-check override

Adam Eivy84bd4941d87b
diff --git a/client/src/components/pipeline/editorial/EditorialCheckCard.jsx b/client/src/components/pipeline/editorial/EditorialCheckCard.jsx
index c2b0601c08..d467ff4df1 100644
--- a/client/src/components/pipeline/editorial/EditorialCheckCard.jsx
+++ b/client/src/components/pipeline/editorial/EditorialCheckCard.jsx
@@ -6,8 +6,12 @@
* Presentational — all persistence is lifted to PipelineEditorialChecks:
* onToggle(checkId, nextEnabled) → optimistic enable/disable PATCH
* onConfigSave(checkId, nextConfig) → PATCH the global config blob (Promise)
- * onSeriesConfigSave(checkId, nextOverride) → PATCH this series' override (#1591);
- * pass `null` to clear the override
+ * onSeriesConfigSave(checkId, patch) → merge a PARTIAL per-series override
+ * ({ [key]: value }) for this check (#1591);
+ * pass `null` to clear the whole override.
+ * Sending only the changed key (not the
+ * whole config) lets the page compose rapid
+ * multi-field edits without dropping one.
* The card only owns the in-progress *input* draft; committed values come back
* down through `check.config` (global) and `seriesConfig` (the selected series'
* override for this check, when a series is selected).
@@ -187,7 +191,10 @@ function EditorialCheckCard({
value={seriesConfig?.[field.key] ?? check.config?.[field.key]}
disabled={seriesSaving}
resetNonce={seriesResetNonce}
- onCommit={(key, val) => onSeriesConfigSave(check.id, { ...(seriesConfig || {}), [key]: val })}
+ // Send ONLY the changed key — the page merges it onto the freshest
+ // server-confirmed map, so a rapid second field edit (built before the
+ // first save lands) can't drop the first via a stale full-config snapshot.
+ onCommit={(key, val) => onSeriesConfigSave(check.id, { [key]: val })}
/>
))}
{hasSeriesOverride ? (
diff --git a/client/src/components/pipeline/editorial/EditorialCheckCard.test.jsx b/client/src/components/pipeline/editorial/EditorialCheckCard.test.jsx
index f30de5c4c5..b85a67ae3c 100644
--- a/client/src/components/pipeline/editorial/EditorialCheckCard.test.jsx
+++ b/client/src/components/pipeline/editorial/EditorialCheckCard.test.jsx
@@ -100,6 +100,35 @@ describe('EditorialCheckCard', () => {
expect(screen.getByLabelText('Minimum shared signals to flag').value).toBe('2');
});
+ it('sends ONLY the changed field as a partial (so the page can compose multi-field edits)', () => {
+ const twoFieldCheck = {
+ ...check,
+ config: { minSharedSignals: 2, maxFindings: 10 },
+ configFields: [
+ { key: 'minSharedSignals', label: 'Minimum shared signals to flag', type: 'number', min: 1, max: 5, step: 1 },
+ { key: 'maxFindings', label: 'Max findings', type: 'number', min: 1, max: 50, step: 1 },
+ ],
+ };
+ const onSeriesConfigSave = vi.fn();
+ render(
+ <EditorialCheckCard
+ check={twoFieldCheck}
+ seriesId="ser-1"
+ seriesConfig={{ maxFindings: 20 }} // an existing override on the OTHER field
+ onToggle={vi.fn()}
+ onConfigSave={vi.fn()}
+ onSeriesConfigSave={onSeriesConfigSave}
+ />,
+ );
+ fireEvent.click(screen.getByRole('button', { name: /override for this series/i }));
+ const input = screen.getByLabelText('Minimum shared signals to flag');
+ fireEvent.change(input, { target: { value: '4' } });
+ fireEvent.blur(input);
+ // The card sends ONLY the edited key — NOT a full snapshot that would carry a
+ // stale maxFindings and clobber the other field's pending/persisted value.
+ expect(onSeriesConfigSave).toHaveBeenCalledWith('naming.dissimilar-names', { minSharedSignals: 4 });
+ });
+
it('shows an active badge and clears the override via Reset to global', () => {
const onSeriesConfigSave = vi.fn();
render(
diff --git a/client/src/pages/PipelineEditorialChecks.jsx b/client/src/pages/PipelineEditorialChecks.jsx
index 7a11939d3b..841f84b158 100644
--- a/client/src/pages/PipelineEditorialChecks.jsx
+++ b/client/src/pages/PipelineEditorialChecks.jsx
@@ -228,7 +228,11 @@ export default function PipelineEditorialChecks() {
overrideMapRef.current = seriesOverrides ? { ...seriesOverrides } : {};
}, [seriesId, seriesOverrides]);
- const handleSeriesConfigSave = useCallback((checkId, nextOverride) => {
+ // `patch` is a PARTIAL per-check override ({ [key]: value }) to merge, or `null`
+ // to clear the whole check. Merging (rather than replacing the per-check entry)
+ // means a second field edit for the same check — built in the card before the
+ // first save lands — composes onto the first instead of dropping it.
+ const handleSeriesConfigSave = useCallback((checkId, patch) => {
const sid = activeSeriesRef.current;
if (!sid) return;
setSavingSeriesIds((s) => new Set(s).add(checkId));
@@ -236,8 +240,8 @@ export default function PipelineEditorialChecks() {
.then(async () => {
// Build at execution time from the freshest server-confirmed map.
const map = { ...overrideMapRef.current };
- if (!nextOverride || Object.keys(nextOverride).length === 0) delete map[checkId];
- else map[checkId] = nextOverride;
+ if (patch === null) delete map[checkId];
+ else map[checkId] = { ...(map[checkId] || {}), ...patch };
const saved = await updatePipelineSeries(sid, { editorialCheckConfig: map }, { silent: true })
.catch((err) => {
toast.error(err.message || 'Failed to save series override');