Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ and its version numbers follow [Semantic Versioning](https://semver.org/).
scheme (`<type>/<issue-id>-<short-kebab-description>`).
- `AGENTS.md` PR title convention (no coding-agent/tool tags) and mandatory
`git pull --ff-only origin main` before branch creation (`#32`).
- Regression test coverage for runtime coordination contracts now explicitly
includes the `add()` pre-start panic behavior (`#28`).
- `RunnableWithContext`, `RuntimeContext`, and
`with_runtime_context(...)` so runnables can consume runtime
control/ticker context without carrying a `RuntimeGuard` field (`#21`).
Expand Down
24 changes: 24 additions & 0 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,30 @@ async fn test_runnable() {
);
}

#[test]
fn test_add_before_start_panics_with_contract_message() {
let manager = ProcessManager::new();
let attempts = Arc::new(AtomicUsize::new(0));

let panic = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
manager.add(FlakyController::new(0, Arc::clone(&attempts)));
}))
.expect_err("add() before startup must panic");

let message = if let Some(s) = panic.downcast_ref::<&str>() {
(*s).to_owned()
} else if let Some(s) = panic.downcast_ref::<String>() {
s.clone()
} else {
"<non-string panic payload>".to_owned()
};

assert!(
message.contains("cannot call add() before manager has started"),
"unexpected panic message: {message}"
);
}

#[tokio::test]
async fn test_runnable_with_context_works_without_runtime_guard_field() {
let reloads = Arc::new(AtomicUsize::new(0));
Expand Down
Loading