Skip to content

fix(apps): each app's operations go through one manager, one at a time - #1922

Merged
MorningLightMountain713 merged 123 commits into
developmentfrom
fix/one-operation-per-app
Nov 25, 2026
Merged

MorningLightMountain713 merged 123 commits into
developmentfrom
fix/one-operation-per-app

Conversation

@MorningLightMountain713

@MorningLightMountain713 MorningLightMountain713 commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #1921: it builds on the restore record and the operation hold that PR adds, and lands in the same release.

Why

Each kind of operation guarded an app its own way: node-wide flags, a per-app lease only some operations took, and a force that skipped the flags. So operations on one app collided, and an operation on one app stalled every other app:

  • two forced removals of one app both ran, and the first to finish cleared the other's flag while it was still tearing the app down;
  • a removal that met a redeploy got no lease and ran anyway;
  • no install read the per-app lease, and the network's reinstall pass took none, so a backup could run beside its own component's reinstall;
  • an owner's start during a restore cleared the record of a component still being replaced;
  • the reconciler could recreate a container (reformatting its volume) while a backup or restore held the app;
  • one app's redeploy or install deferred every app's reconcile, and installs of different apps waited on each other.

What changes

  • One manager per app. Every operation on an app is submitted to that app's manager (operationRegistry.submit), which runs them one at a time and releases the app when each ends, on every exit. Nothing is released on a timer:
    • a removal stops the running operation at its next step, drops what is pending, and runs next; a second removal of the same target joins the first;
    • a redeploy or install runs now when the app is free, otherwise waits in the manager; pending ones coalesce, the newest runs, and every caller gets its outcome; refused while a removal is pending or running;
    • a backup, restore, owner start, stop or restart, heal, hand-back or rebuild is taken now or refused;
    • a step (a redeploy's reinstall, a hand-back's removal, a rebuild's removal) runs under its parent's hold.
  • Every operation on an app goes through its manager, including the ones that ran beside it:
    • the heal of a folder an unfinished restore holds;
    • the give-up pass's hand-back — its safety check, a copy's stop and proof, and its removal — so the copy it proved is the copy it removes, at the turn it decided on; a busy app is left to a later turn;
    • the reconciler's rebuild of a container (a missing one, or one with a stale network endpoint, removed and recreated), which the reconciler counts as construction; refused, the component is passed again once the app is free.
  • A removal no one watches does not wait behind another operation. A call with no response stream answers PENDING while an operation other than a removal holds the app; the removal stays sent, runs once the app is free, and one asked meanwhile joins it. A removal streaming to a caller waits for its outcome.
  • Every short docker request has a deadline, so no docker call holds an operation, and its app, for ever: reads dockerProbeTimeoutMs (20 s); a stop its own SIGKILL wait plus dockerStopSlackMs (30 s); a restart a stop and a start; every other short request dockerRequestTimeoutMs (120 s). A request past its deadline is cancelled and fails as any failed request does. dockerode's network and image inspects pass no signal on, so those reads go through docker-modem. Streams, transfers, sized reads, disk usage and the image prune carry none; a pull keeps its stall abort.
  • The spawner stops for a move and for lost readiness, and decides again after. It runs on one FluxController (spawnerControl) while the node is ready and no move of its address is being worked through. Losing readiness, or a move whose apps or geolocation are still to be handled, stops it: every attempt in flight is marked stopped at once and checks its own mark at its waits and its install, so an attempt busy elsewhere when the stop came installs nothing; an attempt stopped that way withdraws its installing claim and is not held against the app, and one stopped after its own install keeps the app's mark. An install of an app from any other route stops an attempt still deciding on that app, which neither takes the app nor marks it failed, and the spawner decides afresh. Its install starts under the controller's lock, held until the node records the app: a stop that comes first installs nothing, and one that comes later finds the app among the node's apps without waiting for the install to finish. A move handles the node's apps once the spawner has stopped, an app being installed among them (its operation runs after the install). The spawner stays stopped while the move has apps to handle or a geolocation to find, between the move's passes as well as during them (setMoveDue), and starts again once both are handled; the move is taken as located only when the geolocation held is for its new IP. It counts the apps a node holds, running or not, against maxAppsPerNode.
  • Long operations stop at their next step when a removal takes the app: image pull, volume create, tar, download, unpack and a rebuild's install check the operation's signal.
  • A redeploy replaces the app in place. A soft redeploy checks the new spec with the app's own share left out, tears down the containers, writes the new spec into the app's row and creates the containers; its row never stops describing the app. A hard redeploy is checked before its teardown; an app whose new spec does not fit the node is handed back in turn by the give-up pass (OUTGROWN), one holder at a time.
  • An update that asks for another kind of node is handed back. While the installed spec differs from the registered one, the give-up pass also asks whether the node is the kind the new spec needs: a v7+ spec with staticip on a node behind NAT, or a v8+ spec with datacenter on a node the published table classes residential (dataCenterShortfall), is handed back in turn (UNSUITED), as OUTGROWN is. An update's requirements read the same data-centre rule, so an update turning on datacenter is not applied where the table classes the node residential, and is handed back. Only a definite answer hands back: an interface that cannot be read, a conflicted or missing classification, or a spec that cannot be read keeps the app. The give-up reasons are one frozen enum (GiveUpReason).
  • A node behind NAT is DYNAMIC whether or not its address just moved. A node with no public address on the interface its traffic leaves by is asked first, and is never static; the ten-day window after a watched address change decides only for a node that holds a public address.
  • An update is checked before any component comes down. The update pass, and an owner's soft or hard redeploy of one component, check the node can take the new spec first; one it cannot take leaves the app running as it is, its data and row untouched, and is published (app:updateDeclined).
  • No failed redeploy or update removes an app that has run here. When a component's recreate fails, an app any component of which has run on the node (hasSuccessfullyStarted, a run that lasts firstRunProofMs) is kept, the failed component down and its recreate retried on the restart ladder; an app none of whose components has run here is a failed install and is removed. An installed spec or runtime record that cannot be read removes nothing. A component that fails to install removes nothing from its app.
  • Callers that go through apps in turn (the reinstall pass, image update check, storage inspector, volume validation) do not wait: a busy app's redeploy is refused and left for that caller's next round. A pass that removes several apps (the shared-DB uninstall check, the unregistered-enterprise and enterprise-network cleanups, the non-arcaneOS enterprise check) sends their removals together and ends once all have.
  • Nothing node-wide but what installs share. Installs of different apps run at once; the resource check and the reservation of the app's footprint are one step, each check counts the reservations of installs not yet written, and an install releases its reservation once its row is written or on any exit. Ports and the docker subnet are claimed where they are handed out. A residential node is not empty while an install or redeploy is bringing an app onto it.
  • The reconciler stands aside only for an operation on its own app, passes that app again when the operation ends (app:operationEnded), and starts nothing of an app whose removal is pending. No pass over every app stands aside for the node. The syncthing health monitor skips only the folders of an app an operation holds.
  • A test install is a test run. /apps/testappinstall starts the app's containers, each at a fixed 0.2 CPU and 300 MB under flux.slice, judges each as soon as it starts and removes everything at once: an exited container fails with its exit code and last log lines; a runonflux/orbit (Deploy with Git) container is passed on its build check (/api/status, every 5 s, up to 2 minutes), reached at its address on the run's network; any other passes on starting. It takes no operation slot, writes no row, opens no host port and creates no syncthing folder; the passing line is development's. A boot sweep removes what a run left (its containers, networks and directories) before the next run starts. The test run is interim: v9 removes it in favour of the playground.
  • One rule decides when an image leaves a node (imageReaper): only when no container references it (running or stopped, by reference or id), it is not FluxOS's own file-operation image, and no install, redeploy, rebuild or test run is in progress, the last check and the removal in one synchronous step. A tagged image is removed by its tags, an untagged one by its id. Every image removal goes through it: the uninstaller's, and a pass at boot, every imageReapPeriod blocks (720), after an image update that updated, and after each test run. The install-time dangling prune is removed.
  • FluxOS records each app container it takes down before it removes it (removedByFluxOs in the component's runtime state), and sends no removal it cannot record. The record is cleared when the container is created again, when the reconciler sees it in place, or with the app; the reconciler reads it before calling a missing container tampering, defers when it cannot read it, and leaves a container docker is still removing for a later pass. The in-memory list of removed containers is removed.
  • fluxappremoved version 2 names several apps. Every node reads version 2 (ip, apps, broadcastedAt) live and in a state sync, and keeps each message whole as one event with its names lowercased (removedNames). A node sends version 2 once minimumFluxOSAllowedVersion is at least appRemovedListFrom (8.25.0): the removals it announces while one is being sent go out together, the removals kept while peers would not accept its messages go out in one, and a node out of service removes its apps at once. Below it, a node sends version 1, one message per app, its out-of-service removals nodeMonitorRemovalDelayMs apart. A removal not sent, because the node cannot sign or record it, is kept and announced on a later cycle, and the others are sent.
  • A report or removal is taken only in exactly its format. A fluxapprunning is type, version 2, apps, ip, broadcastedAt, osUptime and staticIp, every app exactly a name, hash and runningSince; a fluxappremoved is type, version 1 and appName or version 2 and apps, with ip and broadcastedAt. Each field has its format: an app's name (the specification's rule, at most 63 characters), a specification hash (64 hex), a time as toISOString writes it, a node's address. Any other message is refused whole where it arrives, live or in a sync answer, and nothing of it is stored. At boot a node deletes any stored report or removal that is not well formed.
  • A node records what it tells its peers before it sends it. Its own running announcement, install claim and its withdrawal, install error and removal are signed, stored where the app-state sync serves them, then sent; its removal is also applied to its own location table, as a peer applies it, so the node keeps no row of an app it gave up; a broadcast goes to every peer, both directions, at once. A node that links while a peer is announcing an app learns it from the sync answer, and does not install a single-instance app a second time.
  • No container mount recovery at boot. Every Flux container is created with restart policy no and each boot moves any other to it, so a container runs only once the reconciler starts it, after its volume is mounted.

Release notes

  • FluxOS now removes every image on the node that no container uses, at boot, every 720 blocks and after each test run.

Follows v9

  • The per-app registry has v9's shape (utils/operationRegistry.js): app and component scopes, tokens, kept in memory, no node-wide flags. The rules on top are new: waiting, joining, steps, a removal stopping the running operation, and no timed release (a v9 lease expires after a per-type maximum, 30 minutes for most).
  • The reconciler stands aside per app, only while an operation that builds or destroys the app's containers holds it (install, remove, redeploy, rebuild), as v9's construction types do.
  • A component that has run here is kept, down, when its recreate fails: v9's rule, its proof (hasSuccessfullyStarted, firstRunProofMs 60 s) and its event (recreateFailedKept).
  • Docker request deadlines: v9's contract and config keys (dockerProbeTimeoutMs 20 s, dockerStopSlackMs 30 s, dockerRequestTimeoutMs 120 s), in development's own docker code.
  • The image rule is v9's imageReaper.pruneUnusedImages and appUninstaller.reclaimUnusedImages, with operationRegistry.anyHeldOfType; here the uninstaller's removals take its in-progress check too, and the reaper runs at boot, on its block period, after an image update and after a test run. v9's enterprise image cache is not part of it; at the rebase the rule gains its shouldRetainImage.
  • Next: container actions in the registry, as on v9. A container's start, stop and teardown each take a lease on that container (actuating, stopping, removing), so no two overlap on one container, replacing stoppingContainers.

Testing

  • Unit: the full suite at 78f338d7e0, 13,673 passing, 0 failing, 2 pending; eslint clean. Each change is red without it and green with it. Docker deadlines are proven against a docker socket that takes a request and never answers: without the change each of eight request kinds is still waiting after its deadline; with it each fails at its own.
  • Harness, new suites:
    • 4405, one operation holds an app;
    • 4407, an operation meets another: refusals, joins and waits;
    • 4408, a removal stops a restore mid-download or mid-unpack, and an admitted install keeps its room;
    • 2281, a node that links while a peer is announcing an app learns it from the sync; red with the send before the record, at its own assertion;
    • 3507, a test run leaves nothing behind, even when FluxOS dies mid-run;
    • 2282, an install from another route ends the spawner's attempt for the app;
    • 2006, an update the node cannot take leaves the app as it is, through three update passes;
    • 2007, an uninstall leaves the image another app's install is about to use;
    • 2008, the image pass removes a cold image, keeps one a stopped container uses and FluxOS's own, and removes nothing while an install is building;
    • 2009, a container FluxOS took down is not tampering after a restart, nor after a removal docker finishes once FluxOS stopped waiting for it;
    • 2010, a node behind NAT hands back, in its turn, an app whose update asks for a static IP, and the static nodes keep it (red without UNSUITED); a residential node hands back an app whose update asks for a data centre, and the data-centre node keeps it (red without the update's data-centre check); a node behind NAT whose address just moved reads DYNAMIC and hands back a static-IP update (red with the watched change asked first);
    • 222 (new test), on two nodes, a placement announced before it failed leaves no row on any node, the placing node's own included; red without the node recording its own removal;
    • 2283, a node that moved takes no app until it knows where it is;
    • 3501 and 3504, a report or removal not exactly its format is refused whole, live and on sync; 4004, a synced removal carrying fields of its own is refused.
  • Full gate: on tester at 78f338d7e0, on development 396cc107bd: 342 of 342 suites passed.

🤖 Generated with Claude Code

@Cabecinha84 Cabecinha84 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at head f4db86b (1st pass): request changes (small)

Reviewed against current development (396cc10); merge-base is the dev tip, so no rebase needed. The design is sound. Two defects need fixing before this can merge.

Must fix

1. A soft redeploy can delete the app's syncthing folder.
Dev skipped the whole syncthing monitor pass while any install, removal or redeploy ran (node-wide flags). Those flags are gone here. Held apps are skipped for processing and writing, but not exempted from the unused-folder deletion in syncthingMonitor.js (~l.936), which works from installed-app rows only. softRemoveAppLocally deletes the row but not the folder, so until the reinstall writes the row back, a pass that read rows in that gap deletes the folder. The window is seconds, longer if admissions are contended.

  • Probe: held app with a folder and no row, adjustConfigFolders('delete', undefined, id) is called.
  • Impact: the folder's syncthing index, peer devices and promotion/demotion state are lost. Data loss beyond that is unverified.
  • Hard redeploy, install and component redeploy are not affected.
  • Fix: exempt the folders of held apps from nonUsedFolders, with a test (held app, no row, folder kept).

2. A redeploy's requirements check counts the app's own reservation.
softRedeployApp reserves the app's footprint (reserveForRedeploy), tears it down, then calls appInstaller.checkAppRequirements(appSpecs) (advancedWorkflows.js:1670) without { replacing: appSpecs.name }. appsResources() only drops the app's own reservation when excludeApp is passed, so the reservation plus the new requirement counts the app twice.

  • Reproduced with the real admissionControl, operationRegistry and hwRequirements: on a node with room for exactly one copy, the plain check rejects and the replacing check passes.
  • Same defect in appRebuild.js:38 (hard redeploy, the v3→v4 / v8 update paths, soft→hard escalation); all of them reserve first under the same operation.
  • The failure comes after the app is already removed, and goes to the forced, network-broadcast uninstall. The app and its data are lost on any node where the new spec fits only once.
  • Fix: pass { replacing: appSpecs.name } at both sites, with a test on a one-copy node. The other call sites (1875, 2019, 4661, and the install path via admitApp) already pass it.

Should fix / sign-off

  • residentialNodeDosService checks only listByType('install'). A redeploy's reinstall is a parent step, so the lease type stays redeploy; a single-app node can be put into DOS mid-redeploy (dev's installationInProgress covered it). nodeStatusMonitor already unions both types.
  • FluxPeerManager.broadcast drops the 500 ms outbound→inbound gap for every relay, not only the announcements. This is a network-wide behaviour change and needs an explicit sign-off.
  • A test install and a real install of the same app coalesce in submit (both type install).
  • No timed release: a hung holder blocks its app until restart (narrower than dev's node-wide flags). recreateMissing still runs outside a lease (as on dev).
  • docs/syncthing-health-monitor.md still mentions the removed flags.
  • Carried from #1921: the heal-clear race and the r: first-run policy sign-off. #1921 must merge first (this PR is based on its branch).

Verified OK

  • Every operation-nested remove/install/redeploy call passes parent (no self-deadlock); backup and restore release their lease on every exit; an owner start during a restore is now refused (closes the open #1921 item); no uses of the removed flags remain in code.
  • Unit suite on a clean run: 13523 passing, 0 failing, 2 pending. eslint clean on all changed files. CI green.

Conditions for ACK

  1. Both must-fix items, each with a test.
  2. Harness gate at the new head. The body's 334/334 is at 355eb9d36d, which is no longer in the PR (looks like a pre-rebase hash); the body's unit count (13,450) is also stale.
  3. #1921 merged first.
  4. Sign-off on, or a fix for, the residential DOS check and the broadcast gap.

@MorningLightMountain713

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Each item, at head 1c0121cd41 (a fast-forward of f4db86b093, on development 396cc107bd):

Must fix 1: a soft redeploy can delete the app's syncthing folder. Fixed at the cause, in a different shape from the one suggested (2830a1f164). The folder sweep could see a held app's folder without its row because the soft redeploy deleted the row: it was a removal and an install glued together. A soft redeploy now replaces the app in place: check the new spec with the app's own share left out, tear down the containers, write the new spec into the app's row, create the containers. The row never stops describing the app, so there is no window in which a pass reads rows without it, and exempting held folders from the sweep is not needed. A failure after the teardown removes nothing and hands the app to the reconciler. Unit tests hold the row in a stub that forgets a deleted row, and check the row is kept, with the new specification written into it between the old containers and the new; the old path is red at that assertion. Two follow-ons in the same area: no failed redeploy or update removes an app that has run on the node — such a component is kept, down, and retried on the restart ladder; one that never ran is a failed install and is removed (f62bee7b73) — and a component that fails to install removes nothing from its app (2e35d86bde).

Must fix 2: a redeploy counts the app twice. Fixed on both paths. The soft redeploy checks with { replacing } (2830a1f164). The hard redeploy (appRebuild) is checked with { replacing } before its teardown (4c37703181): not admitted, the app is left as it is. An app whose registered spec no longer fits the node at all is handed back by the give-up pass (OUTGROWN), one holder at a time, so the copies that cannot take the update leave in turn rather than all in the block that announced it. Unit tests check both checks leave the app's own share out, that a hard redeploy not admitted leaves the app as it was and tells the network nothing, and the OUTGROWN turn rules.

Residential DOS mid-redeploy. Fixed (4820927f10): operationRegistry.listArriving() names every app an install or redeploy is bringing onto the node, and both the residential check and nodeStatusMonitor use it.

The broadcast gap: sign-off. Signed off: it stays removed. Since 8.24.0 a node announces a message and each peer fetches it from one announcer (4c6620c3b4), and a relay skips the peers that announced it (d2d84c68d5); on a 40-node mesh copies per message fell from 258 to the minimum of 39. The 500 ms gap saves nothing under that.

A test install and a real install coalesce. A test install is no longer an install. /apps/testappinstall is a test run (29b739f910, 323f975ac2, 383b1dfc09): it runs the app's containers at their declared resources for testRunWatchMs, reports each running or exited, and removes everything. It takes no operation slot, writes no row, binds no host ports and makes no syncthing folder, so it meets no install. A boot sweep removes whatever a run left before the next one starts. Harness suite 3507 covers a run, and a run FluxOS dies in the middle of.

No timed release. Kept by design: a hold lasts exactly as long as its operation. A timed release would let the hung operation carry on beside the next one, the overlap the manager exists to prevent. A hang is now contained where it starts: every short docker request carries a deadline (ed5567648b; reads 20 s, a stop its own SIGKILL wait plus 30 s, everything else 120 s), so a call docker never answers fails, and the operation fails and releases the app. And a removal no one watches no longer waits behind another operation: it answers PENDING, stays sent, and runs once the app is free (a7dd22f669), so no pass that removes apps in turn waits on one busy app.

recreateMissing outside a lease. Fixed (47fd826787): the reconciler's rebuild of a container — a missing one, or one with a stale network endpoint, removed and recreated — is an operation on the app, taken now or refused. Refused, the component is passed again once the app is free; while it runs nothing else runs on the app; a removal stops it at its next step; the removal of an app that never ran here, after a failed recreate, is a step of it.

docs/syncthing-health-monitor.md. Fixed (f17dbf6f55).

Carried from #1921. Both on this PR: the heal is an operation on the app (8d0e24386e), and the r: decision is by the folder alone (224808e788); details in the #1921 reply.

Also on this PR. The give-up pass's hand-back is an operation on the app, so the copy it proved is the copy it removes, at the turn it decided on (eae75c2622). fluxappremoved version 2 names several apps: every node reads it now (621a04495e), and a node sends it once minimumFluxOSAllowedVersion reaches 8.25.0 (fd8dc46f77); below that nothing changes. A pass that removes several apps sends their removals together (c2686bb5ef). The spawner stops for a move of the node's address and for lost readiness, and decides again after (5573e7edfd): an attempt decided at the old address could install at the new one — the full gate at 40176a8143 caught a static-IP app placed back on a node that had just moved — so a move now stops the spawner while it handles the node's apps and reads its new geolocation, a stopped attempt withdraws its claim, and an install already under way is waited for only until the node records the app, which the move then handles with the node's other apps, after the install (de5761c5aa). Boot container mount recovery is gone: every Flux container is created with restart policy no and each boot moves any other to it, so none can start before its volume is mounted (40176a8143).

Conditions. Both must-fixes have tests. Unit suite at this head: 13,585 passing, 0 failing, 2 pending; the body is updated. #1921 merges first.

Gate. The full gate at 5573e7edfd passed 334 of 335. Its one red, 2263, was a move waiting for an install to finish: the spawner's stop waited out the whole install, so the node's move handling did too. Fixed in de5761c5aa (above); its unit tests are red without it, and 2263, 2277 and 18 move and readiness suites pass with it. The full gate at this head is running on tester; its result goes in this PR's Testing section.

@Cabecinha84 Cabecinha84 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at head f3e9567715 (2nd pass)

Verdict: request changes (small). Both of my earlier must-fixes are fixed. Two new findings are traced end to end, and the test run needs confinement. #1921 must merge first.

Basis. The head sits directly on current development (396cc107b, merge-base == tip), so the tree is the merged result. On a clean worktree: unit 13592 passing / 0 failing / 2 pending, eslint clean on all 116 changed JS files, CI green. The 336/336 harness gate at this head is the author's claim; I have not re-run it.

Earlier must-fixes: fixed

  • Held app's syncthing folder deleted mid-redeploy: fixed at the cause. The soft redeploy keeps the row, and I found no path left (soft, hard, component, composed update) that leaves a held app with a folder but no row.
  • Redeploy counting the app twice: { replacing } is now passed on the soft path, in appRebuild and at the other call sites.
  • Residential DOS mid-redeploy: fixed via listArriving().

Must change before ACK

1. A failed composed-app update repeats its teardown on every pass (advancedWorkflows.js ~l.4383-4426).
The loop tears components down first, including hardUninstallComponent, which deletes data for components whose hdd changed. Only then does checkAppRequirements({ replacing }) run. If it throws, the row still holds the old spec (the catch comment "the row holds the new specification" is wrong), the app is handed to the reconciler at the old spec, and the hash still mismatches. On development this failure removed the app; now reinstallOldApplications re-runs the teardown every pass.
Fix: run the check before the teardown loop, as softRedeployApp and rebuildApp already do, and correct the comment.

2. A slow docker daemon can get an app uninstalled by the reconciler (appReconciler.js:566).
After a failed recreate, getDockerContainerOnly(identifier).catch(() => undefined) reads a timed-out list (new 20 s deadline) as "container absent". That records recreation_failed and, for a component that never ran, calls removeAppLocally. Before this PR a stuck docker call hung forever, so this branch was unreachable; the new deadlines make it reachable.
Fix: treat AbortError like the database-error case (retry, do not remove).

3. The test run is unconfined, and its cleanup can delete an image a real install needs (appTestRun.js).

  • Test containers have no CgroupParent (outside flux.slice), no disk limit (plain directories, no StorageOpt), and no admission reservation, so real installs can be admitted on top of a test run.
  • The cleanup removes images the run pulled. A real install of the same app that is still in volume creation (no container yet) can lose its image; the old operationHolding guard is gone.
  • A non-404 image-removal error aborts the sweep, and a half-written pulled.json (written in place) throws a SyntaxError out of readPulled; in both cases every later sweep and test run fails until someone intervenes.

Should-fix (non-blocking)

  • A docker remove that times out is never recorded in fluxRemovedContainers; if docker finishes it late, the reconciler logs container_vanished.
  • A v1 fluxappremoved carrying an extra apps:"x" field breaks the registryManager.js:597 aggregation (reproduced the $in error on local mongo), scoped to that signer's address.
  • fluxappremoved v2: no byte cap or name validation, and the sender does not split lists over maxAppsPerNode (200). One failed send also fails a whole v1 batch.
  • A failed geolocation lookup after an IP move is still recorded as geolocated (fluxNetworkHelper.js ~l.2294, pre-existing, but the spawner restart now relies on it).

Maintainer sign-offs (policy, not bugs)

  • A bad new spec leaves the app kept down indefinitely (retry ladder capped at 30 min), still announced to the network and holding resources.
  • The Orbit health check is dropped from test runs, and /apps/testappinstall now returns different text and takes at least 60 s. External consumers (UI, FluxCloud, Deploy with Git) are not verified.
  • Restart policy no has a first-boot window on nodes that never booted 8.13+; rare.
  • No timed release (kept by design); the broadcast-gap removal is already signed off by the author.
  • fluxappremoved v2: readers ship in 8.24.0 and sending is gated at 8.25.0, so the gate is safe; the comment calling 8.25.0 the first reader is wrong.

Checked and fine

No caller of a removal without a response stream assumes the app is gone after PENDING; no unhandled-rejection path; no submitted operation can fail to settle; spawnerControl has a start for every stop and releases its lock on every install exit; the boot sweep cannot match a real container, network or directory; docker 404 error shapes are preserved; no references to the deleted containerMountRecovery remain.

With items 1-3 fixed I would ACK, subject to the sign-offs above, #1921 merging first, and a full gate re-run at the final head.

@MorningLightMountain713

Copy link
Copy Markdown
Collaborator Author

Thanks for the second pass. Each item:

Must 1: a failed composed update repeating its teardown. Fixed (d1c310d351): the update pass checks the node can take the new specification before any component comes down, and one it cannot take leaves the app running as it is, its data and row untouched; the decline is published (app:updateDeclined). The same order holds for an owner's soft and hard redeploy of one component. The catch's comment is corrected. Unit tests are red with the check after the teardown; harness 2006 sizes a node an update cannot fit and asserts the app keeps its container, a file in its volume and its row through three update passes, each declining (red before the fix at "the component was torn down").

Must 2: a slow docker daemon and the reconciler's removal. No change. The branch is reached only for a component that has never run here (a fresh install whose container vanished before its first 60 s), so no data of the owner's is at stake, and its removal lets the network place it on a node that can run it. recreation_failed weighs zero in the tampering score, and container_vanished is recorded before the recreate from a list docker answered.

Must 3: the test run. Reworked, as the interim it is until v9's playground replaces it, the Orbit check included:

  • each container runs at a fixed 0.2 CPU and 300 MB, as on development, under flux.slice; nothing is refused over the app's declared size;
  • a container is judged as soon as it starts and everything is removed at once: an exited container fails with its exit code and last log lines; a runonflux/orbit (Deploy with Git) container gets development's build check (its /api/status, every 5 s, up to 2 minutes), reached at its address on the run's network; every other container passes on starting; the passing line is development's;
  • images: one rule decides when any image leaves the node (imageReaper, 64324fdf49): only when no container references it, it is not FluxOS's own file-operation image, and no install, redeploy, rebuild or test run is in progress, the last check and the removal in one synchronous step. Every removal goes through it (the uninstaller's four sites, and a pass at boot, every imageReapPeriod blocks, after an image update and after each test run); a tagged image is removed by its tags; the install-time dangling prune is removed. The test run neither removes nor records the images it pulled, so its sweep removes only its own containers, networks and directories, and has no record to misread and no image removal to be refused.

Harness: 3507 (held at a new testrun:beforeRemoval checkpoint: each container's limits and cgroup, and a run killed mid-way cleared by the next start; red with declared resources), 3503, 2007 (an uninstall leaves the image another app's held install is about to use; red before at "removed the image app B was about to use"), 2008 (the pass removes a cold image, keeps one a stopped container uses and FluxOS's own image, and removes nothing while an install is building; each pass driven block by block to the one it falls due on; red with the in-progress check removed at "the cold image went while an install was building", and with FluxOS's own image unprotected at "FluxOS's own image was removed").

Should 1: a removal that times out is not recorded as FluxOS's. Fixed (a78581623a). The record of FluxOS's own removals was written once docker confirmed the removal and was kept in memory, so a removal docker finished after FluxOS stopped waiting, and a FluxOS restart between a removal and the create after it, each left FluxOS's own absence unrecorded. Every removal of an app container is recorded in the component's runtime state (removedByFluxOs) before docker is asked, and not sent when it cannot be recorded; the record is cleared by the create, by the reconciler seeing the container in place, or with the app. The reconciler defers when it cannot read it, and leaves a container docker is still removing for a later pass. Unit tests are red without; harness 2009 holds a soft redeploy after its container is removed and restarts FluxOS there, and freezes docker's data root at a new container:beforeRemove checkpoint so docker finishes the removal after FluxOS gave up on it: red at container_vanished before the fix (restart), without the record (both), and without the deferral of a container docker is removing (late removal).

Should 2: a v1 fluxappremoved carrying apps breaks the aggregation. Confirmed as you describe: the view's one caller is the shutdown handler, scoped to the sender, so the sender's own shutdown goes unhandled; the harness reproduces $in requires an array as a second argument, found: string. Fixed where the message arrives (6d9805eefe, 06740770e9): a report or removal is taken only when it is exactly its version's message, every field of its type and no other, and in a report every app exactly a name, a hash and a running time; any other is refused whole, live or in a sync answer, and at boot a node deletes any stored report or removal that is not well formed. A survey of three production 8.24.0 nodes (about 3,800 stored messages each) found every message already in exactly this form, and 8.22.0 through 8.24.0 send exactly it. Reports are judged whole: since 8.22 a sender leaves out an app it cannot announce, and 8.22.0 is the network's minimum. Unit tests are red without; harness 3501 (a report naming one malformed app stores none of it; the sender's shutdown is handled after a v1 removal carrying apps, red before at that error) and 3504 (the same on sync).

Should 3: fluxappremoved v2 size, names and sends. Fixed (89b23cdd48). Every app a report or removal names has an app's name (the specification's rule, at most 63 characters), a report's app a 64-hex hash and a running time as toISOString writes it, and either message comes from a node's address, so every field is bounded and no byte cap of its own is needed; every current and historical app name, 81,828 permanent message hashes, and every stored report and removal on the surveyed nodes fit. The spawner counts the apps a node holds, running or not, against maxAppsPerNode, so a node never holds more and a removal never names more. A removal not sent, because the send fails or the node cannot sign, is kept and announced on a later cycle, and the others are sent. Unit tests are red without; harness 3501 (a removal naming an app by a name no app may have is refused and a correct one after it taken; red before) and 4004 (a synced removal carrying fields of its own is refused; red before).

Should 4: a failed geolocation lookup after an IP move recorded as geolocated. Fixed (192697a0f1): a move is taken as located only when the geolocation held is for its new IP, and is not settled until it is. The spawner is stopped while a move has apps or a geolocation to handle, between the move's passes as well as during them, and starts again once both are handled. Unit tests are red without; harness 2283 makes the new IP one neither geolocation service can locate: the move is not taken as located, the spawner runs no pass across a gap between the move's passes, and runs again once a service answers (red with the check removed, and with the spawner let go after each pass); the move suites 2222, 2224, 2229, 2237 and 2282 pass.

Sign-offs.

  • appRemovedListFrom 8.25.0: the comment is right. 8.24.0 is already released (master); development's version is bumped at release, so these readers ship in 8.25.0, the first release that reads v2.
  • /apps/testappinstall's 60 s and text, and the dropped Orbit check: resolved by the rework above (development's resources, judgement and wording; the Orbit check is back).
  • A bad new spec leaving the app kept down: signed off, by design, as on v9. No failed update or redeploy removes an app: the owner's data is kept, and the next spec that runs brings the app back. A spec the node cannot hold is declined before anything is torn down (must 1).
  • Restart policy no first-boot window: does not arise. The policy and the boot migration of existing containers shipped in 8.13.0, and the network admits nothing below 8.22.0, so every node has booted 8.13+ and migrated.
  • No timed release: kept by design, as answered in the previous reply; the broadcast-gap removal stands as agreed there.

Gate. Full gate on tester at aa6bd4cb42, on development 396cc107bd: 341 of 341 suites passed. The head ebd35671b1 adds one unit-test-only commit; the full unit suite there is 13,649 passing, 0 failing, and CI passes.

@Cabecinha84 Cabecinha84 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review, 3rd pass, at head ebd35671b

Verdict: code ACK, with the conditions below. My earlier requested changes are resolved except for one new gap (1).

Checked on the merged tree (merge-base is the current development tip 396cc107b):

  • Unit suite: 13,649 passing, 0 failing, 2 pending. eslint exits 0 on all 123 changed .js files. CI is green.
  • The harness gate (341/341 at aa6bd4cb4) is the author's run. I did not re-run it.

Resolved since my last pass

  • An update is now checked before any component comes down, in the update pass and in the owner's soft and hard redeploy of one component. A declined update publishes app:updateDeclined.
  • Test run: 0.2 CPU and 300 MB under flux.slice, the Orbit build check is back, and its sweep touches only its own containers, networks and directories.
  • Image reaper: the "nothing is building" check and the removal are one synchronous step, and installs, redeploys and rebuilds all hold their app, so I found no race. FluxOS's own file-operation image is kept.
  • removedByFluxOs is recorded durably before docker is asked. The network-heal removal has its own flag and is routed before recreateMissing. The other direct docker-remove callers are file-operation containers and test runs.
  • Strict fluxapprunning and fluxappremoved shapes: I diffed the senders at v8.22.0, v8.23.1 and v8.24.0, and they send exactly those fields. The maxAppsPerNode cap already existed. The boot cleanup touches only those two event types.
  • Geolocation after an IP move: a move is settled only once the geolocation held is for the new IP.

Conditions

  1. A declined update for a static-IP requirement leaves the app running its old spec forever.
    • When checkAppRequirements throws in the composed update path, reinstallOldApplication now returns early. The give-up pass only hands back for hardware (OUTGROWN) and geolocation (MISPLACED).
    • So an update that turns on staticip, on a node that can't meet it, leaves the app running the old spec and announced with the old hash. It declines again every pass, and nothing subscribes to app:updateDeclined. development removed the app in this case.
    • The nodes-pin case is fine, because mayTearDownToRebuild removes the app first.
    • Please either make the give-up pass treat this like OUTGROWN, or state in the PR that these apps stay by design.
  2. Merge #1921 first. It is still the base and is open.
  3. Run the harness gate at the final head. It is one test-only commit behind the author's run.

Non-blocking

  • appReconciler.recreateMissing: getDockerContainerOnly().catch(() => undefined) still reads a timed-out docker list as "container absent". It only matters for a component that never ran. Treating AbortError like a database error would be a one-line fix.
  • recreateMissing removes the whole app when a never-started component fails to recreate, including siblings that have run and hold data. development does the same, so this PR makes it less likely. Checking the siblings' hasSuccessfullyStarted first would close it, and it sits awkwardly with "no failed update removes an app that has run here".
  • pruneUnusedImages now removes every unreferenced tagged image on the host, not just dangling ones. It runs at boot, every 720 blocks and after each test run. That is operator-visible, so it belongs in the release notes.
  • located?.ip === ip needs the node's egress IP to equal its advertised IP. If they differ, the move never settles and the spawner stays stopped.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 93.55401% with 74 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (fix/backup-restore-run-authority@577ab69). Learn more about missing BASE report.

Files with missing lines Patch % Lines
ZelBack/src/services/dockerService.js 79.83% 24 Missing ⚠️
...elBack/src/services/appLifecycle/appUninstaller.js 91.07% 10 Missing ⚠️
...elBack/src/services/appMonitoring/appReconciler.js 92.70% 7 Missing ⚠️
ZelBack/src/services/appLifecycle/appInstaller.js 92.30% 6 Missing ⚠️
ZelBack/src/services/appLifecycle/appSpawner.js 92.00% 4 Missing ⚠️
ZelBack/src/services/appLifecycle/appTestRun.js 97.35% 4 Missing ⚠️
ZelBack/src/services/serviceManager.js 42.85% 4 Missing ⚠️
ZelBack/src/services/appLifecycle/imageReaper.js 96.05% 3 Missing ⚠️
...ack/src/services/appManagement/appsRuntimeState.js 81.25% 3 Missing ⚠️
ZelBack/src/services/appManagement/appInspector.js 75.00% 2 Missing ⚠️
... and 5 more
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@                         Coverage Diff                         @@
##             fix/backup-restore-run-authority    #1922   +/-   ##
===================================================================
  Coverage                                    ?   86.29%           
===================================================================
  Files                                       ?      291           
  Lines                                       ?    42626           
  Branches                                    ?        0           
===================================================================
  Hits                                        ?    36782           
  Misses                                      ?     5843           
  Partials                                    ?        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MorningLightMountain713

MorningLightMountain713 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for the third pass. Each item:

Condition 1: an update asking for a static IP leaves the app on its old specification. Fixed (9fec975a4d, 11563c2eee): the give-up pass hands such an app back as UNSUITED, in turn, by the rule MISPLACED and OUTGROWN leave by. It is judged, as OUTGROWN is, only while the registered specification differs from the one the node runs, and only on a definite answer (hwRequirements.nodeKindShortfall): a specification asking for a static IP on a node that sees it is behind NAT, or for a data centre on a node the published location table classes as residential. A static IP state the node cannot decide, and a classification the table does not give or is torn on, keep the app. The give-up reasons are one frozen enum, GiveUpReason. Unit tests are red with the pass ignoring the verdict and with an undecided static IP handing back; harness 2010 boots one of three holders behind NAT (network shape private-egress), turns on staticip in an update, and asserts that node gives the app up as UNSUITED in its turn while the two static nodes judge the update and keep it; red before the fix at "the node behind NAT gives the app up as UNSUITED, in its turn".

A legacy app's heal lease key (from #1921's fifth pass). Fixed (25aecd16e5): healHeldFolder holds a v1-3 folder (flux<app>) under the app's name, dockerService.getBaseAppName, the key restore and backup take, so a heal and a restore or backup of one legacy app exclude each other. A unit test holds a v1-3 heal mid-decision and asserts a restore of the app is refused; red with the old key.

