Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
aee90c0
WIP
tegan-temporal Nov 3, 2026
cc5b3ef
Route execution chains by first run ID
tegan-temporal Nov 4, 2026
0bb7eda
Refactor activity controls across workflow views
tegan-temporal Nov 5, 2026
29ddd1b
Propagate workflow identity through event views
tegan-temporal Nov 5, 2026
90bd75f
Centralize workflow history management
tegan-temporal Nov 5, 2026
8e5ef2c
Propagate history through workflow views
tegan-temporal Nov 5, 2026
92fbb96
Remove workflow execution chain support
tegan-temporal Nov 5, 2026
de5b410
Add workflow run detail integration tests
tegan-temporal Nov 5, 2026
2be10f3
Isolate workflow history by run
tegan-temporal Nov 5, 2026
6ac63ab
Improve workflow history error handling
tegan-temporal Nov 5, 2026
4e2634e
Support live workflow event detail updates
tegan-temporal Nov 5, 2026
7cc1ec8
Make workflow history state controller-owned
tegan-temporal Nov 5, 2026
9a60482
Move live poll cursor handling to callback
tegan-temporal Nov 5, 2026
efeb7b7
Fix history pagination and isolate loading failures
tegan-temporal Nov 5, 2026
69b9a54
Remove obsolete history graph components
tegan-temporal Nov 6, 2026
a29ffa4
Merge branch 'main' into tegan/fe-1484-implement-chain-overview-page
tegan-temporal Nov 6, 2026
0ed6a4c
consolidate some testing
tegan-temporal Nov 6, 2026
5212cd8
Merge remote-tracking branch 'origin/main' into tegan/fe-1484-impleme…
tegan-temporal Nov 9, 2026
30eaac5
Merge remote-tracking branch 'origin/main' into tegan/fe-1484-impleme…
tegan-temporal Nov 13, 2026
a906e37
Merge remote-tracking branch 'origin/main' into tegan/fe-1484-impleme…
tegan-temporal Nov 16, 2026
7150453
Address review feedback on history loading
tegan-temporal Nov 16, 2026
b0c6f1d
Show SDK info in standalone activity workers
tegan-temporal Nov 16, 2026
37ff107
Fix history integration tests after review feedback
tegan-temporal Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions docs/timeline-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## Core Principle: Events Are Canonical, Groups Are Derived

All event data lives in a **single module-level singleton** (`grouped-event-buffer.ts`).
Events are stored once, in a flat array indexed by `eventId - 1`. Groups are not
stored at all — they are described by lightweight records and built on demand.
Each `WorkflowHistoryController` owns a **buffer instance** created by
`createGroupedEventBuffer()` (`grouped-event-buffer.ts`) and an `EventBufferView`
exposed as `history`. Events are stored once, in a flat array indexed by
`eventId - 1`. Groups are not stored at all — they are described by lightweight
records and built on demand.

The flat array works because Temporal event IDs are a gapless sequence from 1, so
the ID _is_ the position. That buys more than storage: a follower references its
Expand All @@ -17,7 +19,7 @@ skips empty slots — costing memory rather than correctness.
flowchart LR
API["Bidirectional fetch<br/>+ live poll"] -->|ingestHistoryEvent| BUF

subgraph BUF["grouped-event-buffer.ts (singleton, plain TS)"]
subgraph BUF["grouped-event-buffer.ts (controller-owned instance, plain TS)"]
direction TB
EV["events[]<br/>slot = eventId - 1, one copy"]
HG["headGroup: Int32Array<br/>head slot → record"]
Expand All @@ -29,7 +31,7 @@ flowchart LR
BUF -->|getEventArray| FLAT["Flat event consumers"]

BUF -->|onChange| FACADE["grouped-event-buffer.svelte.ts"]
FACADE -->|eventBuffer.*| VIEW
FACADE -->|controller.history.*| VIEW
```

### Key tenets
Expand Down Expand Up @@ -113,15 +115,16 @@ flowchart TD
W["ingestHistoryEvent / setPendingMetadata / reset"] -->|notifyChanged| OC["onChange listeners"]
OC --> FV["EventBufferView.scheduleUpdate()"]
FV -->|coalesce onto a microtask| VER["_version++ ($state)"]
VER --> D1["eventBuffer.lazyGroupsWithoutWorkflowTasks"]
VER --> D2["eventBuffer.events"]
VER --> D3["bufferVersion store (legacy derived stores)"]
VER --> D1["history.lazyGroupsWithoutWorkflowTasks"]
VER --> D2["history.events"]
VER --> D3["history.event(id) / history.eventGroup(id, opts)"]
```

Consumers read a value:

```svelte
const lazyGroups = $derived(eventBuffer.lazyGroupsWithoutWorkflowTasks);
const lazyGroups =
$derived(historyController.history.lazyGroupsWithoutWorkflowTasks);
```

