huskies: merge 821

This commit is contained in:
dave
2026-04-28 21:02:00 +00:00
parent dd35a8a530
commit b698cee284
6 changed files with 133 additions and 5 deletions
+49
View File
@@ -363,6 +363,55 @@ mod tests {
assert!(content.contains("new.rs"), "new entry should be added");
}
// --- Gate tests: AC3 / AC4 ---
/// AC3: a worktree with a missing module doc fails gates with a recognisable
/// error that references the missing file and line number.
#[test]
fn gate_missing_module_doc_fails_with_file_and_line_in_direction() {
let tmp = TempDir::new().unwrap();
// File has a pub fn but NO //! module doc comment.
let path = write_rs(tmp.path(), "missing_doc.rs", "pub fn no_module_doc() {}\n");
let result = check_files(&[&path]);
assert!(
matches!(&result, CheckResult::Failures(v) if !v.is_empty()),
"expected failures for missing module doc, got {result:?}"
);
if let CheckResult::Failures(failures) = result {
let module_failure = failures
.iter()
.find(|f| f.item_kind == "module")
.expect("expected a module-level failure");
let direction = module_failure.to_direction();
// Direction must name the file so the agent can navigate directly to it.
assert!(
direction.contains("missing_doc.rs"),
"direction must reference the file name: {direction}"
);
// Direction must contain a colon-separated line number.
assert!(
direction.contains(':'),
"direction must contain a file:line reference: {direction}"
);
}
}
/// AC4: a worktree where every changed file has full docs passes gates (Ok result).
#[test]
fn gate_fully_documented_files_pass() {
let tmp = TempDir::new().unwrap();
let path = write_rs(
tmp.path(),
"fully_documented.rs",
"//! Module doc.\n\n/// A function.\npub fn greet() {}\n\n/// A struct.\npub struct Hello;\n",
);
assert_eq!(
check_files(&[&path]),
CheckResult::Ok,
"fully documented file should produce no failures"
);
}
// --- Spawn integration: update_for_worktree writes map at expected path ---
fn init_git_repo(dir: &Path) {