recreateMissing reading a docker list that did not answer as absent. No change. A docker that does not answer is a node that cannot run apps, and the one thing the branch can remove is an app none of whose components has run here, which the network places on a node that can.

recreateMissing removing an app whose other component has run here. Fixed (10ac777436): a failed recreate removes the app only when no component of it has run here; otherwise the app is kept, the component down and its recreate retried on the ladder, and an installed specification that cannot be read removes nothing. Unit tests are red with the component's own record alone deciding.

pruneUnusedImages removing every unreferenced tagged image. In the PR body's release notes.

located?.ip === ip and a node whose egress differs from its advertised address. No change: the lookup names the advertised address (ipApiBaseUrl/json/<advertised ip>, geolocationService.js) and the service answers for the address it is asked about, so both sides of the comparison are the advertised IP whatever the node's egress.

Since your pass: what the gate found. The full gate at 10ac777436 passed 339 of 342 suites. One red was in the product: a node that gave up an app it had already announced kept its own location row of it. Every peer deletes that row when the removal reaches it, but the node applied its own removal only if the message happened to come back to it through a peer, which depends on how the nodes are linked. Fixed (605e8974b3): the node records its removal as a peer does, in its event log and its own location table, then sends it; one it cannot sign or record is kept, as before. Unit tests are red with the two records left out, and a new test in 222 holds the placing node, on two nodes so its removal never comes back to it, until it has announced the app, then fails the install: red before the fix at "the placing node kept its own row of the app it gave up". The other two reds were the harness's: 2009 froze docker's whole data root, which could hold FluxOS's lookup of the container before docker had the removal at all, and its canary read a docker ps that answered nothing as the container being gone (c78ae6d9ff, b72d89c41b: only the filesystem holding docker's container directories is frozen, so docker takes the removal and finishes it once thawed, and the canary reads the container's directory), and 3006 cleared the router before FluxOS was down, so the old process's last mapping counted for the next test (7dd83d8136, FluxOS is now held down first). The fix moves when a removing node stops holding the app itself, to the removal's announcement before the teardown, and 2261 asserted the old timing: it required the spawner to have passed over the app zero times before the removal was held. It now asserts the decision (969d12a432): once the removal is held the spawner passes over the app at its departing filter, no pass from the removal's start to its release finds it a candidate, and the node takes the app again once the removal has finished; red with the departing filter removed.

