test(8.0): close brains in afterEach (count-sync, get-relations teardown)

Both suites removed their test directory without closing the brain, leaving the
writer-lock heartbeat + flush timers running into teardown and the next test.
Adds brain.close() before the rm.

Remaining failures in these files are separate, deeper issues (tracked in
.strategy): get-relations has one pagination assertion; count-sync is off-by-one
because a fresh brain carries one system/VFS-root noun that counts in
totalNounCount while find() excludes it — a counts-semantics decision.
This commit is contained in:
David Snelling 2026-06-16 13:18:14 -07:00
parent cc1a4317b1
commit 0ca0e5c6cc
2 changed files with 16 additions and 0 deletions

View file

@ -34,6 +34,14 @@ describe('Count Synchronization (Bug Fix v4.1.2)', () => {
}) })
afterEach(async () => { afterEach(async () => {
// Close the brain first so its writer-lock heartbeat + flush timers stop
// before the directory is removed — otherwise they race teardown and bleed
// state into the next test.
try {
await brain?.close()
} catch {
// Best-effort teardown.
}
// Clean up test directory // Clean up test directory
try { try {
await fs.rm(testPath, { recursive: true, force: true }) await fs.rm(testPath, { recursive: true, force: true })

View file

@ -33,6 +33,14 @@ describe('related() call patterns', () => {
}) })
afterEach(async () => { afterEach(async () => {
// Close the brain first so its writer-lock heartbeat + flush timers stop
// before the directory is removed — otherwise they race teardown and bleed
// state into the next test.
try {
await brain?.close()
} catch {
// Best-effort teardown.
}
// Clean up test directory // Clean up test directory
try { try {
await fs.rm(testPath, { recursive: true, force: true }) await fs.rm(testPath, { recursive: true, force: true })