huskies: merge 1111 bug Test isolation: init_for_test() and ensure_content_store() are once-per-thread, not once-per-test, polluting CRDT state across tests

This commit is contained in:
dave
2026-05-17 00:28:48 +00:00
parent f8212f102f
commit a40500eea9
9 changed files with 111 additions and 36 deletions
@@ -6,6 +6,7 @@ use super::spike::create_spike_file;
use std::fs;
fn setup_git_repo(root: &std::path::Path) {
crate::db::ensure_content_store();
std::process::Command::new("git")
.args(["init"])
.current_dir(root)
@@ -166,6 +167,7 @@ fn extract_bug_name_from_content_parses_heading() {
#[test]
fn create_bug_file_writes_correct_content() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
setup_git_repo(tmp.path());
@@ -257,6 +259,7 @@ fn create_bug_file_rejects_empty_acceptance_criteria() {
#[test]
fn create_spike_file_writes_correct_content() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let spike_id = create_spike_file(
@@ -294,6 +297,7 @@ fn create_spike_file_writes_correct_content() {
#[test]
fn create_spike_file_uses_description_when_provided() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let description = "What is the best approach for watching filesystem events?";
@@ -319,6 +323,7 @@ fn create_spike_file_uses_description_when_provided() {
#[test]
fn create_spike_file_uses_placeholder_when_no_description() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let spike_id = create_spike_file(
tmp.path(),
@@ -350,6 +355,7 @@ fn create_spike_file_rejects_empty_name() {
#[test]
fn create_spike_file_with_special_chars_in_name_produces_valid_yaml() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
let name = "Spike: compare \"fast\" vs slow encoders";
let result = create_spike_file(
@@ -423,6 +429,7 @@ fn create_bug_file_with_depends_on_persists_to_crdt() {
#[test]
fn create_bug_file_without_depends_on_omits_field() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
setup_git_repo(tmp.path());
@@ -474,6 +481,7 @@ fn create_refactor_file_with_depends_on_persists_to_crdt() {
#[test]
fn create_refactor_file_without_depends_on_omits_field() {
crate::db::ensure_content_store();
let tmp = tempfile::tempdir().unwrap();
setup_git_repo(tmp.path());