fabro/lib/crates
Bryan Helmkamp 41c47dbe12
fix(workflow): emit terminal run event from FINALIZE, not on_run_end
The `WorkflowRunCompleted` / `WorkflowRunFailed` event was emitted from
`EventLifecycle::on_run_end`, a callback the executor fires at the end of
the EXECUTE phase. But the run isn't done at that point — RETRO and
FINALIZE still need to run, and FINALIZE writes the meta branch's finalize
commit. Observers that treat the event as "done" (CLI attach, daemon SSE
consumers) could observe terminal state and act on it before the worker
flushed its remaining writes.

The recovery scenario test exposed this: it deletes the meta branch
right after `fabro run` returns, then asserts the branch is empty. On
loaded CI runners the worker's finalize commit landed after the delete,
recreating the branch and failing the assertion.

Move the terminal event emission to `pipeline::finalize::finalize`, after
`write_finalize_commit`. The lifecycle's `on_run_end` overrides for event
and git become empty (deleted — the trait already provides a no-op
default). Three pieces of cross-cutting state (`final_patch`,
`captured_artifact_count`, the dead `EventLifecycle` reads of
`last_git_sha`) only existed to ferry data from EXECUTE to the terminal
event; deleted those too. The aggregator collapses to a one-line
delegate to `hook.on_run_end`.

`write_finalize_commit` now takes the conclusion as a parameter and
injects it into the projection copy, since the terminal event hasn't run
through the run store yet when the meta branch is written.

`build_terminal_event` is `pub(crate)` so `test_support` helpers (which
stop at EXECUTE) can mirror the production payload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 17:48:56 -04:00
..
fabro-agent refactor: adopt strum for enum string conversions 2026-04-22 17:16:25 -04:00
fabro-api Merge remote-tracking branch 'origin/main' 2026-04-22 21:18:50 -04:00
fabro-auth Merge remote-tracking branch 'origin/main' 2026-04-19 20:32:02 -04:00
fabro-checkpoint Adjust store dump export paths 2026-04-22 16:13:27 -04:00
fabro-cli fix(workflow): emit terminal run event from FINALIZE, not on_run_end 2026-04-23 17:48:56 -04:00
fabro-client chore: fix nightly clippy lints on worker jwt branch 2026-04-23 12:08:55 -04:00
fabro-config Merge remote-tracking branch 'origin/main' 2026-04-23 08:52:44 -04:00
fabro-core refactor(unwrap): clean runtime hotspot call sites 2026-04-19 20:48:44 -04:00
fabro-devcontainer refactor(unwrap): clear non-test workspace warnings 2026-04-19 20:56:38 -04:00
fabro-github refactor(server): relocate github helpers and use macros for test context 2026-04-20 08:39:12 -04:00
fabro-graphviz refactor: adopt strum for enum string conversions 2026-04-22 17:16:25 -04:00
fabro-hooks refactor(auth): scrub FABRO_WORKER_TOKEN from worker env at startup 2026-04-23 15:10:58 -04:00
fabro-http refactor: remove CLI client mTLS 2026-04-20 17:37:24 -04:00
fabro-install refactor(server): lock down server secrets 2026-04-23 07:15:27 -04:00
fabro-interview Merge remote-tracking branch 'origin/main' 2026-04-19 20:32:02 -04:00
fabro-llm refactor: adopt strum for enum string conversions 2026-04-22 17:16:25 -04:00
fabro-macros refactor(config): move settings combine into types 2026-04-23 08:42:19 -04:00
fabro-mcp fix: simplify fabro-http crate and fix correctness issues 2026-04-12 12:20:55 -04:00
fabro-model refactor: adopt strum for enum string conversions 2026-04-22 17:16:25 -04:00
fabro-oauth test(cli): suppress browser launch under spawned fabro test subprocesses 2026-04-22 07:50:34 -04:00
fabro-proc fix(proc): expect disallowed_methods on /proc walk 2026-04-21 12:26:41 -04:00
fabro-retro refactor: simplify metadata snapshot + retro upload paths 2026-04-21 08:27:59 -04:00
fabro-sandbox refactor(auth): scrub FABRO_WORKER_TOKEN from worker env at startup 2026-04-23 15:10:58 -04:00
fabro-server chore: fix nightly clippy lints on worker jwt branch 2026-04-23 12:08:55 -04:00
fabro-slack refactor(http): centralize reqwest behind fabro-http 2026-04-12 11:48:54 -04:00
fabro-spa Merge remote-tracking branch 'origin/main' 2026-04-22 21:18:50 -04:00
fabro-store fix(status): align archive outcomes and clean lint drift 2026-04-22 17:55:07 -04:00
fabro-telemetry refactor(server): lock down server secrets 2026-04-23 07:15:27 -04:00
fabro-template refactor(async): lint std::process::Command across all targets 2026-04-12 13:35:57 -04:00
fabro-test refactor(server): lock down server secrets 2026-04-23 07:15:27 -04:00
fabro-tracker refactor(unwrap): clear non-test workspace warnings 2026-04-19 20:56:38 -04:00
fabro-types refactor(auth): simplify worker jwt helpers and reuse existing utilities 2026-04-23 12:01:22 -04:00
fabro-util refactor(auth): scrub FABRO_WORKER_TOKEN from worker env at startup 2026-04-23 15:10:58 -04:00
fabro-validate fmt: apply nightly rustfmt after merge 2026-04-11 13:43:30 -04:00
fabro-vault lint(clippy): disallow blocking std::fs on Tokio paths 2026-04-19 17:22:21 -04:00
fabro-workflow fix(workflow): emit terminal run event from FINALIZE, not on_run_end 2026-04-23 17:48:56 -04:00