Gate. Full gate on tester at 969d12a432, on development 396cc107bd: running; I will add the result here when it finishes.

@Cabecinha84 Cabecinha84 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK (code) at head 7dd83d813, conditional on the items below.

Checked against current development (396cc107b is the merge-base, so the PR tree is the merged result; MERGEABLE/CLEAN, CI green). Unit suite on that tree: 13668 passing / 0 failing / 2 pending, eslint clean on the changed files. I also ran 16 mutations against the delta since my last pass; the new tests catch all but the two noted below.

Prior items, verified fixed in code

  • Static-IP / data-centre update no longer leaves the app on its old spec on a definite answer: UNSUITED hand-back via nodeKindShortfall (fires only on DYNAMIC / RESIDENTIAL).
  • Legacy v1-3 heal lease key now uses getBaseAppName, the key restore and backup take.
  • recreateMissing removes an app only when no component has run here; runtime state is cleared on removal, so a failed fresh install is still removed; an unreadable spec retries.
  • sendRemoval records the node's own removal (event log + own location row) before sending; DB errors propagate, so an unrecordable removal is kept as before.

Conditions before merge

  1. Merge #1921 first (still open as base at 577ab690e); they have to ship in the same release.
  2. Post the full gate at 7dd83d813. The last full run was 339/342 at 10ac77743, and 605e8974b (production code) came after it.

