-
Notifications
You must be signed in to change notification settings - Fork 0
Close the last zero-coverage core modules: events.rs and audit.rs #92
Copy link
Copy link
Open
Labels
area:engineRust core/CLI: crates/core, crates/cli.Rust core/CLI: crates/core, crates/cli.area:testsUnit, integration, and e2e test suites.Unit, integration, and e2e test suites.complexity:haikuSmall and self-contained; an agent can ship this in one shot.Small and self-contained; an agent can ship this in one shot.priority:highSignificant impact; schedule in next cycle.Significant impact; schedule in next cycle.status:refinedAgent-refined (acceptance criteria + proposed complexity); awaiting a human's go.Agent-refined (acceptance criteria + proposed complexity); awaiting a human's go.type:tech-debtKnown shortcut to repay; reduces future friction.Known shortcut to repay; reduces future friction.
Description
Metadata
Metadata
Assignees
Labels
area:engineRust core/CLI: crates/core, crates/cli.Rust core/CLI: crates/core, crates/cli.area:testsUnit, integration, and e2e test suites.Unit, integration, and e2e test suites.complexity:haikuSmall and self-contained; an agent can ship this in one shot.Small and self-contained; an agent can ship this in one shot.priority:highSignificant impact; schedule in next cycle.Significant impact; schedule in next cycle.status:refinedAgent-refined (acceptance criteria + proposed complexity); awaiting a human's go.Agent-refined (acceptance criteria + proposed complexity); awaiting a human's go.type:tech-debtKnown shortcut to repay; reduces future friction.Known shortcut to repay; reduces future friction.
Summary
Two core modules need direct unit tests.
events.rsalready has one test (published_event_reaches_a_subscriber) but is missing the subscriber-drop-then-publish safety case.audit.rshas zero tests and needs a#[cfg(test)]query helper onDbplus assertions on both row presence and the detail-format string.Acceptance criteria
events.rs: a test exercisespublishafter the only subscriber has been dropped — it must not panic (thelet _already discards the error; the test explicitly covers that path).audit.rs: a test callsrecord_overrideon a tempDb, then asserts: one row exists withkind = "override", the correctissue_key, the correctreason, anddetailformatted as"step_run {step_run_id} ({step_id})".#[cfg(test)]helper onDb(e.g.list_audit_rows) returns the raw audit-log rows so test assertions can inspect field values — this is test-only surface, not a new public method.#[cfg(test)]blocks in their respective modules (no new test files).cargo test -p clabby-corepasses with no new#[ignore]or#[allow(dead_code)].Out of scope
published_event_reaches_a_subscribertest inevents.rs— already present, do not remove or rewrite it.publishwith no subscribers — thelet _ = self.tx.send(ev)already makes this explicit; a test would only restate the code.db.rsitself or other modules.#[cfg(test)]) methods onDb.Files in scope
crates/core/src/events.rs— append subscriber-drop test to the existing#[cfg(test)]block.crates/core/src/audit.rs— add a new#[cfg(test)]block with therecord_overridetest; constructDbviaDb::connect(path)against atempfile::tempdir()(same pattern ascrates/core/tests/e2e.rs).crates/core/src/db.rs— add a#[cfg(test)]list_audit_rows(or equivalent) method that returns all rows fromaudit_logso theaudit.rstest can assert field values.