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
fix(#2992): don't block unbind when a seeded contract is untouched
[._.]/ Adam Eivya0ac49e18777
diff --git a/client/src/components/sprites/PublishWorkflow.jsx b/client/src/components/sprites/PublishWorkflow.jsxindex 918f15b2d9..388fbf06cc 100644--- a/client/src/components/sprites/PublishWorkflow.jsx+++ b/client/src/components/sprites/PublishWorkflow.jsx@@ -96,11 +96,17 @@ export default function PublishWorkflow({ record, walk, atlas, onChanged }) {const colsNum = colsRaw === '' ? null : Number(colsRaw);const hasContract = framesNum !== null;+ // Whether the contract INPUTS were edited (vs. merely seeded from the saved+ // binding). Used both for the dirty check and to scope the no-binding error+ // to a user who actually typed a contract — an untouched seeded contract must+ // not block an unbind (sending `binding: null` clears it server-side anyway).+ const contractFieldsDirty = seedFrames !== framesRaw || seedCell !== cellRaw || seedCols !== colsRaw;+const intInRange = (n, lo, hi) => Number.isInteger(n) && n >= lo && n <= hi;// Validate only what's populated; walkFrameCount is required whenever any- // contract field is set (the server rejects a contract without it). A contract- // is also meaningless without an app + destination — the binding it would ride- // on is null, so the value would be silently discarded; block that instead.+ // contract field is set (the server rejects a contract without it). A freshly+ // typed contract is also meaningless without an app + destination — the+ // binding it would ride on is null, so the value would be silently discarded.let contractError = null;if (!hasContract && (cellRaw !== '' || colsRaw !== '')) {contractError = 'Walk frame count is required for a runtime contract.';@@ -110,17 +116,15 @@ export default function PublishWorkflow({ record, walk, atlas, onChanged }) {contractError = 'Cell size must be a whole number 16–1024.';} else if (colsNum !== null && !intInRange(colsNum, 1, 256)) {contractError = 'Column count must be a whole number 1–256.';- } else if (hasContract && !(appId && destPath.trim())) {- contractError = 'Bind an app and destination before declaring a contract.';+ } else if (hasContract && contractFieldsDirty && !(appId && destPath.trim())) {+ contractError = 'Bind an app and destination, or clear the contract.';}- // Dirty relative to the SAVED contract, comparing the seeded string forms so- // "opened but untouched" never counts as a change. A re-point (appId change)- // with a populated contract also counts as dirty so the displayed values are- // sent explicitly against the new app — otherwise the omitted-key path drops- // them (server inheritance is app-scoped) while the fields still show them.- const contractDirty = seedFrames !== framesRaw || seedCell !== cellRaw || seedCols !== colsRaw- || (hasContract && appId !== (saved?.appId || ''));+ // A re-point (appId change) with a populated contract also counts as dirty so+ // the displayed values are sent explicitly against the new app — otherwise the+ // omitted-key path drops them (server inheritance is app-scoped) while the+ // fields still show them.+ const contractDirty = contractFieldsDirty || (hasContract && appId !== (saved?.appId || ''));const fillFromAtlas = () => {const geometry = current?.geometry;diff --git a/client/src/components/sprites/PublishWorkflow.test.jsx b/client/src/components/sprites/PublishWorkflow.test.jsxindex 02794bfc70..6e00a53df4 100644--- a/client/src/components/sprites/PublishWorkflow.test.jsx+++ b/client/src/components/sprites/PublishWorkflow.test.jsx@@ -107,6 +107,18 @@ describe('PublishWorkflow runtime contract', () => {expect(binding.runtimeContract).toEqual({ walkFrameCount: 12, cellSize: 96, columnCount: 13 });});+ it('lets an unbind proceed even while a saved contract is displayed', async () => {+ renderWorkflow(savedContractBinding);++ // Unbinding (app → "— none —") must not be blocked by the seeded, untouched+ // contract — the binding:null it sends clears the contract server-side.+ fireEvent.change(screen.getByLabelText('Managed app'), { target: { value: '' } });+ expect(screen.getByText('Save binding')).not.toBeDisabled();+ await act(async () => { fireEvent.click(screen.getByText('Save binding')); });++ expect(lastBindingArg()).toBeNull();+ });+it('blocks a contract with no app/destination and explains why', () => {renderWorkflow(null, atlasWith());