26809df720
- Add workshop-schedule crate (petgraph-based DAG scheduling) - Implement all bake decorators with combinator chain execution - Refactor notify module: extract handler, rule, template, util, queue - Add NotificationQueue with priority/drain semantics - Enhance finalize plugin system with internal plugin registration - Update ExecutionContext and event types - Add per-crate AGENTS.md knowledge base files - Remove inline AGENTS.md files (consolidated into per-crate docs)
3.5 KiB
3.5 KiB
WORKSHOP-ENGINE KNOWLEDGE BASE
OVERVIEW
Core execution layer for HoneyBiscuitWorkshop. Library-only crate (no binary). Provides Engine executor, process abstraction, package manager interfaces, duration parsing, and typed error/event systems. Used by workshop-baker; depends on no other workspace crates.
WHERE TO LOOK
| Task | File | Notes |
|---|---|---|
| Script execution | src/executor.rs |
Engine::execute_script() — spawn, stream, timeout, kill |
| Process abstraction | src/child.rs |
ManagedChild trait; TokioChild (real), MockChild (hand-rolled, no mockall) |
| Configurable commands | src/command.rs |
CustomCommand — name, command, env, working_dir, timeout |
| System PMs | src/pm.rs + pm/{apt,pacman,dnf,apk}.rs |
PackageManager trait; all_managers(), select(name) |
| User PMs | src/upm.rs + upm/{rust,go,python,custom}.rs |
UserPackageManager trait (async); UPMSysDeps |
| Repology endpoint | src/repology.rs + repology/local.rs |
RepologyEndpoint enum; local instance support |
| Duration parsing | src/time.rs |
parse_duration_to_ms(), serde helpers |
| Core types | src/types.rs |
ExecutionContext, ExecutionResult, ExecutionEvent, EventSender, StreamType, Engine |
| Error types | src/error.rs |
ExecutionError, DependencyError, HasExitCode trait, EXITCODE_* constants |
| Integration tests | tests/engine_integration.rs |
12 async tests; run with cargo test --test engine_integration |
CONVENTIONS
- Edition: Rust 2024
- Key deps: tokio (full), thiserror, serde+serde_yaml, async-trait, chrono, os_info, duration-str, libc, lazy_static
- Process mgmt:
ManagedChildtrait abstracts over real/mock children.TokioChildwrapstokio::process::Child.MockChildis hand-rolled (no mockall dep); supports hanging, custom output, exit codes. - Package manager selection: Use
pm::select("apt")with explicit name — NEVER auto-detect by probing the filesystem. - Error mapping:
HasExitCodetrait maps errors to numeric exit codes.ExecutionErrormaps to specificEXITCODE_*;DependencyErroralways maps to 1. - Re-exports:
lib.rsre-exports key types for convenience (Engine,ExecutionContext,PackageManager,ExecutionError, etc.) - Tests: Inline
#[cfg(test)]blocks inpm.rs(8 tests). Integration tests intests/engine_integration.rs(12 async tests, separate binary). CI runs both. - Kill semantics:
TokioChild::kill()sendsSIGKILLto entire process group vialibc::kill(-PGID, SIGKILL)withESRCHsilently ignored.
ANTI-PATTERNS
- Do NOT auto-detect the host package manager — always use
pm::select()with an explicitly configured name. Production PM selection comes from environment config, not probing. - Do NOT use
detect()/adopt()patterns for PM selection — these don't exist in this crate, and callers must not invent them. - Do NOT depend on workshop-baker or other workspace crates — engine is a leaf dependency. Types needed by external callers should flow through
ExecutionContext, not reverse imports. - Do NOT use mockall or other mocking frameworks —
MockChildis the only mock mechanism. Keep it that way. - Do NOT use
unimplemented!()— all package manager implementations are complete. Stubs belong in workshop-baker, not here. - Do NOT add magic platform detection —
os_infois used only for mirror config mapping in PM impls. Do not extend its use to auto-detect behavior.