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:53 UTC
(causeway) 16/25: CAUSEWAY-4031: proposes replayable command navigation improvements
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 4d54d08babbcdf3750ad5f5354b78c7467e41685
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Jun 8 13:52:00 2026 +0100
CAUSEWAY-4031: proposes replayable command navigation improvements
---
.../.openspec.yaml | 2 +
.../design.md | 63 ++++++++++++++++++
.../proposal.md | 29 +++++++++
.../specs/replayable-command-exportability/spec.md | 17 +++++
.../specs/replayable-command-navigation/spec.md | 47 ++++++++++++++
.../spec.md | 74 ++++++++++++++++++++++
.../replayable-command-result-presence/spec.md | 39 ++++++++++++
.../improve-replayable-command-navigation/tasks.md | 25 ++++++++
8 files changed, 296 insertions(+)
diff --git a/openspec/changes/improve-replayable-command-navigation/.openspec.yaml b/openspec/changes/improve-replayable-command-navigation/.openspec.yaml
new file mode 100644
index 00000000000..e8d4ccfe905
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/.openspec.yaml
@@ -0,0 +1,2 @@
+schema: spec-driven
+created: 2026-06-08
diff --git a/openspec/changes/improve-replayable-command-navigation/design.md b/openspec/changes/improve-replayable-command-navigation/design.md
new file mode 100644
index 00000000000..6b1b149841c
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/design.md
@@ -0,0 +1,63 @@
+## Context
+
+`ReplayableCommand` is a view model wrapper around `CommandLogEntry` and derives properties, participants, and row actions from the wrapped command record.
+`ReplayableCommandParticipant` currently resolves target, argument, and result objects through an `actualBookmark` calculated by `ReplayableCommand`.
+That calculation primarily reflects replay remapping and replay success, which is too restrictive for recorded or exported commands that still have valid recorded bookmarks.
+
+Command export review also depends on scanning an ordered command list.
+Users can move and export commands from manager screens, but there is no direct row-level way to step to adjacent command records.
+
+## Goals / Non-Goals
+
+**Goals:**
+- Preserve replay-state safety for replay execution while improving read-only navigation and participant inspection.
+- Resolve domain service targets from recorded bookmarks independent of replay state.
+- Resolve target and reference argument participants from recorded bookmarks while the command is a recorded/exported command with replay state `UNDEFINED` or `EXPORTED`.
+- Add `previous` and `next` actions that navigate between adjacent command log entries in the command ordering used by replayable command lists.
+- Add a non-persisted `hasResult` property and place it before exportability in tables.
+
+**Non-Goals:**
+- Do not change replay-or-retry enablement rules.
+- Do not change export validation rules or exportability semantics.
+- Do not persist new participant, navigation, or result-presence state.
+- Do not introduce a new command-log table or external dependency.
+
+## Decisions
+
+1. Resolve record-state participants from recorded bookmarks when replay mapping is not applicable.
+Alternative considered: keep using only replay mappings and successful replay state.
+That would continue hiding valid recorded targets and arguments during record/export review, so it does not satisfy the change.
+
+2. Treat domain service target bookmarks as stable roots for participant lookup in every replay state.
+Alternative considered: special-case only `UNDEFINED` and `EXPORTED`.
+Domain services are valid stable targets for both replay and record states, so the broader rule is simpler and consistent with export-root behavior.
+
+3. Keep result participant resolution tied to successful replay mappings or stored results, while exposing result presence separately through `hasResult`.
+Alternative considered: use `hasResult` to make result objects navigable in every state.
+A stored result bookmark indicates presence, but object availability can still depend on local lookup and replay mapping, so presence and navigation should remain separate concepts.
+
+4. Implement `previous` and `next` as row actions on `ReplayableCommand` that locate adjacent `CommandLogEntry` records through repository/query support in the same ordering already used for command lists.
+Alternative considered: make navigation a collection action on `CommandExportManager`.
+Row actions work from both command-detail and table contexts and do not couple navigation to one manager view.
+
+5. Implement `hasResult` as a derived Boolean property on `ReplayableCommand` based on the wrapped `CommandLogEntry#getResult()` value.
+Alternative considered: infer result presence from the participant collection.
+Using the command log entry directly avoids constructing participants merely to render a table column.
+
+## Risks / Trade-offs
+
+- [Risk] Adjacent-command lookup could accidentally use a different ordering than command list rendering.
+ → Mitigation: centralize or reuse the existing command ordering comparator/query and cover boundary scenarios in tests.
+- [Risk] Looking up recorded bookmarks in more replay states could expose stale local objects.
+ → Mitigation: make properties optional and return `null` when bookmark lookup fails, while leaving recorded bookmark values visible.
+- [Risk] Table column ordering could vary by framework metadata conventions.
+ → Mitigation: set explicit `@PropertyLayout(sequence = ...)` values so `hasResult` precedes `exportable`.
+
+## Migration Plan
+
+No data migration is required because all new behavior is derived from existing command DTO, replay state, and result bookmark data.
+Rollback consists of removing the new derived property and row actions and restoring the previous participant actual-bookmark resolution conditions.
+
+## Open Questions
+
+None.
diff --git a/openspec/changes/improve-replayable-command-navigation/proposal.md b/openspec/changes/improve-replayable-command-navigation/proposal.md
new file mode 100644
index 00000000000..08a72575512
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/proposal.md
@@ -0,0 +1,29 @@
+## Why
+
+Replayable command records currently hide useful recorded participants in some states even though targets and arguments remain meaningful while reviewing recorded or exported commands.
+Users also need faster row-by-row navigation and clearer table feedback about which commands produced a result.
+
+## What Changes
+
+- Make replayable command participant target and argument links available for recorded commands whose replay state is `UNDEFINED` or `EXPORTED`.
+- Keep target links available for participants whose recorded target is a domain service, regardless of replay state.
+- Add `previous` and `next` row actions on `ReplayableCommand` to navigate through the current command log ordering.
+- Disable `previous` at the first command and `next` at the last command.
+- Add a boolean `hasResult` property on `ReplayableCommand` that indicates whether the wrapped command log entry stores a result bookmark.
+- Show `hasResult` in replayable command tables before the existing exportability indicator.
+
+## Capabilities
+
+### New Capabilities
+- `replayable-command-participant-availability`: Defines when replayable command participant target and argument objects are available from recorded command data.
+- `replayable-command-navigation`: Defines row-level previous and next navigation for replayable commands.
+- `replayable-command-result-presence`: Defines result-presence reporting for replayable commands and its table placement.
+
+### Modified Capabilities
+- `replayable-command-exportability`: Updates table-column ordering expectations so result presence appears before exportability.
+
+## Impact
+
+- Affects the command-log replay view models in `extensions/core/commandlog/applib`.
+- Affects UI metadata for `ReplayableCommand` and `ReplayableCommandParticipant` properties and actions.
+- May require tests around participant lookup, command navigation boundaries, result presence, and table property ordering.
diff --git a/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-exportability/spec.md b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-exportability/spec.md
new file mode 100644
index 00000000000..0565821d228
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-exportability/spec.md
@@ -0,0 +1,17 @@
+## ADDED Requirements
+
+### Requirement: Exportability appears after result presence in replayable command tables
+When a replayable command table displays both result presence and exportability, the exportability property SHALL appear after `hasResult`.
+This ordering requirement MUST NOT change the exportability property's value.
+This ordering requirement MUST NOT make exportability visible in object forms where it is hidden.
+
+#### Scenario: Exportability follows result presence in table layout
+- **GIVEN** a replayable command has a `hasResult` property
+- **AND** exportability is available in the current table context
+- **WHEN** the table columns are ordered
+- **THEN** the exportability column appears after the `hasResult` column
+
+#### Scenario: Exportability value is unchanged by column ordering
+- **GIVEN** a replayable command has exportability `true`
+- **WHEN** the table columns are ordered with `hasResult` before exportability
+- **THEN** the exportability property remains `true`
diff --git a/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-navigation/spec.md b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-navigation/spec.md
new file mode 100644
index 00000000000..15f0e54bd98
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-navigation/spec.md
@@ -0,0 +1,47 @@
+## ADDED Requirements
+
+### Requirement: Replayable command exposes adjacent navigation actions
+A replayable command SHALL expose a `previous` action that returns the adjacent earlier command log entry as a `ReplayableCommand`.
+A replayable command SHALL expose a `next` action that returns the adjacent later command log entry as a `ReplayableCommand`.
+The adjacent earlier and later commands SHALL be determined by the command log ordering used for replayable command lists.
+The navigation actions MUST NOT mutate command log entries.
+The navigation actions MUST preserve the replay context used by the current replayable command.
+
+#### Scenario: Navigate to previous command
+- **GIVEN** command `A` appears immediately before command `B` in command log ordering
+- **AND** the user is viewing replayable command `B`
+- **WHEN** the user invokes `previous`
+- **THEN** the system returns replayable command `A`
+
+#### Scenario: Navigate to next command
+- **GIVEN** command `B` appears immediately before command `C` in command log ordering
+- **AND** the user is viewing replayable command `B`
+- **WHEN** the user invokes `next`
+- **THEN** the system returns replayable command `C`
+
+#### Scenario: Navigation preserves replay context
+- **GIVEN** the user is viewing a replayable command with a replay context
+- **AND** an adjacent command exists
+- **WHEN** the user invokes `next`
+- **THEN** the returned replayable command uses the same replay context
+
+### Requirement: Replayable command disables navigation at list boundaries
+The `previous` action MUST be disabled when no earlier command exists in command log ordering.
+The `next` action MUST be disabled when no later command exists in command log ordering.
+Boundary disablement MUST be calculated without mutating command log entries.
+
+#### Scenario: First command has no previous action
+- **GIVEN** command `A` is the first command in command log ordering
+- **WHEN** the framework evaluates the `previous` action for replayable command `A`
+- **THEN** the `previous` action is disabled
+
+#### Scenario: Last command has no next action
+- **GIVEN** command `Z` is the last command in command log ordering
+- **WHEN** the framework evaluates the `next` action for replayable command `Z`
+- **THEN** the `next` action is disabled
+
+#### Scenario: Middle command can navigate both directions
+- **GIVEN** command `B` has an earlier command and a later command in command log ordering
+- **WHEN** the framework evaluates navigation actions for replayable command `B`
+- **THEN** the `previous` action is enabled
+- **AND** the `next` action is enabled
diff --git a/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-participant-availability/spec.md b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-participant-availability/spec.md
new file mode 100644
index 00000000000..1fe27b220e4
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-participant-availability/spec.md
@@ -0,0 +1,74 @@
+## ADDED Requirements
+
+### Requirement: Recorded command target participants are available for record review
+A replayable command participant with role `TARGET` SHALL expose its target object when the owning command's replay state is `UNDEFINED` and the recorded target bookmark resolves locally.
+A replayable command participant with role `TARGET` SHALL expose its target object when the owning command's replay state is `EXPORTED` and the recorded target bookmark resolves locally.
+A replayable command participant with role `TARGET` MUST remain optional and SHALL expose no target object when the applicable bookmark cannot be resolved locally.
+This target availability MUST NOT change the command replay state.
+
+#### Scenario: Undefined command target is available
+- **GIVEN** a replayable command has replay state `UNDEFINED`
+- **AND** its target participant has recorded bookmark `demoCustomer:1`
+- **AND** bookmark `demoCustomer:1` resolves locally
+- **WHEN** the system reads the participant target property
+- **THEN** the target object for `demoCustomer:1` is returned
+
+#### Scenario: Exported command target is available
+- **GIVEN** a replayable command has replay state `EXPORTED`
+- **AND** its target participant has recorded bookmark `demoCustomer:1`
+- **AND** bookmark `demoCustomer:1` resolves locally
+- **WHEN** the system reads the participant target property
+- **THEN** the target object for `demoCustomer:1` is returned
+
+#### Scenario: Unresolvable recorded target remains absent
+- **GIVEN** a replayable command has replay state `UNDEFINED`
+- **AND** its target participant has recorded bookmark `demoCustomer:1`
+- **AND** bookmark `demoCustomer:1` does not resolve locally
+- **WHEN** the system reads the participant target property
+- **THEN** no target object is returned
+
+### Requirement: Domain service target participants are available in every replay state
+A replayable command participant with role `TARGET` SHALL expose its target object when the recorded target bookmark identifies a domain service and resolves locally.
+This rule SHALL apply regardless of the owning command's replay state.
+This rule MUST NOT enable replay or export by itself.
+
+#### Scenario: Domain service target is available for pending replay
+- **GIVEN** a replayable command has replay state `PENDING`
+- **AND** its target participant has a recorded bookmark for a domain service
+- **AND** that domain service bookmark resolves locally
+- **WHEN** the system reads the participant target property
+- **THEN** the domain service target object is returned
+
+#### Scenario: Domain service target is available for failed replay
+- **GIVEN** a replayable command has replay state `FAILED`
+- **AND** its target participant has a recorded bookmark for a domain service
+- **AND** that domain service bookmark resolves locally
+- **WHEN** the system reads the participant target property
+- **THEN** the domain service target object is returned
+
+### Requirement: Recorded command reference arguments are available for record review
+A replayable command participant with role `PARAMETER` SHALL expose its argument object when the owning command's replay state is `UNDEFINED` and the recorded reference-parameter bookmark resolves locally.
+A replayable command participant with role `PARAMETER` SHALL expose its argument object when the owning command's replay state is `EXPORTED` and the recorded reference-parameter bookmark resolves locally.
+A replayable command participant with role `PARAMETER` MUST remain optional and SHALL expose no argument object when the applicable bookmark cannot be resolved locally.
+This argument availability MUST NOT change the command replay state.
+
+#### Scenario: Undefined command reference argument is available
+- **GIVEN** a replayable command has replay state `UNDEFINED`
+- **AND** its parameter participant is named `customer`
+- **AND** the participant recorded bookmark `demoCustomer:1` resolves locally
+- **WHEN** the system reads the participant argument property
+- **THEN** the argument object for `demoCustomer:1` is returned
+
+#### Scenario: Exported command reference argument is available
+- **GIVEN** a replayable command has replay state `EXPORTED`
+- **AND** its parameter participant is named `customer`
+- **AND** the participant recorded bookmark `demoCustomer:1` resolves locally
+- **WHEN** the system reads the participant argument property
+- **THEN** the argument object for `demoCustomer:1` is returned
+
+#### Scenario: Unresolvable recorded argument remains absent
+- **GIVEN** a replayable command has replay state `EXPORTED`
+- **AND** its parameter participant is named `customer`
+- **AND** the participant recorded bookmark `demoCustomer:1` does not resolve locally
+- **WHEN** the system reads the participant argument property
+- **THEN** no argument object is returned
diff --git a/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-result-presence/spec.md b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-result-presence/spec.md
new file mode 100644
index 00000000000..8d97ba0746f
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/specs/replayable-command-result-presence/spec.md
@@ -0,0 +1,39 @@
+## ADDED Requirements
+
+### Requirement: Replayable command reports result presence
+A replayable command SHALL expose a non-persisted Boolean property named `hasResult`.
+The `hasResult` property SHALL be `true` when the wrapped command log entry stores a non-null result bookmark.
+The `hasResult` property SHALL be `false` when the wrapped command log entry has no stored result bookmark.
+The `hasResult` property MUST NOT perform bookmark lookup to determine whether the result object currently resolves locally.
+The `hasResult` property MUST NOT change the command replay state.
+
+#### Scenario: Command with stored result reports true
+- **GIVEN** a replayable command wraps a command log entry with result bookmark `demoCustomer:1`
+- **WHEN** the system reads the `hasResult` property
+- **THEN** the property is `true`
+
+#### Scenario: Command without stored result reports false
+- **GIVEN** a replayable command wraps a command log entry with no result bookmark
+- **WHEN** the system reads the `hasResult` property
+- **THEN** the property is `false`
+
+#### Scenario: Result presence does not require local result object
+- **GIVEN** a replayable command wraps a command log entry with result bookmark `demoCustomer:1`
+- **AND** bookmark `demoCustomer:1` does not resolve locally
+- **WHEN** the system reads the `hasResult` property
+- **THEN** the property is `true`
+
+### Requirement: Result presence is visible before exportability in tables
+The replayable command table layout SHALL display `hasResult` before the exportability property.
+The `hasResult` table placement SHALL apply when the exportability property is available.
+The `hasResult` table placement SHALL apply when the exportability property is hidden or null.
+
+#### Scenario: Result presence precedes exportability in export manager table
+- **GIVEN** a replayable command is rendered in the command export manager commands table
+- **WHEN** the table columns are ordered
+- **THEN** the `hasResult` column appears before the exportability column
+
+#### Scenario: Result presence remains visible outside export manager context
+- **GIVEN** a replayable command is rendered outside command export manager context
+- **WHEN** the table columns are ordered
+- **THEN** the `hasResult` column remains eligible for display
diff --git a/openspec/changes/improve-replayable-command-navigation/tasks.md b/openspec/changes/improve-replayable-command-navigation/tasks.md
new file mode 100644
index 00000000000..97f02f4c27c
--- /dev/null
+++ b/openspec/changes/improve-replayable-command-navigation/tasks.md
@@ -0,0 +1,25 @@
+## 1. Participant Availability
+
+- [ ] 1.1 Add participant-resolution tests for `UNDEFINED` target and reference-argument availability from recorded bookmarks.
+- [ ] 1.2 Add participant-resolution tests for `EXPORTED` target and reference-argument availability from recorded bookmarks.
+- [ ] 1.3 Add participant-resolution tests proving domain service targets are available regardless of replay state.
+- [ ] 1.4 Update `ReplayableCommand` and `ReplayableCommandParticipant` bookmark resolution so the new availability rules pass without changing replay state.
+
+## 2. Command Navigation
+
+- [ ] 2.1 Identify or add repository/query support to find adjacent `CommandLogEntry` records using the replayable command list ordering.
+- [ ] 2.2 Add `previous` and `next` actions to `ReplayableCommand` that return adjacent `ReplayableCommand` instances with the same replay context.
+- [ ] 2.3 Add disable methods for the first-command and last-command navigation boundaries.
+- [ ] 2.4 Add tests for previous, next, boundary disablement, and non-mutating navigation behavior.
+
+## 3. Result Presence and Table Layout
+
+- [ ] 3.1 Add a derived Boolean `hasResult` property to `ReplayableCommand` based on `CommandLogEntry#getResult()`.
+- [ ] 3.2 Set property layout metadata so `hasResult` appears in tables before exportability.
+- [ ] 3.3 Add tests or metadata assertions for `hasResult` true, `hasResult` false, unresolved-result behavior, and column ordering relative to exportability.
+
+## 4. Verification
+
+- [ ] 4.1 Run the focused command-log applib tests for replayable command participant, navigation, result-presence, and exportability behavior.
+- [ ] 4.2 Run the relevant Maven module test suite or project validation command used for command-log extension changes.
+- [ ] 4.3 Run `openspec status --change improve-replayable-command-navigation` and confirm the change remains apply-ready.