Sign-offs / non-blocking

  • A static-IP state that stays UNKNOWN (a NAT node whose address rotates more often than every 10 days, or an unreadable egress interface) still declines a static-IP update and never hands the app back. Narrower than before, and dev removed the app, but not fully closed.
  • No update-time datacenter check exists (appInstaller.checkAppRequirements never calls it), and the give-up pass reads the published table while installs use the node's own reading, so the outcome there depends on timing.
  • sendRemoval deletes the node's own row before sendToAll: if a v2 batch fails midway, keepRemoval finds no row and keeps nothing. Not reachable through the send step today.
  • Test gap: removing UNSUITED from HANDED_BACK or from stillLeaving is not caught (the OUTGROWN equivalents survive too, so this predates the PR).
  • Still open from earlier passes: the docker lookup timeout in recreateMissing read as "absent" (declined), unconditional releaseHold, and the pruneUnusedImages host-wide behaviour (operator-visible, in the release notes).

Base automatically changed from fix/backup-restore-run-authority to development November 25, 2026 19:47
…restore, a redeploy waits for it

A backup and a restore of an app claimed separate lists, and nothing on the
removal or redeploy paths read the backup's: an app could be removed,
redeployed or restored while its backup ran, and a backup deletes the previous
archive before it writes the next.

