Repository navigation
fix(dashmate): keep Core out of Platform-only resets and make reset failures visible and recoverable - #6319
Conversation
`reset --platform --hard` restores the Platform options from the defaults of the config's preset or group. For any other config (`devnet-ops`, or a member of a custom group) there are none, and the reset fell back to removing the whole config and its directory, Core settings included, after it had already removed the Platform services and volumes. Refuse in the validation step, before any service is touched. The message names the config and the two ways forward: `reset --platform` without `--hard` keeps the config and removes Platform services and data, and `reset --hard` removes the whole config. A group shares one defaults lookup, so its first member refuses before any member is touched. A soft Platform reset and a full hard reset of such a config behave as before. Tests would have caught this: the two refusal cases fail before the fix (the reset resolves and removes the config) and pass after it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hard reset resolved the service-files directory from the group name when the config has one. Compose mounts each config's files from `<home>/<config name>/`, so for `local_1` a Platform reset deleted `<home>/local/platform` and left `local_1/platform` in place, and a full hard reset deleted `<home>/local`, which in older homes is another config's directory. A member of a group without defaults had its group's directory deleted the same way. The group name now only selects the defaults; every branch removes the directory named after the config being reset. Tests would have caught this: with a group of two, resetting `local_1` fails before the fix (its own files stay, `local/` goes) and passes after it, leaving `local_2` and `local` untouched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ofile `gateway_rate_limiter_metrics` was the only Platform service without a Compose profile, and a service without one is always active. With rate limiter metrics enabled it was started, pulled and listed on a node with Platform disabled, where there is no rate limiter for it to export. It also matters to the Platform-only reset, which is about to select Platform services by profile and name them explicitly: the old profile-based removal caught the exporter only because a profile-less service is in every selection, and by name it would have been left behind. It now carries `platform` like the rate limiter and its Redis. Tests would have caught this: with Platform disabled the exporter is listed before the fix and not after it, and it is listed with the `platform` profile when Platform is enabled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reset removed service files with `fs.rmSync` and swallowed `EACCES`/`EPERM`. On Linux, where a container can leave root-owned directories in a config's directory (Docker creates a missing bind-mount source as root), Node 24 reports the denial as `EACCES` on the top directory, so the reset skipped it with a line the default renderer does not show and reported success with Platform files left behind. On macOS the same tree surfaces as a raw `ENOTEMPTY` on the top directory. Neither names the path that is in the way. Removal now walks the tree, removes everything it may, and collects what it cannot remove for lack of permission. A directory this user cannot write is reported once rather than entry by entry, unless it is empty, since removing an empty directory needs only its parent to be writable. Symbolic links are removed, not followed. If anything is left, the reset fails with the list (the first ten, then a count) and the remedy: remove them with sufficient rights, then run the reset again. The config is saved only when the command succeeds, so after the failure config.json is unchanged and the re-run is safe. Both the reset and the remove-config step use it. Tests would have caught this: with read-only directories under `platform/`, the reset fails before the fix without naming them and passes after it, naming each one. The walk was also run on Linux (node:24-bookworm, non-root) against real root-owned directories: only the non-empty one is reported, a root-owned empty directory and a root-owned file in a user-owned directory are removed, and a symlink out of the tree is removed without touching its target. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…reset With `platform.quorumList.enabled`, `reset --platform` failed with `service "quorum_list" depends on undefined service "core"` after it had already removed Core's container. It selected Platform services with `--profile platform … --profile platform-quorum`, which leaves Core out of the Compose model; the quorum list depends on Core, so the project is invalid. Compose then fails `config --volumes`, but `rm --stop` (and `stop`) fall back to the project name and stop and remove every container of the project, Core included. With `--keep-data` the reset skipped the volume lookup and reported success. Reproduced on Compose v5.7.1 with a minimal file and with dashmate's own DockerCompose on the real template (temp home, images swapped for a local busybox, containers only created): the old reset removed core, drive_abci, drive_tenderdash and quorum_list, then failed. The reset now names the Platform services: every service of the config's Compose files with a `platform*` profile, whether the config enables it or not. Compose acts on the named services only, and every profile of the Compose files, `core` included, is enabled next to the names: the model stays valid, and Compose 2.10 to 2.12, which skip a named service whose profile is not enabled, still remove them (measured on 2.10.2 and 5.7.1: exactly the named containers go, Core stays). - Volumes come from `docker compose config --format json` for those services' own mounts, under the names Compose gives them, because the project's volume list includes those of services pulled in as dependencies, `core_data` among them (measured: `config --volumes <names>` lists it). They are looked up before anything is removed, so a project Compose cannot describe fails the reset with nothing gone. A named service Compose does not describe fails the lookup rather than keeping its volumes. Anonymous volumes go with the containers unless data is kept. - The running check lists the project's containers with every profile enabled and picks the Platform services itself: `ps <names>` fails before Compose 2.15 when a named service has no container, which read as "not running", and without every profile Compose 2.10 leaves out the services the config does not enable (both measured). - The helper container goes with the Platform services, as it did before: it writes certificate renewal state into the Platform directory. It is not part of the running check. - A volume still in use after ten removals fails with its name instead of looping forever. - An empty selection means nothing, never the whole project. Tests would have caught this: against the real Compose model, with the `docker compose` process replaced by a stand-in that answers as Compose does, the reset fails before the fix with the quorum list error and after it names every Platform service, never selects profiles without Core, and removes only Platform volumes. Re-run on the real template with the fix: core and core_data survive, the Platform containers and volumes are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A mainnet hard reset leaves `platform.enable` false, as mainnet's defaults have it, and from then on every Platform-only reset refused: "Cannot reset platform only if platform services are not enabled in config". The Platform data the node ran with before (volumes left by a `--keep-data` reset, or kept after Platform was turned off by hand) and its Platform options could not be cleared without the workaround of enabling Platform for the reset. `--hard` now passes that check: it removes the Platform services by name (every one is off by profile here, which is why this waited for the by-name selection), their volumes unless `--keep-data`, the config's `platform` directory, and restores the Platform defaults. A soft Platform reset still refuses there at this commit. Tests would have caught this: the hard Platform reset of a mainnet config with Platform disabled fails before the fix with the refusal and passes after it; against the real Compose model it names every Platform service, selects no profile set without Core and removes no Core volume. Re-run on the real template with Platform disabled and the quorum list on: core and core_data survive, the Platform containers and volumes are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`group reset --hard` on the `local` group removes its configs, and the reset applied that with `--platform` too: every member's config and directory went, Core settings included, while Core's containers and `core_data` stayed behind with no config to manage them. A Platform-only reset now never removes a config. The combination is refused in the validation step, before any service is touched, with the two ways forward: `--platform` alone keeps the configs and resets Platform services and data, `--hard` alone removes the configs. Tests would have caught this: a hard Platform reset with `removeConfig` removes the member's config before the fix and is refused after it, with no Docker call and the config and its Core files intact. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reset's refusals ran in an untitled first step, and the default renderer shows a failed task's error in place of its title and nothing for a task without one. The command then mutes the error, so `reset --platform` on a node with Platform disabled, and the new refusals, ended with red marks and no message. Errors of titled steps were cut to one terminal line each, which would have cut off the paths and commands the new messages give. The check step now has a title, and both reset commands wrap their output instead of truncating it. No automated test: this is the renderer's output. Checked in a 100-column pty with the CLI on a temporary home: before, the refused `reset --config devnet-ops --platform --hard` printed no message; after, it prints the whole refusal, each command on its own line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… starts A reset that found a path it could not remove only while removing it had already removed the services and part of the files, among them service files Compose needs to load the project (`logger.env`, mounted configs). Running the reset again after fixing the permissions then failed in Compose with "env file … not found", so the advice to re-run did not work. The validation step now walks the files the reset will remove without removing anything, using the same rules as the removal, and also checks that the directory holding them is writable. When this user cannot remove some of them it refuses: nothing has changed, and the message names each path and how to give them back to this user and make them writable (`sudo chown -R <uid>:<gid> <dir>`, `chmod -R u+rwX <dir>`), after which the reset runs as usual. One helper now resolves that directory for the check and for both removal steps. What the walk cannot foresee (a sticky directory, an immutable file, an I/O error) still fails during removal; those messages now say to render the service files again (`dashmate config render`) before re-running, and not to start the node in between. Tests would have caught this: with a read-only directory under `platform/`, or a read-only config directory, the reset calls Compose and removes files before the fix, and after it refuses with no Docker call and every file in place; an I/O error during removal escaped raw before and carries the recovery after. Symbolic links, the path count beyond ten and a directory that turns read-only mid-removal are pinned too. Checked with the CLI on a temporary home: refused with nothing changed, then after restoring the permissions the same command completed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Platform-only reset without `--hard` still refused when `platform.enable` was false. The refusal dates from the profile-based selection, which had no Platform profiles to select on such a node and would have acted on the whole project. Services are now named whether the config enables them or not, so it protects nothing, and it broke two things: - `group reset --platform` on the `local` group reset `local_1` … `local_N` and then refused at `local_seed`, which has Platform disabled, so the command failed every time and never reconfigured Tenderdash. The refusal of `group reset --platform --hard` recommends that command. - A config without defaults and with Platform disabled was told to use `reset --platform` without `--hard`, which refused in turn. The soft reset now removes the Platform services and, unless `--keep-data`, their volumes on such a node too, and changes no option and no file, as on any other node. It also replaces the workaround of enabling Platform for the reset only. Tests would have caught this: the soft Platform reset of a mainnet config with Platform disabled is refused before the fix and removes the Platform services and volumes after it, leaving the options and files as they were. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`group reset` resets its members one after another, and each checked only itself. A member that could not be reset, such as one with a directory this user cannot remove or with services still running, was found after the members before it had their services, volumes and files removed. The command then failed, nothing was saved, and the members already reset were left without the service files Compose needs to load their projects, so running the group reset again failed on the first of them. The refusal also said "Nothing has been changed", which was not true for the group. The reset's checks, including the running-services check unless the reset is forced, now form one function, which `group reset` runs for every member before it resets any; the reset itself runs the same checks as its first steps. `removeConfig` is part of the group reset's context from the start, so the check sees that a hard reset of the local group removes the configs. A failure during removal in a group now also says to render the service files of the members already reset. Tests would have caught this: with the second member refusing, the group reset resets the first before the fix and resets none after it; the group's check refuses running services and what the reset refuses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
✅ Final review complete — no blockers (commit 3a5478d) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Changes requested: 5 blockers
- A Platform-only reset rewrites Core configuration during command finalization —
packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:585-586(new)
Impact: Operators running a hard Platform-only reset or a soft Platform-only reset of the local group can lose local edits to Core’s generated files, or see the command fail on a read-only Core file after Platform data is gone. - A missing service file on a later group member is detected after earlier members are reset —
packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:495-501(new)
Impact: Operators resetting a group can lose the earlier members’ Platform containers and volumes before Dashmate reports that a later member is missing its generatedlogger.env. - A hard reset of a legacy grouped config named
config.jsoncan unlink the entire config collection —packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:249-262(new)
Impact: An operator hard-resetting a legacyconfig.jsonentry in a custom group can lose every saved node setting if the command is interrupted or a later member fails before the collection is saved again. - A hard Platform reset can delete files outside Platform if a directory is replaced during traversal —
packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:124-142(new)
Impact: Operators resetting a Platform subtree writable by another process can lose Core configuration or other host files that Dashmate has permission to delete. - A Platform-only reset can delete an external volume mounted by a Platform service —
packages/dashmate/src/docker/DockerCompose.js:520-524(new)
Impact: Operators whose Compose override mounts an externally managed volume into Platform can permanently lose that volume when no other container references it.
This Dashmate PR switches Platform-only resets to named Compose services, makes reset failures visible, and adds an all-member preflight for group resets. The JS build, lint, Dashmate tests, all three Dashmate E2E jobs, and the Platform test suite including both browser shards passed; PR Hygiene is still pending.
🔴 5 blocking | 🟡 3 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The diff substantially changes Dashmate’s reset orchestration, Compose service selection, and filesystem cleanup, but does not change any of the defined critical surfaces. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js`:
- [BLOCKING] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:585-586: A Platform-only reset rewrites Core configuration during command finalization
Impact: Operators running a hard Platform-only reset or a soft Platform-only reset of the local group can lose local edits to Core’s generated files, or see the command fail on a read-only Core file after Platform data is gone.
Core’s files are not preserved through command completion. The hard reset marks the config changed by setting `platform`; a soft `group reset --platform` on `local` also marks its Platform-enabled members changed through `configureTenderdashTask`. On success, `BaseCommand.saveConfigAndStopContainers()` sends each changed config to the full template writer. It unconditionally overwrites `core/dash.conf`, and the template generates fresh RPC authentication salts even when Core options are unchanged. Carry the Platform-only scope through finalization so it writes Platform templates and the shared `dynamic-compose.yml` without writing `core/`. Test Core file bytes after the command’s save-and-render hook, not just after the reset task.
- [BLOCKING] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:495-501: A missing service file on a later group member is detected after earlier members are reset
Impact: Operators resetting a group can lose the earlier members’ Platform containers and volumes before Dashmate reports that a later member is missing its generated `logger.env`.
The all-member preflight still lets a detectable failure leave the group partly wiped. `assertResetCanStart()` checks defaults and filesystem permissions and, unless forced, calls `ps`. Compose 5.7.1’s `ps` path skips service environment-file resolution, so even a stopped group can pass. The `config --format json` lookup that resolves `logger.env` runs only inside each member’s sequential removal task. Prepare and validate every member’s service and volume plan before applying any of them; `--force` should skip the running-state check, not plan validation. Add a group test where the second lookup fails and neither member reaches `rm`.
- [BLOCKING] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:249-262: A hard reset of a legacy grouped config named `config.json` can unlink the entire config collection
Impact: An operator hard-resetting a legacy `config.json` entry in a custom group can lose every saved node setting if the command is interrupted or a later member fails before the collection is saved again.
The new member-specific target can point at the repository’s live JSON file rather than a service directory. For a custom group without defaults, the base code targeted the group’s path; it now targets the member’s own path. `resolveConfigDirectory()` accepts `config.json` as a path-safe direct child, the dry run accepts a regular file under a writable parent, and the removal walk unlinks it. Finalization saves only on success. Legacy reserved names are deliberately loadable, and `config remove` already has a regression test for preserving the repository file in this case. Apply the reserved-name guard before reset touches services and cover the grouped hard-reset path.
- [BLOCKING] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:124-142: A hard Platform reset can delete files outside Platform if a directory is replaced during traversal
Impact: Operators resetting a Platform subtree writable by another process can lose Core configuration or other host files that Dashmate has permission to delete.
The removal walk does not keep deletion inside the inspected tree when a directory entry changes concurrently. `lstatSync()` checks the entry, but `readdirSync()` and each recursive child operation resolve the pathname again. If an inspected directory is replaced with a symlink, the child operations can follow that ancestor link and unlink files outside Platform before the final `rmdirSync()` reports an error. The preflight and static symlink test do not cover this. Pin directories during descent and use directory-relative, no-follow deletion, while preserving the intentional relocation of the config root. Add a regression test for replacement between inspection and descent.
- [SUGGESTION] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:292-295: Recovery instructions misquote home paths and display filenames as raw terminal text
Impact: Operators can receive unusable recovery commands when their Dashmate home path contains an apostrophe, or see misleading instructions when a denied filename contains control characters.
The printed recovery step is not safe to paste for every supported path. `DASHMATE_HOME_DIR` is not subject to config-name validation, and the permission remedies here and `sudo rm` advice at line 355 insert paths between literal single quotes without escaping embedded quotes. Separately, `formatDeniedPaths()` and the removal error display raw filenames and filesystem messages, so embedded newlines or terminal controls can make path text look like instructions. Reuse the POSIX argument-quoting logic from `renderConfigFlag.js` for command arguments, or omit pasteable commands, and escape paths and errors separately for single-line display.
In `packages/dashmate/src/docker/DockerCompose.js`:
- [BLOCKING] packages/dashmate/src/docker/DockerCompose.js:520-524: A Platform-only reset can delete an external volume mounted by a Platform service
Impact: Operators whose Compose override mounts an externally managed volume into Platform can permanently lose that volume when no other container references it.
A Platform mount is not proof that the volume belongs to the reset. The resolved model includes `dynamic-compose.yml`, and the new lookup returns the actual Docker name of every selected named mount, including external volumes and volumes with an explicit shared name. The reset passes those names directly to Docker’s volume removal API after removing the Platform containers. Unlike the old project-prefixed lookup, this can address a separately managed volume by its real name; Docker’s in-use check cannot protect it once it is detached. Exclude external and shared volumes and verify that each remaining candidate belongs to the expected Compose project and is dedicated to Platform before removing anything.
- [SUGGESTION] packages/dashmate/src/docker/DockerCompose.js:510-522: The old rs-dapi log volume survives a hard reset after the log path changes
Impact: Operators who switch rs-dapi from its default named mount to a host log path can finish a hard Platform reset with the old Docker volume still present.
The reset can leave a volume from a service it does select. Setting `platform.dapi.rsDapi.logs.accessLogPath` switches rs-dapi’s mount from `rs-dapi-access-logs` to a bind mount. The lookup only sees the current bind mount, and Compose’s `rm -v` only removes anonymous volumes. Restoring the default log configuration makes the old named volume eligible to be mounted again. To cover this case, supplement current mounts with positively identified, project-owned Platform volumes, including detached ones, without taking Core or shared storage.
- [SUGGESTION] packages/dashmate/src/docker/DockerCompose.js:131-135: Full resets can miss a running node when an enabled service has no container
Impact: On Compose versions before 2.15, operators can confirm a full reset without `--force` and have it stop a running Core node instead of refusing.
The new group preflight inherits an incorrect stopped-state result for full resets. The branch without `serviceNames` still passes every enabled service name to `ps`. Compose 2.14.2 and earlier implementations such as 2.10.2 reject that call when a listed service has no container, and `getContainersList()` translates `no such service` into an empty list. One enabled but not yet created sidecar can therefore hide running Core. Use the same unfiltered container listing and local selection as the Platform-only check. This bypasses the refusal, not the graceful stop performed by `down`.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Platform-only stop can stop Core when the quorum list is enabled — The unchanged stop task passes Platform profiles rather than service names. When the quorum-list dependency on Core makes the profile-filtered model invalid, Compose can fall back to a project-wide stop.
- Follow-up: Track a separate Dashmate lifecycle change to select Platform services by name for start and stop, and test that stopping Platform leaves Core running with the quorum list enabled.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
… any The group check ran each member's refusals and, unless forced, its running-services check, but the `docker compose config` lookup of a member's Platform volumes ran only inside that member's removal. A member whose project Compose could not describe (a missing logger.env) was found after the members before it had lost their Platform services. The check now builds each member's plan (Platform services, profiles, volume names) and the removal reuses it; --force skips only the running-services check. A single reset builds its plan in its own check step the same way. Test would have caught this: a group of two whose second lookup fails reached `rm` for the first member before the fix and reaches no `rm` after it (red, then green). Addresses PastaClaw review thread PRRT_kwDOGUlHz868RXYK on #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A config file written before `config.json` became a reserved name can still hold a config by that name, and its directory is the repository's config file. Since a reset removes each member's own directory, a hard reset of such a member in a custom group (and, as before, in the local group) unlinked the file holding every config. The reset now treats that path the way `config remove` does: the entry is reset or removed and the path is never a removal target. The check runs where the removal target is worked out, before any service is touched. Test would have caught this: a hard reset of a member named `config.json` in group `ops`, and in group `local` with the config removed, deleted the config file before the fix and keeps it after (red, then green). Addresses PastaClaw review thread PRRT_kwDOGUlHz868RXYS on #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Platform-only reset took the Docker name of every named volume a Platform service mounts, including an external volume or one another project created under the same explicit name that an override mounts, and removed it once the containers were gone. The base branch removed only project-prefixed volume keys, so this was a regression. A volume Compose marks external is now never a candidate, and a candidate is removed only when Docker labels it with this project (`com.docker.compose.project`) and the mount's key (`com.docker.compose.volume`). A volume Docker does not have is left out. Test would have caught this: an external volume and another project's explicitly named volume mounted by a Platform service were removed before the fix and survive after it (red, then green), with unit tests of the lookup for each case. Addresses PastaClaw review thread PRRT_kwDOGUlHz868RXYc on #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… one line The reset's permission remedies and `sudo rm` advice put paths between literal single quotes, so a quote in the Dashmate home path (which no name rule restricts) ended the quoting early. The denied paths and the filesystem error text were shown raw, so a line break or a terminal control sequence in a file name started a line that read as part of the message. The POSIX quoting of renderConfigFlag moves to quoteShellArgument and quotes every command argument the reset prints; a value holding a control character is written dollar-single-quoted with it escaped, so the command stays on one line. Shown paths and error text escape backslashes and control characters. The `--config` flags in the reset's advice now go through renderConfigFlag. Test would have caught this: an apostrophe in the home path broke the chown, chmod and rm commands, and a newline in a denied file name and in a filesystem error split the message, before the fix; all pass after it (red, then green). quoteShellArgument round-trips through sh and bash. Addresses PastaClaw review thread PRRT_kwDOGUlHz868RXYg on #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The full reset's running check passed every enabled service name to `docker compose ps`. Compose before 2.15 fails that call when a named service has no container, and the failure read as nothing running, so an enabled service that was never started hid a running Core and the reset went on to take the node down without --force. The same check predates this branch; the Platform-only check already lists the project's containers and picks the named services itself. The full reset now does the same with the enabled services. Test would have caught this: with Core running next to an enabled service with no container, against a Compose stand-in that fails `ps <names>` as 2.14 does, the full reset went ahead before the fix and refuses after it (red, then green). Addresses PastaClaw review thread PRRT_kwDOGUlHz868RXYs on #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g it Reusing the plan the group check prepared also skipped each member's own running-services check, which the reset ran before. A member started while the members before it were reset then lost its Platform services and data while running. The check runs again for every member, with the services from its plan; --force still skips it. Test would have caught this: a member reset with a prepared plan whose services are running went ahead before the fix and refuses after it (red, then green). Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g name A hard reset of a legacy `config.json` entry whose group has defaults keeps the entry with the default options, and the command then renders its service files into `<home>/config.json/`, where the repository's config file is. That failed only after the reset had taken the services down. The reset now refuses it before any service is touched and says to remove the config with `dashmate config remove`. Test would have caught this: a full and a Platform hard reset of a `config.json` member of group `testnet` went ahead before the fix and are refused after it, with no Compose command run (red, then green). Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… line A filesystem error other than a permission one during the reset's dry-run check (an I/O error, a path component that is a file) was thrown as it came, with the path and message unescaped, so a line break in them split the message. It now names the config and the target, escapes both onto one line, and says nothing has been changed. Test would have caught this: an I/O error with a line break in its message during the check split the message before the fix and is shown on one line after it (red, then green). Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two Compose keys can name the same Docker volume, and Docker labels it with the key Compose created it for. The lookup kept only the last key per name, so a volume labelled with the other one was left behind by a Platform reset. Every mounted key is kept and the label may match any. Test would have caught this: a volume two keys name, labelled with the first, was left out before the fix and is returned after it (red, then green). Also covered, already passing: Docker giving no labels at all, and an inspect failure other than a missing volume, which fails the lookup. Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t remedy Two gaps the earlier tests left: the group test of plan reuse stubbed the reset itself, and the parent-directory remedy was only checked on a path a shell takes unquoted. A real group reset of two members now asks Compose about each member once, in the check, and removes each member's services after that. The parent-directory chown and chmod are checked in a home path with an apostrophe. Test only, no behaviour change. Both fail when the reset ignores the prepared plan or prints the parent path unquoted (checked by breaking each on purpose), and pass on the current code. Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The comment's history note adds nothing for a reader; the reason for the choice is what stays true. Comment-only change, no behaviour delta, so no test. Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…irectory Two new assertions compared the message with the raw temp path: one looked for "sudo" anywhere, which a temp directory holding that word would trip, and one expected the target unquoted, which a temp directory with a space would break although the command is correctly quoted. They now look for a sudo command line and expect the target as quoteShellArgument quotes it. Checked with TMPDIR set to a path holding a space and "sudo". Test-only change, no behaviour delta. Found by the Codex review of the fixes for PastaClaw's review of #6319. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Brings in the third round of #6319 (baf070c). Conflicts: - commands/reset.js: both sides added an import; both are kept. - resetNodeTaskFactory.js (resolved by mergiraf, checked by hand): both imports are kept; the base's local selectPlatformServices is unchanged in this round, so it stays replaced by the shared module. Adapted to the base's API: - getVolumeNames is gone. Setup's keep-data check now finds Platform volumes the way the reset removes them: getVolumeCandidates with the helper counted as removed, then isVolumeOwned for each candidate. - The reset fixture's Docker stub has the new methods. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ly Platform Platform-only setup rendered every service file of the config when it saved, Core's included, although Core's templates read no Platform option. dash.conf lost an operator's edit and got new rpcauth salts, often under a Core that setup had found running. Setup now renders with the Platform-only scope that #6319 introduced for the Platform reset, which leaves core/ unwritten, unless it changed an option outside Platform: it sets externalIp on a fullnode that has none, and dash.conf advertises it, so then everything is rendered. Test would have caught this in CI: ✖ before fix, ✔ after (Platform-only scope when only Platform options changed; the full render when setup set externalIp). Co-Authored-By: Claude Opus 5.5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- A Platform-only reset can delete an external volume mounted by a Platform service —
packages/dashmate/src/docker/DockerCompose.js:524-529(thread, carried)
Impact: An operator runningdashmate reset --platformcan permanently lose a volume shared with an on-demand backup service when that service has no container at reset time.
New on this head: This revision unifies the running-state check, checks Docker before loading the volume model, rechecks volume labels before removal, restores native filesystem removal, and skips Core templates when finalizing a Platform-only reset. The JS build and lint, Dashmate tests and all three Dashmate E2E jobs, package functional tests, and the main and browser test suites passed; PR Hygiene and PastaClaw review are pending.
🔴 1 blocking | 🟡 2 suggestion(s)
Still open from earlier rounds (1)
- 🔴 Blocking: A Platform-only reset can delete an external volume mounted by a Platform service —
packages/dashmate/src/docker/DockerCompose.js:524-529(thread)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The PR makes substantial changes to Dashmate’s reset logic, including destructive filesystem and Docker operations, but does not change consensus, funds movement, cryptography, key handling, peer-facing deserialization, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js`:
- [SUGGESTION] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:371-378: Hard reset leaves a dangling Platform directory link on Node 24.13.0
Impact: On Node 24.13.0, an operator hard-resetting a preset whose Platform directory points to a retired location can save the new settings but fail to regenerate the Platform files.
The reset can save the default Platform settings and leave the node without usable Platform service files. If the preset's `platform` symlink points to a directory removed during storage maintenance, the operator can reach removal with `--platform --hard --keep-data --force`: those flags bypass the volume-model and running-state checks, and Compose 5.7.1's `rm` does not resolve the missing service env file. The filesystem preflight accepts the link under a writable parent. Since `d1d8c9ba9d` restored `fs.rmSync`, Node 24.13.0 follows the top-level link in its initial status check and returns on `not_found` without unlinking it. Finalization then saves the config before failing to create directories through the link. Unlink a symlink at the removal target itself, retaining native recursion for directories, and use `lstat` in the regression test so a dangling link does not count as absent.
- [SUGGESTION] packages/dashmate/src/listr/tasks/resetNodeTaskFactory.js:392-399: The reset's suggested sudo command cannot remove immutable Platform files
Impact: A Linux operator whose Platform tree contains an immutable file can reach a partial reset and receive a recovery command that still cannot remove the file.
The operator can lose Platform containers and volumes, then get stuck at the same file when following the recovery instructions. The preflight checks directory permissions but accepts regular files without checking filesystem flags. Linux refuses to unlink an immutable file with `EPERM`, and `3f32e8b090` sends that native removal error through the new `sudo rm -rf` advice. Elevation does not clear the immutable flag. Keep the native error, explain that elevation only helps with access restrictions, and tell operators whose `EPERM` persists to check and clear filesystem protections before retrying.
In `packages/dashmate/src/docker/DockerCompose.js`:
- [BLOCKING] packages/dashmate/src/docker/DockerCompose.js:524-529: A Platform-only reset can delete an external volume mounted by a Platform service
(carried; thread: https://github.com/dashpay/platform/pull/6319#discussion_r4705386834)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
…ving volumes The Platform reset's volume lookup read the Compose model with the profiles of dashmate's bundled Compose files only. A service that an override (dynamic-compose.yml, or any other file Compose loads) puts in a profile of its own was left out of the model, and Compose then pruned the volume keys only that service mounts, an external alias included. Docker still labelled the physical volume for the Platform key, so the reset removed a volume the override's service uses. The lookup now asks Compose for every profile the project's files declare (`docker compose config --profiles`, same files and environment) and reads the model with all of them enabled. If the list cannot be read, the lookup fails and nothing is removed. `getVolumeCandidates` no longer takes a `profiles` option. Compose support, measured: `config --profiles` exists from 2.0.0 (dashmate's minimum) and lists disabled profiles on 2.0.0, 2.2.3, 2.10.2, 2.12.2, 2.14.2, 2.20.3, 2.29.7 and 5.7.1. Real check, dashmate's Compose files plus an override service in profile `backup` that mounts `<project>_drive_abci_data` through an external key: the old lookup returned that volume on Compose 5.7.1, 2.20.3 and 2.10.2; the new one keeps it and still returns the other Platform volumes. Tests would have caught this: ✖ before the fix, ✔ after: - DockerCompose.spec.js "should see a service in a profile only an override declares", "should fail when Compose cannot list the profiles" - resetNodeTaskFactory.spec.js "should keep a volume a service in a profile only an override declares mounts too" (the stand-in now leaves out a service whose profile is not enabled and prunes unmounted keys) Co-Authored-By: Claude Opus 5.5 <[email protected]>
A hard reset removes `<config>/platform` (or the config's directory) with
Node's `fs.rmSync({ recursive: true, force: true })`. When the target
itself is a link that points nowhere, for example to a directory a
storage move retired, Node 24's recursive removal returns without
removing it (measured on 24.4.0; reported on 24.13.0; 22.22.3 and 26.5.0
remove it). The reset then reported success, and the Platform files were
rendered through the dangling link.
A target that is a symbolic link is now unlinked. A link that points to a
directory loses only the link, as before (rmSync already did that on 22,
24 and 26). Directories still go through Node's native recursion.
Test would have caught this: ✖ before the fix, ✔ after:
resetNodeTaskFactory.spec.js "should remove a target that is a link, even
one that points nowhere" (checked with lstat, so a dangling link does not
count as absent; the live-link half passed before too, the dangling half
failed).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A removal failure the pre-check cannot see is reported with Node's error. For EACCES and EPERM alike the reset advised `sudo rm -rf <target>`. EPERM also comes from a filesystem protection, such as an immutable file (Linux `chattr +i`, macOS `uchg`), which elevation does not get past, so the advice could leave the operator stuck at the same file. EACCES keeps the privileged removal. For EPERM the native error stays, the privileged removal is offered as helping only when access rights are what stop it, and if EPERM persists the operator is told to find and clear the protection (lsattr/chattr, ls -lO/chflags) before rendering and re-running the reset. Test would have caught this: ✖ before the fix, ✔ after: resetNodeTaskFactory.spec.js "should show the removal's error for a failure the check cannot foresee" (EPERM). Positive control, green before and after: "should give a removal with more rights for an access error the check cannot foresee" (EACCES). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The volume lookup listed the project's profiles with `docker compose config --profiles` and then enabled them. Compose loads the project with the config's own profiles to list them, and on 2.29.7 and 5.7.1 it refuses when a service the config enables depends on one it does not, such as an override service with no profile that depends on `drive_abci` on a node with Platform disabled. The lookup then failed a reset that the bundled-profile lookup had handled. The lookup now reads the model in one call with `--profile '*'`, which enables every profile, an override's own included. Measured on Compose 2.0.0, 2.2.3, 2.10.2, 2.12.2, 2.14.2, 2.20.3, 2.29.7 and 5.7.1: the wildcard brings in the service in an override-only profile and keeps its external alias, and it loads the project in the case above. A Compose that took `*` for a literal profile would leave out every Platform service, and the lookup already fails when a Platform service is not described. Real check (dashmate's Compose files, busybox, containers created only): with the override-only profile, the lookup keeps the aliased Platform volume on 5.7.1, 2.20.3 and 2.10.2; with Platform disabled and the dependent override service, it returns the Platform volumes on 5.7.1, 2.20.3 and 2.10.2, where `config --profiles` fails on 5.7.1. Test would have caught this: ✖ before the fix, ✔ after: resetNodeTaskFactory.spec.js "should clear Platform data when Platform is disabled and an override service depends on it" (the stand-in refuses an enabled override service whose Platform dependency is disabled, and reads `*` as every profile). Co-Authored-By: Claude Opus 5.5 <[email protected]>
A target that is a symbolic link is looked at with lstat and then unlinked. If something else removes it in between, `unlinkSync` throws ENOENT and the reset failed after its Docker changes, where the forced recursive removal before took absence for success. ENOENT from the removal now counts as removed. Test would have caught this: ✖ before the fix, ✔ after: resetNodeTaskFactory.spec.js "should take a link removed meanwhile for removed". Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test for a removal target that is a link pointing nowhere relied on the running Node's `fs.rmSync` leaving such a link in place. CI pins a Node 24 release where it does not, so the test passed there with the old removal too. `fs.rmSync` is now stubbed to leave a dangling target link in place, as the affected Node versions do. Checked: ✖ with the removal from before 60d2eb0 (rmSync only), ✔ with the current one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test checked that the EACCES message has no EPERM advice by looking for the word "immutable" anywhere in it, and the message includes the target path, so a temp directory holding that word failed it. It now checks that no line carries the EPERM advice. Checked with TMPDIR=/private/tmp/pr6319-r4/tmp-immutable: ✖ before, ✔ after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
New on this head: This revision uses Compose’s wildcard profile for volume discovery, unlinks dangling reset targets without following them, and distinguishes access errors from filesystem protections in recovery instructions. The JS build and lint, Dashmate tests and all three Dashmate E2E jobs, package functional tests, and both browser shards passed; PastaClaw review and PR Hygiene are still pending.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The diff makes intricate changes to Dashmate’s reset, Compose, and recovery logic, but deleting node data during an operator-requested reset is not a storage migration, and the diff changes no other critical surface. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/dashmate/src/docker/DockerCompose.js`:
- [SUGGESTION] packages/dashmate/src/docker/DockerCompose.js:527-529: An inactive override service’s missing env file can block a Platform reset
Impact: Operators who provision an env file only when running an optional backup service cannot reset Platform data while that file is absent, even if the backup service mounts no Platform volume.
A data-removing `dashmate reset --platform` can now refuse before touching any containers or volumes because a service it will not remove has a missing required `env_file`. Before `1ca81ac3018`, the lookup passed the bundled profiles, so Compose 5.7.1 excluded services in override-only profiles such as `backup` before resolving their env files. The wildcard activates those services for the ownership lookup, and `config --format json` now fails on their missing files before Dashmate can inspect any mounts. `--force` skips the running-state check, not this lookup. Keep the all-profile mount discovery, but use `--no-env-resolution` where supported and separately preflight the required generated files, such as `logger.env`, before resetting any group member.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- The chain-restart guide still describes the old Platform reset behavior — The base branch’s #6315 guide tells operators to toggle Platform or the quorum list to run a reset and says a hard Platform-only reset removes a config without defaults. After this PR, those toggles are unnecessary and the hard reset refuses instead.
- Follow-up: After both changes are integrated, update the chain-restart section in
packages/dashmate/docs/update.mdto remove the workarounds and document the refusal.
- Follow-up: After both changes are integrated, update the chain-restart section in
|
Bots are done — your move: post |
…atform-impl Brings in #6319 as squash-merged (f4176c4), the 5.1.0 sync #6333 and #6325. Merged with merge drivers off. Conflicts: - docs/commands/reset.md, src/commands/reset.js, src/listr/tasks/resetNodeTaskFactory.js: this branch's version. v5.2-dev's copy of each is byte-identical to #6319's final head 3a5478d, which this branch already merged, so nothing else came in. - docs/update.md: v5.2-dev's apt-based install/update flow and its chain restart section as they are; this branch's "Starting Platform Over" and "Lost node key" follow "Do not add --hard", whose closing paragraph now names setup --platform as the way back. The old soft-reset section is replaced by v5.2-dev's. - ssl/zerossl/validateZeroSslCertificateFactory.js and its spec: #6316's rule (the API key stays out of the result) combined with this branch's rewrite; the ZeroSSL call keeps the abort signal. Both sides' tests kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Issue being fixed or feature implemented
dashmate reset --platformis about to become the first half of a Platform rebuild (setup --platform, planned for 5.2), which relies on a strict contract: a Platform-only reset never touches Core and never removes a config, a successfulreset --platform --hardleaves nothing of Platform behind, and every refusal or failure is visible, names what is wrong and leaves a state from which the suggested next step works. On v5.2-dev the reset breaks that contract in several ways, each reproduced before it was fixed:devnet-ops, or of a member of a custom group, found no Platform defaults and fell back to removing the whole config and its directory, Core settings included.EACCESon the top directory, and the reset swallowed it and reported success with Platform files left behind. On macOS the same tree failed with a rawENOTEMPTY. Neither named the path.<home>/<group>/platform(or all of<home>/<group>), not the member's own<home>/<config>/…, which is where Compose mounts its files from.platform.enable: false) every Platform-only reset refused, so the Platform data the node ran with earlier could not be cleared. That refusal also madegroup reset --platformonlocalfail atlocal_seed, which has Platform disabled, after the other members had been reset.platform.quorumList.enabled, selecting--profile platform … --profile platform-quorumleavescoreout of the Compose model, andquorum_listdepends on it. Compose then failsconfig --volumes(service "quorum_list" depends on undefined service "core"), andrm --stopfalls back to the project name: it stopped and removed Core's container. With--keep-datathe reset reported success. This was reproduced on Compose 5.7.1 with a minimal file and on the real template through dashmate's ownDockerCompose(temp home, images swapped for busybox, containers only created). A reviewer also measured that on Compose 2.12 and older the old profile-based reset removed Core's container and deletedcore_dataeven with the quorum list off.The review rounds also turned up:
group reset --platform --hardonlocalremoved every member's config, Core settings included, and left Core's containers and data with no config.logger.env), so re-running the reset failed in Compose.group resetchecked each member only when it reached that member, so a member that could not be reset was found after the members before it were already reset, leaving them in the same broken state.What was done?
One logical fix per commit, each test-first:
138351dcb3). A hard Platform reset of a config with no preset or group defaults is refused in the validation step, before any service is touched. The message gives both ways forward:reset --platformwithout--hard, or a fullreset --hard.17b24d017f). The group name only selects the defaults; every branch removes<home>/<config name>.4f8faae415).gateway_rate_limiter_metricswas the only Platform service without a Compose profile, so it ran on nodes with Platform disabled, and by-name selection would have missed it. It now hasplatform.7aae6b62a2,d1d8c9ba9d,3f32e8b090,60d2eb04f2,ec31531e1e,fa95c653ee). The files are removed with Node'sfs.rmSync({ recursive: true, force: true }), as before this PR. A target that is itself a symbolic link is unlinked instead, so the link goes and what it points to stays: some Node 24 versions' recursive removal returns without removing a link that points nowhere (measured on 24.4.0). A target already gone counts as removed. When that fails, a walk over what is left (never following a symlink) names each path this user cannot remove, since Node's error names the target at most. A directory whose entries can't be removed is named once; an empty one is not named, since removing it needs only its parent to be writable. A failure the walk cannot see is reported with Node's error. ForEACCESit comes with a removal that has the rights (sudo rm -rf <target>). ForEPERMthat removal is offered as helping only when access rights are what stop it, and ifEPERMpersists, a filesystem protection such as the immutable flag has to be found and cleared before the reset is run again. The removal does not go on past a path it cannot remove.e4b4b9f6d5). A Platform reset now acts on every service of the config's Compose files that has aplatform*profile, whether the config enables it or not.rmgets the names together with every profile,coreincluded: the model stays valid, and Compose 2.10–2.12, which skip a named service whose profile is not enabled, still remove them. Measured on 2.10.2 and 5.7.1: only the named containers go, Core stays. Volumes are worked out from the project's whole model (docker compose config --format json, no service names, every profile enabled by Compose's wildcard--profile '*', so a profile that only an override such asdynamic-compose.ymldeclares counts too) before anything is removed, under the names Docker gives them: the project's volume list includes the volumes of services pulled in as dependencies (core_data), and given names Compose describes only them and what they depend on (both measured). A Platform service missing from that output fails the lookup instead of keeping its volumes. Anonymous volumes go with the containers unless--keep-data. The running check lists the project's containers with every profile enabled and picks the Platform services itself, becauseps <names>fails before Compose 2.15 when a named service has no container, and without every profile Compose 2.10 omits the services the config doesn't enable (both measured). The helper container is removed along with the Platform services, as before, because it writes renewal state intoplatform/gateway/ssl. The volume-in-use retry is capped, then names the volume.--hardwith Platform disabled (9342a3b239). It removes the Platform services, volumes and directory and restores the defaults. This lands after by-name selection: with Platform disabled the profile filter was empty, andrm/config --volumeswould have acted on the whole project.5e0760c484). A Platform-only reset never removes a config, sogroup reset --platform --hardonlocalis refused with the two alternatives.11d6edda3b). The validation step has a title, and both reset commands wrap output instead of truncating it.945e532735). The validation step runs that walk on the target, including whether the directory holding the target is writable, and refuses while nothing has changed. It gives the commands to hand the paths back to this user and make them writable (sudo chown -R <uid>:<gid>,chmod -R u+rwX). A failure the walk cannot foresee (sticky directory, immutable file, I/O error) still fails during removal, and that message says to rundashmate config renderbefore re-running and not to start the node in between.2acf37707f). Ivan said the soft refusal could stay. I removed it instead, because with by-name selection it protects nothing, and it made two recommended commands fail:group reset --platformonlocal(the seed has Platform disabled), and the soft reset that the no-defaults refusal suggests. The soft reset now removes Platform services and volumes there too, and changes no option and no file. It also replaces the "enable Platform for the reset" workaround.472d69a32b). The reset's checks, including the running-services check unless--force, form one function.group resetruns it for every member before resetting any, withremoveConfigin the context from the start.3961ee8ad1,f7b616573c,6bf972c1f9,d348b92590). That check also works out each member's plan (Platform services, profiles, and the candidate volumes from the Compose model), and each member's removal uses its plan. A member whose project Compose cannot describe, or whose volumes Docker cannot be asked about, now stops the group before any member loses anything. Whose a volume is, and whether Docker has it, is decided just before each attempt to remove it, so a volume created by then is removed and one replaced meanwhile is kept.--forceskips only the running-services check, and that check runs again for each member when its turn comes.211bb5abd2,ed7d0a274a). A config file can still hold a config namedconfig.json, a name reserved since. Its directory would be the config file itself, so the reset never removes that path, asconfig removealready does. A hard reset that would keep such an entry is refused up front and points todashmate config remove.297c481485,1badea5cbf,a889cf5e76,93c69bba37,3b5c35981d,ba57cb3b63,1ca81ac301). Decided by the Docker volume name, which several Compose keys can give. A volume is removed only when Platform alone uses it: never when any key that names it isexternal, nor when a service the reset does not remove mounts it under any key (Core included; the helper is removed with Platform, so it does not count). What remains must be labelled by Docker as created by this project (com.docker.compose.project) for one of the keys a Platform service mounts it under (com.docker.compose.volume). An override that mounts the operator's own volume, Core's, or another project's into a Platform service no longer loses it. Checked against Compose 5.7.1 and Docker 29 on the real Compose files: the lookup returns the three Platform volumes only.3051492357,3dd468bd7c,85619ad89f). Every command argument the reset prints is quoted with plain POSIX single quotes (quoteShellArgument, taken out ofrenderConfigFlag), whichshanddashread the same way. A value holding a control character can't be quoted that way on one line, so for such a path the reset names the commands and shows the path escaped, for reading, with no command to paste. Paths and filesystem error text are shown escaped on one line.37b2a91b62,f1d5dfe47a).DockerCompose.isNodeRunning()lists the project's containers and picks the services itself in both call forms, sostop,reindexandresetagree. On Compose before 2.15, an enabled service with no container no longer hides a running Core. Theps <names>call it replaces is on v5.2-dev too.59a5d94cda). The volume lookup runs dashmate's Docker check before Compose, so the usual guidance (not installed, not started, no permission) shows even with--force.a374101ff9). When a command that changed the config ends,BaseCommand.saveConfigAndStopContainers()passes the command's render scope (static getRenderScope(flags)) towriteConfigTemplates(config, scope).reset --platformandgroup reset --platformdeclarePLATFORM_ONLY_RENDER_SCOPE({ skipDirectories: ['core'] }): the Platform files anddynamic-compose.ymlare written, Core'score/files are left as they are (Core's templates read no Platform option). Every other command still writes everything.docs/commands/reset.mdanddocs/commands/group/reset.mddescribe the new refusals and--platform --hardwith Platform disabled.Not changed here (follow-ups):
stop --platformandstart --platformstill select by profile. With the quorum list enabled,stop --platformstops Core too (measured, Compose 5.7.1), andstart --platformfails.docs/update.mdkeeps its current text. The quorum-list and Platform-disabled workarounds are in docs(dashmate): drop the Platform reset from major updates #6315, which is still open on v5.1-dev. Once both are in, both workarounds can go, since the reset no longer needs either.foo.barandfoobar, or upper case) share one Compose project in every dashmate command, not only the reset; newer Compose rejects such names.<config>/platformexists with fresh files;setup --platformmust not expect it to be absent.<home>/<config>is followed, as before: that is how a config directory moved to another disk works.platform.dapi.rsDapi.logs.accessLogPathswitches it to a bind mount. Removing it needs a separate list of the volumes Platform owns.down, as on v5.2-dev.env_fileis missing makes the Platform reset refuse before it removes anything. Reading the model without resolving env files (--no-env-resolutionwhere Compose supports it) would avoid it (thread).rmor volume removal error) partway through a group reset still leaves the members before it reset without their final render; the recovery isdashmate config renderfor each. Deferring every member's file removal until the group's Docker work succeeds would close it.externaldeclaration that no service mounts is left out of the model by Compose under any profile set, so it is not seen: a volume declared that way and mounted only by Platform services is removed if Docker labels it for a key a Platform service mounts.How Has This Been Tested?
Unit tests (mocha), each new one seen red on the unfixed code and green after:
test/unit/listr/tasks/resetNodeTaskFactory.spec.js(refusals, group of two, permission cases including a dry-run refusal with nothing changed, Platform disabled; Compose-level cases through the DI container with the realDockerCompose/generateEnvs/getServiceListand a stand-in for thedocker composeprocess),test/unit/docker/DockerCompose.spec.js,test/unit/docker/getServiceListFactory.spec.js,test/unit/commands/group/reset.spec.js(every member checked before any is reset). Every commit passes its touched tests on its own.Full dashmate unit suite: 1269 passing, 0 failing, 0 pending (at the latest head). Integration suite, not re-run for the latest fixes, which touch no SSL code (Let's Encrypt against Pebble): 14 passing, 2 failing, and neither failure comes from this change. The contactless renewal fails the same way without it (lego killed after a random renewal delay). The port-80 case is flaky, failing and then passing on the same code.
Real Compose, on the real template with a temp home and busybox images: with the quorum list enabled, the old reset removed
core, then failed. With the fix,coreandcore_datasurvive and the Platform containers and volumes are gone. This was checked with Platform enabled and with it disabled (hard reset), on Compose 5.7.1 and on 2.10.2 (through adockerwrapper).Compose 2.10.2 and 5.7.1, minimal file: named
rmwith and without the profiles, andps <names>with a missing container.Linux (
node:24-bookworm, non-root) against real root-owned directories, with the walk that the check still uses: only the non-empty root-owned directory is reported, not a root-owned empty directory or file. The removal itself is Node'sfs.rmSyncagain.Real Compose 5.7.1 on the real Compose files, through dashmate's own adapter: the whole-model volume lookup loads with every profile and returns only the Platform volumes; the running check's default form works.
Real Compose 5.7.1, 2.20.3 and 2.10.2 on dashmate's Compose files through dashmate's adapter, plus an override service in a profile of its own that mounts the Platform volume through an external key: the previous lookup returned that volume, the new one keeps it and still returns the other Platform volumes. With Platform disabled and an override service without a profile that depends on
drive_abci, the lookup returns the Platform volumes; listing the profiles first (config --profiles) fails there on 5.7.1.--profile '*'was measured as a wildcard on Compose 2.0.0, 2.2.3, 2.10.2, 2.12.2, 2.14.2, 2.20.3, 2.29.7 and 5.7.1.dash(macOS/bin/dash):$'a\012b'reads as the literal$a\012b; the reset's quoting round-trips throughshanddash.The CLI in a 100-column pty on a temp home: the
devnet-opsrefusal printed nothing before and prints in full after. A read-only directory is refused with nothing changed, and after the permissions are restored the same command completes.Reviews before pushing: two independent spec reviews (correctness, failure modes), four code reviews (correctness and Compose semantics, silent failures, test quality, Codex gpt-6.2-sol xhigh), and a second Codex xhigh pass on the fixes. Their findings are folded in or listed above as follow-ups. The fixes for the PastaClaw review of
472d69a32bhad one more Codex xhigh pass. It found the dropped per-member running check, the keptconfig.jsonentry and the unescaped pre-check error, all fixed here. The fixes for the PastaClaw review of776d7f13f0had three Codex xhigh passes. They found the helper's shared volume, the inspect error found only after a member was reset, the 409 retry deleting a replaced volume, the label of a key no Platform service mounts being accepted, and a permission error losing the privileged removal, all fixed here. The fixes for the PastaClaw review ofbaf070ce94had one Codex xhigh pass. It found that listing the profiles first fails on a project Compose loads only with every profile, that a link removed meanwhile failed the reset, and that the dangling-link test passed without the fix on CI's Node, all fixed here.Not proven: a live evonode with running images and real root-owned bind-mount sources (simulated as above).
Breaking Changes
None in any API. Operators may notice these behaviour changes, all deliberate:
group reset --platform --hardonlocal, are refused instead of removing configs.reset --platformwithout--hardnow runs on a node with Platform disabled, instead of refusing.--platform --hardnow runs with Platform disabled.core/) when it ends.stopandreindexnow see a running Core next to an enabled service that has no container.config.jsonis refused, withdashmate config removeas the way out.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
3a5478d/self-reviewedWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.