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 10:34:32 UTC
(causeway) 12/17: CAUSEWAY-4026: proposes excluding recorded commands
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch CAUSEWAY-4028
in repository https://gitbox.apache.org/repos/asf/causeway.git
commit a33034b6a3d845e52e402d6dafa0580a8f9b0dd6
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Jun 8 11:07:20 2026 +0100
CAUSEWAY-4026: proposes excluding recorded commands
---
.../exclude-recorded-commands/.openspec.yaml | 2 +
.../changes/exclude-recorded-commands/design.md | 67 ++++++++++++++++
.../changes/exclude-recorded-commands/proposal.md | 28 +++++++
.../specs/command-export-command-exclusion/spec.md | 91 ++++++++++++++++++++++
.../command-export-command-reordering/spec.md | 81 +++++++++++++++++++
.../command-export-manager-command-list/spec.md | 63 +++++++++++++++
.../changes/exclude-recorded-commands/tasks.md | 37 +++++++++
7 files changed, 369 insertions(+)
diff --git a/openspec/changes/exclude-recorded-commands/.openspec.yaml b/openspec/changes/exclude-recorded-commands/.openspec.yaml
new file mode 100644
index 00000000000..e8d4ccfe905
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-06-08
diff --git a/openspec/changes/exclude-recorded-commands/design.md b/openspec/changes/exclude-recorded-commands/design.md
new file mode 100644
index 00000000000..0f37277f44b
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/design.md
@@ -0,0 +1,67 @@
+## Context
+
+`CommandExportManager` currently exposes a single `commands` collection containing foreground commands at or after the export baseline regardless of replay state.
+Export and move actions are associated with that collection, so every visible row remains part of the active sequence for export repair and export selection.
+
+Users can accidentally record administrative, exploratory, or otherwise unwanted commands while preparing a replayable scenario.
+The system already has a replay state value of `EXCLUDED`, but the active export manager page does not provide a current way to move selected recorded commands into that state or display them separately.
+
+Command movement and known-target exportability are meaningful only when command-log recording support is enabled.
+The exclusion action follows the same guard because it is a replay-support workflow action rather than a general command-log maintenance operation.
+
+## Goals / Non-Goals
+
+**Goals:**
+
+- Provide an export-manager action that changes selected active commands to replay state `EXCLUDED`.
+- Default the action selection to active commands whose `ReplayableCommand#getExportable()` value is `false`.
+- Keep the active `commands` collection limited to `UNDEFINED` and `EXPORTED` commands.
+- Add an `excludedCommands` collection immediately below `commands` for baseline-bounded commands in replay state `EXCLUDED`.
+- Ensure export and movement continue to work from the active command collection and therefore ignore excluded commands.
+- Disable the exclusion action when command-log recording support is disabled.
+
+**Non-Goals:**
+
+- Do not delete command log entries.
+- Do not introduce an undo or restore action for excluded commands in this change.
+- Do not change import or replay execution semantics for commands already imported into replay states such as `PENDING`, `OK`, or `FAILED`.
+- Do not change view-model memento structure unless layout metadata requires no persistent state.
+
+## Decisions
+
+1. Represent exclusion by updating `CommandLogEntry.replayState` to `EXCLUDED`.
+
+This reuses the existing replay state model and preserves full command log history.
+Alternative considered: maintain a separate export-manager exclusion list in the view-model memento.
+That alternative was rejected because exclusions need to persist independently of a particular manager instance and because `EXCLUDED` already expresses the intended domain state.
+
+2. Filter active commands at the collection query boundary.
+
+`CommandExportManager#getCommands()` will continue to obtain baseline-bounded foreground entries, but it will include only entries whose replay state is `UNDEFINED` or `EXPORTED` before constructing `ReplayableCommand` rows.
+The new `getExcludedCommands()` collection will use the same baseline and limit semantics but include only `EXCLUDED` entries.
+Alternative considered: return all commands and hide excluded rows in the UI layout.
+That alternative was rejected because export and movement choices derive from the collection and must not include excluded commands.
+
+3. Add a `CommandExportManager_excludeCommands` mixin associated with `commands`.
+
+The action will accept one or more selected `ReplayableCommand` rows from the active collection, validate that each selection is baseline-bounded and currently active, then set the backing command log entries to `EXCLUDED`.
+The action will provide a default selection containing active commands whose exportability value is explicitly `false`.
+Commands whose exportability is `true` or `null` will not be auto-selected, though users can still manually select active commands to exclude.
+The action returns the same `CommandExportManager` so the page refresh shows those commands under `excludedCommands`.
+Alternative considered: add the action to each `ReplayableCommand` row.
+That alternative was rejected because the user requirement is to exclude one or more commands from the export-manager sequence in one operation.
+
+4. Gate exclusion by command-log recording support.
+
+The exclusion action will inject `CausewayConfiguration` and use the same recording-support enabled check pattern as command movement.
+When recording support is disabled, the action is disabled and direct invocation validation still rejects the operation.
+Alternative considered: allow exclusion regardless of recording support because it only changes state.
+That alternative was rejected because exclusion changes replay/export behavior and should remain part of replay-support mode.
+
+## Risks / Trade-offs
+
+- Existing tests may assume `commands` includes all replay states → Update expectations to include only `UNDEFINED` and `EXPORTED`, and add focused tests for `EXCLUDED` rows in `excludedCommands`.
+- The page limit could make active and excluded collections independently bounded → Use the existing manager limit consistently and document/test baseline filtering rather than changing pagination in this change.
+- Direct callers could pass stale selected commands after a state change → Validate selected interaction IDs against the current active collection before mutating replay state.
+- Auto-selection might surprise users if exportability is stale or unavailable → Only auto-select commands whose exportability is explicitly `false`, and leave `true` or `null` commands unselected by default.
+- Filtering `commands` can affect exportability known-participant calculations → Ensure known-participant and exportability traversal uses the same active export sequence so excluded commands are not considered part of the command sequence.
diff --git a/openspec/changes/exclude-recorded-commands/proposal.md b/openspec/changes/exclude-recorded-commands/proposal.md
new file mode 100644
index 00000000000..7672f91d07a
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/proposal.md
@@ -0,0 +1,28 @@
+## Why
+
+End-users can accidentally record commands that are not part of the intended replay/export scenario.
+They need a safe way to remove those commands from the active export sequence without deleting command log history.
+
+## What Changes
+
+- Add an export-manager action that marks one or more selected commands as `EXCLUDED`.
+- Auto-select active commands that are not exportable when presenting the exclusion action, so accidental/non-exportable recordings can be excluded quickly.
+- Show only `UNDEFINED` and `EXPORTED` commands in the main `commands` collection.
+- Add an `excludedCommands` collection below `commands` to show commands whose replay state is `EXCLUDED`.
+- Ensure excluded commands are not considered for command export, exportability, or command movement choices.
+- Enable exclusion functionality only when command-log recording support mode is enabled.
+
+## Capabilities
+
+### New Capabilities
+- `command-export-command-exclusion`: Covers excluding baseline-bounded recorded commands from the export manager command sequence.
+
+### Modified Capabilities
+- `command-export-manager-command-list`: The export manager command collections now separate active commands from excluded commands.
+- `command-export-command-reordering`: Command movement now operates only on active commands and must not consider excluded commands.
+
+## Impact
+
+- Affects `CommandExportManager`, its collection layout, and replay/export mixins under `extensions/core/commandlog/applib`.
+- Affects command export and move command choices because they are associated with the active `commands` collection.
+- Requires tests for collection filtering, exclusion state changes, default selection of non-exportable commands, and recording-support disablement.
diff --git a/openspec/changes/exclude-recorded-commands/specs/command-export-command-exclusion/spec.md b/openspec/changes/exclude-recorded-commands/specs/command-export-command-exclusion/spec.md
new file mode 100644
index 00000000000..8d735522ec8
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/specs/command-export-command-exclusion/spec.md
@@ -0,0 +1,91 @@
+## ADDED Requirements
+
+### Requirement: Export manager excludes selected active commands
+When command-log recording support is `ENABLED`, the export manager SHALL provide an action to exclude one or more selected commands from the active command sequence.
+The action SHALL operate only on commands at or after the export manager baseline.
+The action SHALL set each selected command log entry's replay state to `EXCLUDED`.
+The action MUST reject execution when no commands are selected.
+The action MUST reject execution when any selected command is outside the active `commands` collection.
+The action MUST NOT delete command log entries.
+The action MUST return the current export manager so the refreshed view can show updated collections.
+
+#### Scenario: Selected commands become excluded
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** commands `A` and `B` are in the active `commands` collection
+- **WHEN** the user excludes commands `A` and `B`
+- **THEN** command `A` has replay state `EXCLUDED`
+- **AND** command `B` has replay state `EXCLUDED`
+- **AND** command log entries for `A` and `B` still exist
+
+#### Scenario: Cannot exclude without a selection
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **WHEN** the user invokes the exclude action with no selected commands
+- **THEN** the system rejects the invocation
+- **AND** no command replay states are changed
+
+#### Scenario: Cannot exclude command outside active collection
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is before the baseline
+- **WHEN** a caller bypasses the UI and invokes the exclude action with command `A` selected
+- **THEN** the system rejects the invocation
+- **AND** command `A` does not change replay state
+
+### Requirement: Export manager defaults exclusion selection to non-exportable commands
+When command-log recording support is `ENABLED`, the export manager exclusion action SHALL default its selected commands parameter to active commands whose exportability value is `false`.
+The default selection MUST NOT include active commands whose exportability value is `true`.
+The default selection MUST NOT include active commands whose exportability value is `null`.
+The default selection MUST NOT include commands outside the active `commands` collection.
+Users SHALL still be able to manually choose active commands to exclude.
+
+#### Scenario: Non-exportable active command is selected by default
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is in the active `commands` collection
+- **AND** command `A` has exportability value `false`
+- **WHEN** the system provides defaults for the exclusion action selected commands parameter
+- **THEN** command `A` is selected by default
+
+#### Scenario: Exportable active command is not selected by default
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is in the active `commands` collection
+- **AND** command `A` has exportability value `true`
+- **WHEN** the system provides defaults for the exclusion action selected commands parameter
+- **THEN** command `A` is not selected by default
+
+#### Scenario: Unknown exportability command is not selected by default
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is in the active `commands` collection
+- **AND** command `A` has exportability value `null`
+- **WHEN** the system provides defaults for the exclusion action selected commands parameter
+- **THEN** command `A` is not selected by default
+
+### Requirement: Command exclusion requires recording support
+The export manager exclusion action SHALL be enabled only when command-log recording support is `ENABLED`.
+When command-log recording support is `DISABLED`, the export manager MUST disable command exclusion.
+If invocation is attempted while command-log recording support is `DISABLED`, the system MUST NOT change any command replay state.
+
+#### Scenario: Exclude action enabled when recording support is enabled
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** at least one command is in the active `commands` collection
+- **WHEN** the framework evaluates the exclude action
+- **THEN** the exclude action is enabled
+
+#### Scenario: Exclude action disabled when recording support is disabled
+- **GIVEN** command-log recording support is `DISABLED`
+- **AND** an export manager baseline is set
+- **WHEN** the framework evaluates the exclude action
+- **THEN** the exclude action is disabled
+
+#### Scenario: Direct invocation is guarded when recording support is disabled
+- **GIVEN** command-log recording support is `DISABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is in the active `commands` collection
+- **WHEN** a caller bypasses the UI and invokes the exclude action with command `A` selected
+- **THEN** the system rejects the invocation
+- **AND** command `A` does not change replay state
diff --git a/openspec/changes/exclude-recorded-commands/specs/command-export-command-reordering/spec.md b/openspec/changes/exclude-recorded-commands/specs/command-export-command-reordering/spec.md
new file mode 100644
index 00000000000..c7c71ff4580
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/specs/command-export-command-reordering/spec.md
@@ -0,0 +1,81 @@
+## MODIFIED Requirements
+
+### Requirement: Export manager moves selected commands after a target command
+When command-log recording support is `ENABLED`, the export manager SHALL provide an action to move one or more selected commands from the active commands collection after a target command.
+When command-log recording support is `DISABLED`, the export manager MUST disable command movement.
+The action SHALL operate only on commands at or after the export manager baseline whose replay state is `UNDEFINED` or `EXPORTED`.
+The target command choices SHALL include commands at or after the export manager baseline from the active commands collection.
+The target command choices MUST exclude every command selected for movement.
+The target command choices MUST exclude commands whose replay state is `EXCLUDED`.
+The action MUST reject execution when no commands are selected.
+The action MUST reject execution when the target command is missing.
+The action MUST reject execution when the target command is one of the selected commands.
+The action MUST reject execution when any selected command or target command is outside the active commands collection.
+The action MUST NOT exclude a selected command or target command merely because its replay state is `EXPORTED`.
+
+#### Scenario: Target choices exclude selected commands
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** commands `A`, `B`, and `C` are in the active commands collection after the baseline
+- **AND** commands `A` and `B` are selected for movement
+- **WHEN** the system provides target choices for the move action
+- **THEN** command `C` is offered as a target choice
+- **AND** commands `A` and `B` are not offered as target choices
+
+#### Scenario: Target choices include exported commands
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` has replay state `UNDEFINED`
+- **AND** command `B` has replay state `EXPORTED`
+- **AND** commands `A` and `B` are in the active commands collection after the baseline
+- **AND** command `A` is selected for movement
+- **WHEN** the system provides target choices for the move action
+- **THEN** command `B` is offered as a target choice
+
+#### Scenario: Target choices exclude excluded commands
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` has replay state `UNDEFINED`
+- **AND** command `B` has replay state `EXCLUDED`
+- **AND** command `A` is in the active commands collection after the baseline
+- **AND** command `B` is in the excluded commands collection after the baseline
+- **AND** command `A` is selected for movement
+- **WHEN** the system provides target choices for the move action
+- **THEN** command `B` is not offered as a target choice
+
+#### Scenario: Cannot move without a selection
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **WHEN** the user invokes the move action with no selected commands
+- **THEN** the system rejects the invocation
+- **AND** no command timestamps are changed
+
+#### Scenario: Cannot move after a selected command
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is selected for movement
+- **WHEN** the user invokes the move action using command `A` as the target command
+- **THEN** the system rejects the invocation
+- **AND** no command timestamps are changed
+
+#### Scenario: Cannot move commands outside the baseline-bounded active set
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` is before the baseline
+- **WHEN** a caller bypasses the UI and invokes the move action with command `A` selected
+- **THEN** the system rejects the invocation
+- **AND** no command timestamps are changed
+
+#### Scenario: Cannot move excluded command by direct invocation
+- **GIVEN** command-log recording support is `ENABLED`
+- **AND** an export manager baseline is set
+- **AND** command `A` has replay state `EXCLUDED`
+- **WHEN** a caller bypasses the UI and invokes the move action with command `A` selected
+- **THEN** the system rejects the invocation
+- **AND** command `A` keeps its original timestamp
+
+#### Scenario: Move action is disabled when recording support is disabled
+- **GIVEN** command-log recording support is `DISABLED`
+- **AND** an export manager baseline is set
+- **WHEN** the framework evaluates the move action
+- **THEN** the move action is disabled
diff --git a/openspec/changes/exclude-recorded-commands/specs/command-export-manager-command-list/spec.md b/openspec/changes/exclude-recorded-commands/specs/command-export-manager-command-list/spec.md
new file mode 100644
index 00000000000..513d21f034a
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/specs/command-export-manager-command-list/spec.md
@@ -0,0 +1,63 @@
+## MODIFIED Requirements
+
+### Requirement: Export manager shows one baseline-bounded active command collection
+The export manager SHALL expose a collection named `commands`.
+The `commands` collection SHALL contain foreground command log entries at or after the export manager baseline whose replay state is `UNDEFINED` or `EXPORTED`.
+The `commands` collection MUST exclude command log entries whose replay state is `EXCLUDED`.
+The `commands` collection MUST exclude command log entries whose replay state is a replay execution state such as `PENDING`, `OK`, or `FAILED`.
+The `commands` collection SHALL be ordered by the command ordering used for command export and command movement.
+The export manager MUST NOT expose separate mode-filtered collections for not-yet-exported commands and exported commands.
+
+#### Scenario: Active command list includes undefined and exported states
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` at or after the baseline has replay state `UNDEFINED`
+- **AND** command `B` at or after the baseline has replay state `EXPORTED`
+- **WHEN** the user views the export manager commands collection
+- **THEN** command `A` is included
+- **AND** command `B` is included
+
+#### Scenario: Excluded command is removed from active command list
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` at or after the baseline has replay state `EXCLUDED`
+- **WHEN** the user views the export manager commands collection
+- **THEN** command `A` is not included
+
+#### Scenario: Commands before baseline are excluded
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` is before the baseline
+- **AND** command `B` is at or after the baseline
+- **WHEN** the user views the export manager commands collection
+- **THEN** command `A` is not included
+- **AND** command `B` is included
+
+## ADDED Requirements
+
+### Requirement: Export manager shows excluded commands separately
+The export manager SHALL expose a collection named `excludedCommands` below the `commands` collection.
+The `excludedCommands` collection SHALL contain foreground command log entries at or after the export manager baseline whose replay state is `EXCLUDED`.
+The `excludedCommands` collection MUST exclude command log entries whose replay state is not `EXCLUDED`.
+The `excludedCommands` collection SHALL be ordered by the same command ordering used for the active `commands` collection.
+Excluded commands MUST NOT appear in both `commands` and `excludedCommands` at the same time.
+
+#### Scenario: Excluded command appears in excluded commands collection
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` at or after the baseline has replay state `EXCLUDED`
+- **WHEN** the user views the export manager excluded commands collection
+- **THEN** command `A` is included
+- **AND** command `A` is not included in the active commands collection
+
+#### Scenario: Active commands do not appear in excluded commands collection
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` at or after the baseline has replay state `UNDEFINED`
+- **AND** command `B` at or after the baseline has replay state `EXPORTED`
+- **WHEN** the user views the export manager excluded commands collection
+- **THEN** command `A` is not included
+- **AND** command `B` is not included
+
+#### Scenario: Excluded commands before baseline are omitted
+- **GIVEN** an export manager baseline is set
+- **AND** command `A` before the baseline has replay state `EXCLUDED`
+- **AND** command `B` at or after the baseline has replay state `EXCLUDED`
+- **WHEN** the user views the export manager excluded commands collection
+- **THEN** command `A` is not included
+- **AND** command `B` is included
diff --git a/openspec/changes/exclude-recorded-commands/tasks.md b/openspec/changes/exclude-recorded-commands/tasks.md
new file mode 100644
index 00000000000..b31f925cc0b
--- /dev/null
+++ b/openspec/changes/exclude-recorded-commands/tasks.md
@@ -0,0 +1,37 @@
+## 1. Collection Filtering
+
+- [ ] 1.1 Update `CommandExportManager#getCommands()` so it returns only baseline-bounded foreground commands whose replay state is `UNDEFINED` or `EXPORTED`.
+- [ ] 1.2 Add `CommandExportManager#getExcludedCommands()` for baseline-bounded foreground commands whose replay state is `EXCLUDED`.
+- [ ] 1.3 Place `excludedCommands` below `commands` in the export manager layout metadata.
+- [ ] 1.4 Ensure exportability and known-participant traversal use the active command sequence so excluded commands are not considered part of the export sequence.
+
+## 2. Exclude Commands Action
+
+- [ ] 2.1 Add a `CommandExportManager_excludeCommands` mixin associated with the `commands` collection.
+- [ ] 2.2 Implement the action to accept one or more selected active `ReplayableCommand` rows and set their backing command log entries to replay state `EXCLUDED`.
+- [ ] 2.3 Add a default for the selected commands parameter that auto-selects active commands whose exportability is explicitly `false`.
+- [ ] 2.4 Ensure selected-command defaults omit commands whose exportability is `true` or `null`.
+- [ ] 2.5 Validate that at least one command is selected.
+- [ ] 2.6 Validate that every selected command is currently present in the active `commands` collection before changing replay state.
+- [ ] 2.7 Disable and guard the action when command-log recording support is disabled.
+- [ ] 2.8 Register the new mixin in `CausewayModuleExtCommandLogApplib` if explicit registration is required.
+
+## 3. Existing Actions and Choices
+
+- [ ] 3.1 Confirm `CommandExportManager_exportSelected` choices come only from the filtered active `commands` collection.
+- [ ] 3.2 Confirm `CommandExportManager_moveCommands` choices and validation reject excluded commands because they are outside the active `commands` collection.
+- [ ] 3.3 Update action descriptions or labels if needed so users understand excluded commands are omitted from export and movement.
+
+## 4. Tests
+
+- [ ] 4.1 Update `CommandExportManagerCommandsTest` to verify `commands` includes `UNDEFINED` and `EXPORTED` commands and omits `EXCLUDED` commands.
+- [ ] 4.2 Add tests that `excludedCommands` includes only baseline-bounded `EXCLUDED` commands.
+- [ ] 4.3 Add tests for `CommandExportManager_excludeCommands` successful state transitions, empty selection validation, and stale/outside-selection validation.
+- [ ] 4.4 Add tests that selected-command defaults include non-exportable active commands and omit exportable or unknown-exportability commands.
+- [ ] 4.5 Add tests that exclusion is disabled and direct invocation is guarded when command-log recording support is disabled.
+- [ ] 4.6 Update `CommandExportManagerMoveCommandsTest` if needed to assert excluded commands are not offered as targets and cannot be moved by direct invocation.
+
+## 5. Verification
+
+- [ ] 5.1 Run focused command-log applib tests for command export manager collections, exclusion, export selected, and move commands.
+- [ ] 5.2 Run `openspec status --change exclude-recorded-commands` and resolve any artifact or spec validation issues.