operationRegistry holds one lease per app for a backup, a restore, a removal or
a redeploy (v9's shape, without a timed release). A backup or restore is refused
while anything holds the app. A removal asks a backup or restore holding it to
stop, and waits for its release: the job stops at its next step (the archive,
unpack and download take its signal), lifts its hold and releases the app. A
redeploy waits for a backup or restore to end. No caller of a removal or
redeploy is refused, so none loses one. globalState's backup and restore lists
are views of the registry.

The removal publishes app:operationPreempted and the redeploy's wait
app:operationWaiting; a backup holds at backup:beforeArchive.

Tests: unit tests for the registry and each rule, each red under its mutation
(removal without the stop request, removal without the wait, redeploy without
the wait, backup without its step check, the claim not exclusive).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A restore asked for during a backup is refused and the backup finishes whole; a
redeploy asked for during a backup runs once it has finished; a removal stops a
backup, and stops a restore before it clears the data.

Mutations (tester), each red at its own case: the claim not exclusive at the
refused restore; the redeploy not waiting at the waiting redeploy; the removal
not asking the job to stop at both removal cases; the restore not stopping
before its clear at the restore case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re they check them

Each rebuild test built the record's five indexes, most of its time and
the part that slows with load, and only one test reads them. The tests
of what the record holds run without the build; "carries the record's
indexes" keeps it, and is red with the build removed from rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The growth is made in the Content-Length header call, so it always lands
after the length is measured; appended concurrently, it could land
before, and the test then measured nothing. Red with the send not capped
at the declared length.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ase that does not wait

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
operationRegistry.run(app, type, fn, { parent }) takes the app for an
install, removal, redeploy, backup, restore or owner action, runs it and
releases the app when it settles, on every exit. When another operation
holds the app, the arriving one's rule decides: a removal stops the
holder at its next step and runs once it is released; a second removal,
pending or running, gets the first's outcome; a backup, restore or owner
action is refused; a redeploy or install runs once the holder is
released, and is refused while a removal is pending or running. A step
of an operation runs under it, named as its parent. Nothing is released
on a timer.

Tests: a unit test per rule; each rule broken alone is red at its own
tests (no preempt, no join, no refusal while a removal is pending, no
re-check after a wait, owner actions waiting, a step under any parent,
a step ignoring its parent's stop, no release on a throw, a check
separated from the take). Unit suite 13,494 passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
operationRegistry.submit(app, type, fn, { parent }) sends an operation to
the app's manager, which runs them one at a time. A redeploy or install
the app cannot take now waits in the app's manager, not in its caller,
and a later one of the same type replaces it, every caller getting the
outcome of the one that ran; so a caller looping over apps sends and
moves on. A removal refuses what is waiting and runs next. A backup,
restore or owner action is taken now or refused. Releasing a lease
starts the app's next operation.

Tests: each rule broken alone is red at its own tests (no preempt, no
join, no refusal while a removal is pending, a removal keeping what
waits, no coalescing, owner actions waiting, a release starting nothing,
a step under any parent, a step ignoring its parent's stop, no release
on a throw, the take after an await).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without it each of these tests threw on the first line of the removal and
passed on the error it wrote to the response, so a test named for removing
an app removed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A removal is sent to its app's manager: it stops the app's running
operation at its next step, refuses what waits, and runs next. Two
removals of one target run once, the second answered with the first's
outcome and telling the network itself when the first did not; a
removal of the whole app waits for a removal of one component, never
joining it. `force` skips the node's guards and never the app's manager.

A redeploy runs through the manager as well, and its removal and install
steps (rebuildApp, the install cores and their cleanup removals,
mayTearDownToRebuild) run under it as its parent. A redeploy the app
cannot take waits in the manager; a caller going through apps in turn -
the reinstall pass, the image update check, the storage inspector,
volume validation - sends it with wait: false, so a busy app is refused
and left for that caller's next round instead of holding the apps after
it. The reinstall pass runs each app's update as that app's redeploy.

Tests: unit tests for each wiring rule, each red under its mutation (no
join, a joiner never or always telling the network, the pass waiting,
the pass's rebuild and removal not steps, a redeploy ignoring wait, the
image update check, inspector and volume validation waiting); the
registry's target and wait rules each red alone. Unit suite 13,509
passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…step

Its install's cleanup removal ran as a removal of its own, which stops the
redeploy holding the app and waits for it while the redeploy waits for
the install. The install is a step of the redeploy, named as its parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ps one mid-pull

registerAppLocally sends the install to the app's manager: it runs now
when the app is free, or once the operation holding it ends; refused
there it is BUSY, touching nothing. The spawner sends with wait: false,
so an app another operation holds never stalls it.

An install stops when its operation is stopped: before its pull, its
volume, its container and its start, and the pull itself, whose
transfer a caller's signal now aborts as a stall does. An install a
removal stopped tells no installing error and removes nothing - the
removal that stopped it takes the app down and tells the network. The
reinstall pass's direct installs take its redeploy's signal.

Tests: each rule red under its mutation (the pull ignoring a signal or
one already aborted, no check before the pull, a stopped install
telling an error or cleaning up, in both install cores, the install
bypassing the manager, the spawner waiting, the pass's install without
its signal). Unit suite 13,518 passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ation holds the app

An owner action is an action taken now: it runs as an operation of the
app's manager and is refused while an install, removal, redeploy, backup
or restore holds the app, never queued as intent for afterwards. A start
during a restore no longer clears the record of a component the restore
is still replacing; the owner starts it once the restore has ended.

The run-state and target doc comments sit on the functions they
describe.

Tests: each action - start, stop, restart, kill, restart of what runs -
refused while a restore holds the app, writing no lock and clearing no
record; red with the actions outside the manager, and red alone with
only the restart of what runs outside it. Unit suite 13,524 passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ses a removal naming no app's name

3501: a removal naming an app by a name no app may have is refused, and a correct
one after it is taken. state-events.specHashOf gives each fixture app a
specification hash of 64 hex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A removal is exactly its version's fields: one carrying fields that read as
expressions is refused whole, and a well-formed one is stored as signed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A move's geolocation is taken as found only when what the geolocation service
holds is for the move's new IP: the lookup reports no failure of its own, so a
failed one leaves the node holding its old address's geolocation. Until it is
found the move is not settled, and a later pass asks again.

The spawner is stopped while a move has apps or a geolocation to handle, between
the move's passes as well as during them (spawnerControl.setMoveDue), and starts
again once both are handled. setMoveDue replaces duringMove.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ere it is

Neither geolocation service can locate the node's new IP (the external stub's
geolocation can be staged unavailable): the move is not taken as located, the
spawner runs no pass across a whole gap between the move's passes, and runs again
once a service answers and the node is located.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A test run is its own unit (appTestRun.test.js). An installer test that reached
the real one ran its commands on the machine running the tests: it made the test
run's directory as root beside the apps folder, which left the folder above it
root's and failed the tests that create the apps folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A v1-3 app's folder id is its docker name (flux<app>), so the heal's lease was
taken under a name no backup or restore uses, and the two did not exclude each
other.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d back

