Skip to content

feat: alert-triage L5 — Temporal workflow + worker with TestWorkflowEnvironment test (#74) #231

Closed

Description

@lex00

Follow-up to #230 (the triage activities). Wire the activities into a runnable raw Temporal workflow + worker, with a real time-skipping test — the last L5 piece that can carry a genuine CI check.

This is chant's "Raw Temporal + chant" path: the triage workflow is hand-written Temporal; chant synthesizes the manifests (already done in #229). Not a chant Op — the activities are custom app logic (see #230 for why).

Scope

  • activities/workflow.ts — the triage workflow: classify → gather context → propose → approval gate → notify. Uses proxyActivities over the refactor(examples): pivot L5 triage to raw Temporal + add activities (#74) #230 activities, and a defineSignal + condition approval gate that only triggers for remediation.risky (auto-approves safe ones). Reasonable timeouts/retries.
  • activities/worker.ts — registers the activities + workflow; reads the Temporal connection from chant.config.ts's local profile (same pattern as the generated Op workers).
  • activities/workflow.test.ts — a time-skipping TestWorkflowEnvironment test (model on the temporal lexicon's test(temporal): TestWorkflowEnvironment runtime harness #161 harness): asserts phase ordering, that a risky remediation waits for the approve-remediation signal (not the timeout) and proceeds once signalled, that a safe remediation skips the gate, and that notifyOutcome reflects the approval outcome. Activities mocked.

Out of scope (→ separate issue)

The webhook source, the WatchOp second event source, npm run dev (k3d + Temporal), and the tutorial — those are integration/runtime, validated by running locally.

Acceptance criteria

  • Workflow + worker compile; deps (@temporalio/workflow, @temporalio/worker, @temporalio/testing) added to the example.
  • The TestWorkflowEnvironment test runs in CI (under the examples/alert-triage/**/*.test.ts include from refactor(examples): pivot L5 triage to raw Temporal + add activities (#74) #230) and passes: phase order, gate-waits-for-signal, safe-path-skips-gate, outcome reflects approval.
  • App code stays outside src/ so chant lint src remains clean.
  • README updated with how to run the worker locally (temporal server start-dev, then the worker).

Part of #74 / #216. Builds on #230.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions