Skip to content

Fix execution log order and move waiting states#91

Merged
philippfromme merged 11 commits intomainfrom
order
Mar 30, 2026
Merged

Fix execution log order and move waiting states#91
philippfromme merged 11 commits intomainfrom
order

Conversation

@philippfromme
Copy link
Copy Markdown
Contributor

@philippfromme philippfromme commented Mar 26, 2026

Proposed Changes

  • fix execution log order by using causal ordering for state entries and related entries with same timestamp
  • move waiting states out of log so they are always visible when existing

Example: Execution log order

  • deployed and instance started always come first
  • element instance created comes before any of the work (e.g. job) is created
  • work completed comes before element instance completed
  • start execution listener job comes before regular job and so on
  • finished state always comes last
image

Example: Waiting state always visible and includes identifier (Form)

image

Related to #81 (comment)

Checklist

Ensure you provide everything we need to review your contribution:

  • Your contribution meets the definition of done
  • Any new additions or modifications are consistent with the existing UI and UX patterns
  • Pull request description establishes context:
    • Link to related issue(s), i.e. Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}
    • Brief textual description of the changes
    • Screenshots or short videos showing UI/UX changes
    • Steps to try out, i.e. using the @bpmn-io/sr tool

@bpmn-io-tasks bpmn-io-tasks Bot added the in progress Currently worked on label Mar 26, 2026
@philippfromme philippfromme force-pushed the order branch 3 times, most recently from eccae4a to 2b87ebc Compare March 26, 2026 10:43
@philippfromme philippfromme marked this pull request as ready for review March 26, 2026 12:55
@bpmn-io-tasks bpmn-io-tasks Bot added needs review Review pending and removed in progress Currently worked on labels Mar 26, 2026
Comment thread lib/ExecutionLog.js Outdated
@philippfromme philippfromme force-pushed the order branch 3 times, most recently from 0110486 to 13e79e7 Compare March 28, 2026 13:08
@philippfromme philippfromme marked this pull request as draft March 30, 2026 08:15
@bpmn-io-tasks bpmn-io-tasks Bot added in progress Currently worked on and removed needs review Review pending labels Mar 30, 2026
Sort log entries not only by timestamp but also by causal priority
when timestamps are equal. This ensures entries appear in a logically
correct sequence even when the engine produces identical timestamps
for related lifecycle events.

Causal ordering is always applied for global status entries and only
between related entries (same elementId or identity key) for runtime
entries, preserving insertion order for unrelated entries.
Reverts #88 which was a fix for only one of the ordering issues.
Adds call activity to example
Introduce an `ENTRY_ORDER` enum to replace bare numeric literals (0–10) in `getEntryOrder`, making the causal ordering of execution log entries self-documenting.
@philippfromme philippfromme changed the title Improve ordering of log entries Fix execution log order and always show waiting states Mar 30, 2026
@philippfromme philippfromme requested a review from Copilot March 30, 2026 10:59

This comment was marked as outdated.

@philippfromme philippfromme requested a review from Copilot March 30, 2026 11:19
@philippfromme philippfromme changed the title Fix execution log order and always show waiting states Fix execution log order and move waiting states Mar 30, 2026

This comment was marked as outdated.

@philippfromme philippfromme marked this pull request as ready for review March 30, 2026 11:35
@bpmn-io-tasks bpmn-io-tasks Bot added needs review Review pending and removed in progress Currently worked on labels Mar 30, 2026
@philippfromme philippfromme requested review from Buckwich and nikku March 30, 2026 11:49
@philippfromme
Copy link
Copy Markdown
Contributor Author

Ready for final review.

Comment thread lib/ExecutionLog.js Outdated
// order.
this._entries = entries
.map((entry, index) => /** @type {[number, ExecutionLogEntry]} */ ([ index, entry ]))
.sort(([ indexA, entryA ], [ indexB, entryB ]) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could be a bit simpler. not sure whats better readable:

Suggested change
.sort(([ indexA, entryA ], [ indexB, entryB ]) => {
.sort(([ indexA, entryA ], [ indexB, entryB ]) => {
if (isStatusEntry(entryA) || isStatusEntry(entryB)) {
return compareEntryOrders(entryA, entryB);
}
return compareEntryTimestamps(entryA, entryB)
|| (areEntriesRelated(entryA, entryB) ? compareEntryOrders(entryA, entryB) : 0)
|| indexA - indexB;
})

@philippfromme philippfromme merged commit ec64b38 into main Mar 30, 2026
5 checks passed
@philippfromme philippfromme deleted the order branch March 30, 2026 17:31
@bpmn-io-tasks bpmn-io-tasks Bot removed the needs review Review pending label Mar 30, 2026
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.

4 participants