An update that asks for a static IP or a data centre this node is not was
declined on every pass and the app kept its old specification here for good.
The give-up pass hands it back in turn as UNSUITED, on a definite answer only:
a node behind NAT, or one the published table classes as residential.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for a static IP

Solo on tester: 2/2 green. Before-state (product at 9fec975): red at "the
node behind NAT gives the app up as UNSUITED, in its turn" (condition not
reached in 179 blocks); the static nodes' test stays green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it has run here

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng it

A peer records a fluxappremoved in its event log and deletes the sender's
location row of the app. The sender now does both to itself, between signing
and sending: its own row no longer outlives the removal, and a peer that links
to it later is given the removal with the announcement it cancels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n any node

On a two-node fleet, so the placing node is never sent its own removal back,
the placing node is held with the app's record and no containers until it has
announced the app. Once the install fails, the peer and the placing node itself
hold no row of it, read once as the peer publishes the removal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y, not dockerd

Listing a container reads its image from the frozen data root, so a docker ps
held by the freeze answered nothing and read as the container gone. The
container's directory under the data root is read from the filesystem, which
the freeze does not hold, and a read that fails fails the canary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…S is down

3006 cleared the router's table and took its start time before killing FluxOS,
so a mapping the old process sent in its last moments counted as the new one's
boot mapping. FluxOS is now killed and held down, the table cleared, and FluxOS
released. The UPnP stub logs each request it answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s directory