No subscribe / throttle / re-read effect at the call site, and **producers never
Expand All @@ -133,8 +136,13 @@ announce their own writes** — the buffer reports them.
leave a run opened in a background tab with an empty history until focused.
- **`reset` propagates immediately** rather than coalescing, so navigating between
runs cannot leave the previous run's groups on screen for a tick.
- **`bufferVersion`** survives as a store mirror of `eventBuffer.version`, for the
pre-runes `derived()` stores in `$lib/stores/events`. Prefer `eventBuffer` in new code.
- **`_version` is private to the view**, with no public version getter or store
mirror. Reactive reads use the controller's `history` surface; disposing the
view unsubscribes it and prevents queued microtasks from updating it.
- **`history.event(id)` and `history.eventGroup(id, opts)` use indexed lookups**
through the buffer's `getEvent` and `getEventGroup`, without flattening events
or listing every group. Both track `_version`; group lookups materialize only
the matching group and retain per-group version memoization.

### The identity invariant

Expand Down
128 changes: 128 additions & 0 deletions src/lib/components/activity/activity-command-controls.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<script lang="ts">
import Button from '$lib/holocene/button.svelte';
import Tooltip from '$lib/holocene/tooltip.svelte';
import { translate } from '$lib/i18n/translate';
import {
IconPause,
IconPencil,
IconPlaySolid,
IconRetry,
} from '$lib/io/icon';
import type { ActivityOptions } from '$lib/types';
import type { PendingActivity } from '$lib/types/events';

import ActivityOptionsForm from './activity-options-form.svelte';
import ActivityPauseConfirmationModal from './activity-pause-confirmation-modal.svelte';
import ActivityResetConfirmationModal from './activity-reset-confirmation-modal.svelte';
import ActivityUnpauseConfirmationModal from './activity-unpause-confirmation-modal.svelte';

type Props = {
activity: PendingActivity;
class?: string;
onPause: (reason: string) => Promise<void>;
onUnpause: () => Promise<void>;
onReset: (resetHeartbeat: boolean) => Promise<void>;
onUpdateOptions: (options: ActivityOptions) => Promise<void>;
};

let {
activity,
class: className = '',
onPause,
onUnpause,
onReset,
onUpdateOptions,
}: Props = $props();

let pauseConfirmationModalOpen = $state(false);
let unpauseConfirmationModalOpen = $state(false);
let resetConfirmationModalOpen = $state(false);
let optionsUpdateDrawerOpen = $state(false);

const openPauseConfirmation = () => {
if (activity.paused) {
unpauseConfirmationModalOpen = true;
} else {
pauseConfirmationModalOpen = true;
}
};

const openResetConfirmation = () => {
resetConfirmationModalOpen = true;
};

const openOptionsDrawer = () => {
optionsUpdateDrawerOpen = true;
};
</script>

<div class="flex items-center gap-2 {className}">
<Tooltip
bottomLeft
width={200}
text={activity.paused
? translate('activities.resume-tooltip')
: translate('activities.pause-tooltip')}
>
<Button
variant="secondary"
size="sm"
LeadingIcon={activity.paused ? IconPlaySolid : IconPause}
onclick={openPauseConfirmation}
>
{activity.paused
? translate('workflows.unpause')
: translate('workflows.pause')}
</Button>
</Tooltip>
<Tooltip bottomLeft width={200} text="Update this Activity Options.">
<Button
variant="secondary"
size="sm"
LeadingIcon={IconPencil}
onclick={openOptionsDrawer}
>
{translate('common.update')}
</Button>
</Tooltip>
<Tooltip bottom width={200} text="Reset this Activity.">
<Button
variant="secondary"
size="sm"
LeadingIcon={IconRetry}
onclick={openResetConfirmation}
>
{translate('workflows.reset')}
</Button>
</Tooltip>
</div>

<ActivityPauseConfirmationModal
bind:open={pauseConfirmationModalOpen}
activityId={activity.id}
onConfirm={onPause}
/>

<ActivityUnpauseConfirmationModal
bind:open={unpauseConfirmationModalOpen}
activityId={activity.id}
onConfirm={onUnpause}
/>

<ActivityResetConfirmationModal
bind:open={resetConfirmationModalOpen}
activityId={activity.id}
onConfirm={onReset}
/>

<!-- Remounts the drawer on every open so the form re-seeds from the current
activity; activity-options-form.svelte deliberately untracks its initial
values so a background refresh cannot clobber a mid-edit form. -->
{#key optionsUpdateDrawerOpen}
<ActivityOptionsForm
bind:open={optionsUpdateDrawerOpen}
activityId={activity.activityId}
activityOptions={activity.activityOptions}
onSave={onUpdateOptions}
/>
{/key}
Loading
Loading