feat(background): runner PTY B8 + boucle sink fermée + refactor point-2

Livre le lot backend B8 des tâches de fond :

- infrastructure : runner de commandes concret (CommandBackgroundRunner)
  sur le port BackgroundTaskRunner, tail borné (bounded_tail/BoundedTail),
  éclatement du module background_task en sous-modules (mod/runner/tail,
  sink extrait de l'ancien background_task.rs).
- application : nouveau module background exposant les cas d'usage
  SpawnBackgroundCommand, CancelBackgroundTask, RetryBackgroundTask et le
  port BackgroundCommandArchive.
- domain : refactor point-2 de l'arbitrage Architect — sortie du trait
  BackgroundCommandArchive de la couche domaine vers application.
- app-tauri : câblage runtime (commands, dto, state, lib) des commandes
  spawn/cancel/retry et de la boucle de complétion sink fermée en
  composition root.

Build workspace + tests application/infrastructure verts (QA).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 14:48:46 +02:00
parent 5d88c952ec
commit 8cac1470ac
12 changed files with 1180 additions and 11 deletions

View File

@ -0,0 +1,22 @@
//! First-class background task infrastructure.
//!
//! Three cohesive pieces close the B2→B8 loop:
//!
//! - [`sink`] — the durable [`BackgroundCompletionSink`], single writer between a
//! runner completion and the ready-to-deliver signal (persist-before-signal).
//! - [`tail`] — a UTF-8-safe bounded ring buffer for stdout/stderr tails.
//! - [`runner`] — [`CommandBackgroundRunner`], the concrete
//! [`BackgroundTaskRunner`](domain::ports::BackgroundTaskRunner) that spawns a
//! command-backed task over a composed [`PtyPort`](domain::ports::PtyPort) and
//! emits exactly one completion per task.
mod runner;
mod sink;
mod tail;
pub use runner::CommandBackgroundRunner;
pub use sink::{
start_background_ready_inbox_bridge, BackgroundCompletionSink, BackgroundCompletionSinkError,
BackgroundCompletionSinkOutcome, BackgroundReadyInboxBridgeHandle, BackgroundTaskReadyToDeliver,
};
pub use tail::{bounded_tail, tail_cap_bytes, BoundedTail};