2009 froze docker's whole data root before FluxOS sent the removal, so the
removal's lookup could hang on the image store and FluxOS gave up before docker
had the removal at all. A node booted with freezableContainerRoot keeps docker's
container directories on a filesystem of their own: frozen, the lookup answers,
docker takes the removal and holds it at its first write of the container's
state, and a removal docker has taken finishes once thawed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… filter

2261 counted every spawner pass over the app from zero and required none before
the removal was held, which held only while the node kept its own location row
of the app until it expired. The node deletes that row when it announces the
removal, before its teardown. The suite now counts the passes the departing
filter makes once the removal is held, and asserts no pass found the app a
candidate from the removal's start to its release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ress moved

A node with no public address on an interface is never static, however long
its address is held, but a watched change was asked first and labelled it
UNKNOWN for ten days after every move. A NAT node whose address changes more
often than that was never DYNAMIC, so an update asking for a static IP was
declined on every pass and never handed back as UNSUITED. NAT is asked first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the give-up pass reads

An update's requirements never read datacenter, so an update turning it on was
applied on a node the published table classes residential, and the give-up
pass, which judges only an update not applied, never handed the app back. The
update's requirements now read dataCenterShortfall, the rule the give-up pass
reads: the update is not applied where the table classes the node residential,
and the app is handed back as UNSUITED in its turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… for a data centre

