Skip to content

[Fix #1738] Replace setMetadata by fine grain manipulation. - #1742

Merged
fjtirado merged 2 commits into
open-workflow-specification:mainfrom
fjtirado:Fix_#1738
Oct 5, 2026
Merged

fjtirado merged 2 commits into
open-workflow-specification:mainfrom
fjtirado:Fix_#1738

Conversation

@fjtirado

@fjtirado fjtirado commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Fix #1738

…ain manipulation.

Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 15:39
@fjtirado
fjtirado requested a review from gmunozfe October 5, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Metadata restoration still has correctness regressions, and the public API changes break compatibility.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)
What changed in this PR

Addresses #1738 by merging restored task metadata instead of replacing the workflow’s metadata map.

Changes:

  • Applies metadata entries through a shared persistence-task accessor.
  • Removes setMetadata() and exposes the backing map to subclasses.
File Description
impl/​persistence/​api/​src/​main/​java/​io/​serverlessworkflow/​impl/​persistence/​WorkflowPersistenceInstance.java Changes metadata initialization and task restoration.
impl/​persistence/​api/​src/​main/​java/​io/​serverlessworkflow/​impl/​persistence/​RetriedTaskInfo.java Renames metadata to additionalObjects.
impl/​persistence/​api/​src/​main/​java/​io/​serverlessworkflow/​impl/​persistence/​PersistenceTaskInfo.java Adds the shared metadata accessor.
impl/​core/​src/​main/​java/​io/​serverlessworkflow/​impl/​WorkflowMutableInstance.java Exposes the backing map and removes the replacement setter.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@gmunozfe gmunozfe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me, fantastic replacement @fjtirado !

Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Metadata restoration still has unresolved deletion-handling and concurrency issues.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (4)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Reconcile deleted metadata during snapshot restoration

impl/​persistence/​api/​src/​main/​java/​io/​serverlessworkflow/​impl/​persistence/​WorkflowPersistenceInstance.java:109

BytesMapInstanceTransaction.writeMetadata stores a complete durable-metadata snapshot, not a delta. If a key was removed after the workflow-start snapshot, the constructor reloads its old value and this merge leaves it present because the task snapshot omits it. Resuming therefore resurrects deleted metadata. Reconcile previously persisted keys that are absent from the task snapshot, while preserving transient metadata and keys protected during the current execution.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Restoration can still discard live metadata, undo explicit removals, and retain stale values.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Persisted-state reconciliation lacks regression coverage for nested restoration, leaving its safety insufficiently verified.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Concurrent restoration and metadata ownership changes need human validation before approval.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings October 5, 2026 20:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The restored metadata map is no longer thread-safe, allowing concurrent updates to fail persistence snapshotting.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
Resolved since last review (1)

…riding keys set by user

Signed-off-by: Francisco Javier Tirado Sarti <ftirados@ibm.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 21:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Metadata preservation and deletion during recovery lack focused regression coverage and need human validation.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
Resolved since last review (1)

@fjtirado
fjtirado merged commit 45b5391 into open-workflow-specification:main Oct 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Metadata is getting overwriten when a workflow is restored from a persistence state

4 participants