You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2026/06/08 17:28:38 UTC
(causeway) 01/25: CAUSEWAY-4028: proposes deleting excluded commands
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-4032
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit ca4ee60f4b819abce8712cc9803d97ab4e0d32ed
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Jun 8 11:39:52 2026 +0100
CAUSEWAY-4028: proposes deleting excluded commands
---
.../delete-excluded-commands/.openspec.yaml | 2 +
.../changes/delete-excluded-commands/design.md | 51 ++++++++++++++++++++
.../changes/delete-excluded-commands/proposal.md | 25 ++++++++++
.../specs/command-export-command-exclusion/spec.md | 56 ++++++++++++++++++++++
openspec/changes/delete-excluded-commands/tasks.md | 33 +++++++++++++
5 files changed, 167 insertions(+)
diff --git a/openspec/changes/delete-excluded-commands/.openspec.yaml b/openspec/changes/delete-excluded-commands/.openspec.yaml
new file mode 100644
index 00000000000..e8d4ccfe905
--- /dev/null
+++ b/openspec/changes/delete-excluded-commands/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-06-08
diff --git a/openspec/changes/delete-excluded-commands/design.md b/openspec/changes/delete-excluded-commands/design.md
new file mode 100644
index 00000000000..fdd4f701490
--- /dev/null
+++ b/openspec/changes/delete-excluded-commands/design.md
@@ -0,0 +1,51 @@
+## Context
+
+`CommandExportManager` now exposes `excludedCommands` for command log entries that have been removed from the active export sequence by setting replay state to `EXCLUDED`.
+Users can also restore excluded commands to `UNDEFINED` if they need them again.
+
+Some excluded commands are known noise and should be removed from the command log entirely to simplify the export manager view.
+Deletion is destructive, so it should be available only from the already-excluded collection and should reject stale or active-command selections.
+
+## Goals / Non-Goals
+
+**Goals:**
+
+- Provide a `deleteCommands` action associated with `excludedCommands`.
+- Support deleting one or more selected excluded commands in a single invocation.
+- Use `choicesFrom = "excludedCommands"` and explicit selected-command choices sourced from `getExcludedCommands()`.
+- Disable the action when there are no excluded commands.
+- Validate direct invocation so only current baseline-bounded excluded commands can be deleted.
+- Remove selected backing `CommandLogEntry` entities through the repository service.
+
+**Non-Goals:**
+
+- Do not delete active `UNDEFINED` or `EXPORTED` commands from the export manager.
+- Do not add deletion from the active `commands` collection.
+- Do not add undo support for deleted command log entries.
+- Do not change replay-manager deletion semantics for imported replay commands.
+
+## Decisions
+
+1. Delete only from `excludedCommands`.
+
+The action will be associated with the excluded collection and use that collection for choices and validation.
+Alternative considered: delete any command selected from either export-manager collection.
+That alternative was rejected because deletion is destructive and should require a deliberate prior exclusion step.
+
+2. Implement as a `CommandExportManager_deleteCommands` mixin.
+
+The action name requested by the user is `deleteCommands`, and a mixin keeps behavior consistent with existing export-manager actions.
+The mixin will return the current `CommandExportManager` so the page refreshes after deletion.
+Alternative considered: reuse `ReplayableCommand_delete` on each row.
+That alternative was rejected because this workflow needs multi-select deletion associated with the manager's `excludedCommands` collection.
+
+3. Use explicit choices in addition to `choicesFrom`.
+
+The action annotation will declare `choicesFrom = "excludedCommands"`, and the mixin will also provide `choicesSelected()` returning `commandExportManager.getExcludedCommands()`.
+This follows existing command export manager mixin patterns and avoids metadata validation gaps.
+
+## Risks / Trade-offs
+
+- Deletion is irreversible → Limit choices and direct invocation validation to currently excluded commands only.
+- Stale selected rows can occur after refresh or concurrent changes → Recompute `excludedCommands` in validation before deleting.
+- Repository removal details may vary by persistence implementation → Use the existing `RepositoryService#remove` path already used by replayable-command deletion.
diff --git a/openspec/changes/delete-excluded-commands/proposal.md b/openspec/changes/delete-excluded-commands/proposal.md
new file mode 100644
index 00000000000..cf746325ca7
--- /dev/null
+++ b/openspec/changes/delete-excluded-commands/proposal.md
@@ -0,0 +1,25 @@
+## Why
+
+After commands have been excluded from the Command Export Manager, users may decide those commands are no longer useful and should be removed from the command log entirely.
+Providing deletion from `excludedCommands` keeps destructive cleanup limited to commands the user has already removed from the active export sequence.
+
+## What Changes
+
+- Add a `deleteCommands` action associated with the `excludedCommands` collection.
+- Allow one or more excluded commands to be selected and deleted in one invocation.
+- Disable the action when the `excludedCommands` collection is empty.
+- Use `choicesFrom = "excludedCommands"` and also provide explicit choices for the selected command parameter.
+- Validate direct invocation so only commands currently in the baseline-bounded `excludedCommands` collection can be deleted.
+
+## Capabilities
+
+### New Capabilities
+
+### Modified Capabilities
+- `command-export-command-exclusion`: Adds deletion of baseline-bounded excluded commands from the export manager.
+
+## Impact
+
+- Affects `CommandExportManager` and a new action mixin under `extensions/core/commandlog/applib`.
+- Deletes backing `CommandLogEntry` entities for selected excluded commands.
+- Requires tests for multi-select deletion, empty-collection disablement, explicit choices, and validation against non-excluded or stale selections.
diff --git a/openspec/changes/delete-excluded-commands/specs/command-export-command-exclusion/spec.md b/openspec/changes/delete-excluded-commands/specs/command-export-command-exclusion/spec.md
new file mode 100644
index 00000000000..030059caeda
--- /dev/null
+++ b/openspec/changes/delete-excluded-commands/specs/command-export-command-exclusion/spec.md
@@ -0,0 +1,56 @@
+## ADDED Requirements
+
+### Requirement: Export manager deletes selected excluded commands
+The export manager SHALL provide a `deleteCommands` action associated with the `excludedCommands` collection.
+The action SHALL allow one or more selected commands to be deleted in one invocation.
+The action SHALL use `excludedCommands` as its selected-command choices source.
+The action SHALL also provide explicit selected-command choices from the current `excludedCommands` collection.
+The action SHALL delete the backing command log entries for selected excluded commands.
+The action SHALL return the current export manager so the refreshed view can show updated collections.
+The action MUST reject execution when no commands are selected.
+The action MUST reject execution when any selected command is outside the current baseline-bounded `excludedCommands` collection.
+The action MUST NOT delete active commands from the `commands` collection.
+
+#### Scenario: Selected excluded commands are deleted
+- **GIVEN** an export manager baseline is set
+- **AND** commands `A` and `B` are in the `excludedCommands` collection
+- **WHEN** the user invokes `deleteCommands` with commands `A` and `B` selected
+- **THEN** the command log entries for `A` and `B` are deleted
+- **AND** the export manager is returned
+
+#### Scenario: Cannot delete without a selection
+- **GIVEN** an export manager baseline is set
+- **WHEN** the user invokes `deleteCommands` with no selected commands
+- **THEN** the system rejects the invocation
+- **AND** no command log entries are deleted
+
+#### Scenario: Cannot delete active command by direct invocation
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` is in the active `commands` collection
+- **WHEN** a caller bypasses the UI and invokes `deleteCommands` with command `A` selected
+- **THEN** the system rejects the invocation
+- **AND** the command log entry for `A` is not deleted
+
+#### Scenario: Selected command choices come from excluded commands
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` is in the `excludedCommands` collection
+- **AND** command `B` is in the active `commands` collection
+- **WHEN** the system provides choices for the `deleteCommands` selected commands parameter
+- **THEN** command `A` is offered as a choice
+- **AND** command `B` is not offered as a choice
+
+### Requirement: Delete excluded commands action is disabled when empty
+The export manager `deleteCommands` action SHALL be disabled when the `excludedCommands` collection is empty.
+The action SHALL be enabled when the `excludedCommands` collection is not empty.
+
+#### Scenario: Delete action disabled with no excluded commands
+- **GIVEN** an export manager baseline is set
+- **AND** the `excludedCommands` collection is empty
+- **WHEN** the framework evaluates the `deleteCommands` action
+- **THEN** the action is disabled
+
+#### Scenario: Delete action enabled with excluded commands
+- **GIVEN** an export manager baseline is set
+- **AND** the `excludedCommands` collection contains command `A`
+- **WHEN** the framework evaluates the `deleteCommands` action
+- **THEN** the action is enabled
diff --git a/openspec/changes/delete-excluded-commands/tasks.md b/openspec/changes/delete-excluded-commands/tasks.md
new file mode 100644
index 00000000000..2475ba8344d
--- /dev/null
+++ b/openspec/changes/delete-excluded-commands/tasks.md
@@ -0,0 +1,33 @@
+## 1. Delete Commands Action
+
+- [ ] 1.1 Add a `CommandExportManager_deleteCommands` mixin associated with the `excludedCommands` collection.
+- [ ] 1.2 Annotate the action with `choicesFrom = "excludedCommands"`.
+- [ ] 1.3 Implement `choicesSelected()` to explicitly return `CommandExportManager#getExcludedCommands()`.
+- [ ] 1.4 Implement the action to accept one or more selected `ReplayableCommand` rows and delete their backing command log entries.
+- [ ] 1.5 Return the current `CommandExportManager` after deleting selected commands.
+
+## 2. Validation and Disablement
+
+- [ ] 2.1 Disable `deleteCommands` when `excludedCommands` is empty.
+- [ ] 2.2 Validate that at least one command is selected.
+- [ ] 2.3 Validate that every selected command is currently present in the baseline-bounded `excludedCommands` collection before deleting.
+- [ ] 2.4 Ensure active commands from `commands` cannot be deleted by direct invocation.
+
+## 3. Registration and UI Metadata
+
+- [ ] 3.1 Register the new mixin in `CausewayModuleExtCommandLogApplib` if explicit registration is required.
+- [ ] 3.2 Add action description text indicating that deletion permanently removes selected excluded command log entries.
+- [ ] 3.3 Confirm the action is associated with the `excludedCommands` collection.
+
+## 4. Tests
+
+- [ ] 4.1 Add tests that deleting one or more excluded commands removes their backing command log entries.
+- [ ] 4.2 Add tests that the action rejects empty selections.
+- [ ] 4.3 Add tests that active commands or stale selections outside `excludedCommands` are rejected.
+- [ ] 4.4 Add tests that `deleteCommands` is disabled when `excludedCommands` is empty and enabled when not empty.
+- [ ] 4.5 Add tests that explicit selected-command choices include excluded commands and omit active commands.
+
+## 5. Verification
+
+- [ ] 5.1 Run focused command-log applib tests for command export manager excluded-command deletion behavior.
+- [ ] 5.2 Run `openspec status --change delete-excluded-commands` and resolve any artifact or spec validation issues.