On the residential fleet, whose published table classes two nodes residential
and one hosting, an update turning on datacenter is handed back as UNSUITED by
a residential node in its turn, and the hosting node takes the update and
keeps the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a static-IP update

The node behind NAT moves while down and starts at its new address, records
watching it change, and reads its static IP as DYNAMIC inside the window the
move opened; an update asking for a static IP is then handed back as UNSUITED
in its turn. waitForOwnGeolocation waits for a node's own geolocation record
at an address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… first and stays down

The stand-down tests ran for EVACUATION only, so dropping OUTGROWN or UNSUITED
from the handed-back reasons, or from what keeps a node leaving, went
uncaught. For each, a primary of a g: app stops its component instead of being
removed, keeps it stopped while the reason holds, and stands for election
again once it does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The syncthing state a failure dumps carries the daemon's running totals of
time spent in its database, its filesystem calls and its pulls, from its
metrics endpoint, so a slow sync shows where its time went.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s time series

run-parallel records the box's disks' extended statistics every 5 s, flushes
included, as cap-io.log beside the other captures, ended with the driver. A node
running its own syncthing records the daemon's time totals every 15 s through a
unit that lives with its container, and a failed suite's dump carries the series
as node-NN-syncthing-metrics.log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is built

A peer the admission quorum asks refuses an app message while its registry is
unbuilt, so suite 08's first registration, sent seconds after boot, was refused
by a peer that was still building. The orchestrator's harness snapshot reports
dbReady; bootAndPeer, once blocks flow, waits for it on every node not running a
release image, and suite 08, which boots by hand, waits for it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…old the registration

The holder's bulk catch-up was meant to bring it Bob's registration, but its hash
sync could run between the block paying it and its peers storing it: the bulk
fetch then lacked it, and the holder asked for it alone, where its door refuses
it. A hash sync now passes hashSync:beforeSelect before choosing what to fetch;
2106 holds the holder there while Bob's registration is paid and stored by every
other node, then puts the holder behind and releases it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MorningLightMountain713
MorningLightMountain713 merged commit 218f72d into development Nov 25, 2026
3 checks passed
@MorningLightMountain713

Copy link
Copy Markdown
Collaborator Author

Thanks for the ACK. The four notes, and what else changed since 7dd83d813:

A static-IP state that stays UNKNOWN. Fixed (cd1f296156): a node with no public address on the interface its traffic leaves by is DYNAMIC whether or not its address just moved; the ten-day window after a watched change now decides only for a node that holds a public address. A NAT node whose address keeps changing therefore hands a static-IP update back as UNSUITED. Unit test red with the old order ("expected 'UNKNOWN' to equal 'DYNAMIC'"); harness 2010 moves the NAT node while it is down and asserts DYNAMIC inside the window and the hand-back (73a92641a0), red with the old order at both.

No update-time datacenter check, and two readings. Fixed (4ddb19b210): one rule, hwRequirements.dataCenterShortfall (the published table classes the node residential), is read by an update's requirements and by the give-up pass, so an update turning on datacenter is not applied where the table classes the node residential, and that node hands the app back as UNSUITED. The give-up pass keeps the table as its authority, since acting on "residential" removes data. The spawner's placement check keeps the node's own positive reading. Harness 2010 runs it on the residential fleet (5992ee726d): a residential node hands back, the hosting node keeps the app; red without the update's check.

sendRemoval deletes the node's own row before sending. No change: the send cannot fail (FluxPeerManager.broadcast handles each peer's failure itself), so a recorded removal is always sent; a removal that cannot be signed or recorded is kept as before.

Removing UNSUITED (or OUTGROWN) from the handed-back reasons or from what keeps a node leaving was not caught. Fixed (02d3dc8b10): the stand-down tests run for OUTGROWN and UNSUITED as well as EVACUATION; all four of your mutations are now red.

Harness, since your pass. The gate at 10ac777436 and later found reds that were the harness's, each traced to its cause:

  • 2009: the late-removal fixture froze docker's whole data root, so FluxOS's lookup of the container could hang on the image store before docker had the removal; a node can now freeze only its container directories (freezableContainerRoot), so docker takes the removal and finishes it once thawed (b72d89c41b).
  • 3006: the router was cleared before FluxOS was down (7dd83d8136).
  • 2261: asserted when a removing node stops holding the app, which 605e8974b3 moved; it now asserts the spawner's decisions (969d12a432).
  • 08 (and every suite booting through bootAndPeer): an app registered before every node's registry was built could be refused by a peer still building; boots now wait for every node's dbReady (ec7717ff75).
  • 2106: the holder's bulk catch-up could run before its peers stored the registration it was meant to bring; the holder's hash sync is now held until they have (78f338d7e0, with a hashSync:beforeSelect checkpoint).
  • A failed run now carries each node's syncthing time totals and series, and a gate records its disks' flush latency (40e348cf73, 049210cf0a).

Gate. Full gate on tester at 78f338d7e0, on development 396cc107bd: 342 of 342 suites passed; that is the tree merged as 38017e3ad8. At the same head, CI's unit suite: 13,673 passing, 0 failing, 2 pending; eslint is clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants