Asterism Original test blocks 202 unchanged Contracts 9 new Targeted 211 declarations / 300 invocations Final Core 3,851 declarations; 3 failed cases / 4 issues; 55 skips

Pre-push review: T-1958 shared on-disk test fixture

Test-only ownership, seeding, directory, factory and clock consolidation. Original malformed graph scenarios remain explicit.

At a glance

  • Shared ownership keeps contexts usable and removes temporary roots after container ownership ends.
  • The candidate ends fixture-owned scope before publication, but observed saved containers can survive that boundary. Physical deallocation is not established.
  • Original declarations, parameter sets and test bodies are preserved; production files and benchmark policy are unchanged.

Verdict

Blocking — approved lifetime acceptance remains failed

Full Core failed one new lifetime case (Site-save direct factory/context-owner probes) and two untouched main platform-seam cases. Physical container death, the retaining owner, eventual release and absence of later SDK activity remain unproven. All owned commands drained. The strict ownership assertions remain in source. A concrete lease/context-boundary correction awaits approval; this draft is not ready for acceptance or merge.

Review findings

3 raised · 1 fixed · 2 skipped

Jump to findings →

Tests

Pass rate: 100% (3793 of 3796)

New tests: 9

Diff coverage: n/a

Jump to tests →

Commits

Three-level explanation

Tests share the setup that creates, keeps alive and removes an isolated library. Each test keeps its original examples, including broken relationships and duplicates. A context does not keep its container alive, so the fixture owns the containers until the test finishes.

Ten fixture families compose OnDiskLibraryTestSupport. Directory consumers retain frozen-schema factories; two equivalent live factories reuse openContainer at their custom library.store path. Normalization and readiness remain caller policy. Only identical Site insertion is shared; different Entry/Work builders stay local.

Scoped seed/write work uses a dedicated autorelease pool before publication; this does not guarantee physical container death. Fixture-owned references are cleared before root removal, while the risk of externally retained containers remains documented. Reopen contexts use new containers; retained fixtures use fresh contexts over one container. Failure cleanup, diagnosis/save inputs and millisecond clocks are preserved. The helper belongs only to the test target.

Important changes — detailed

Shared support owns containers and isolated roots

Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift

Why it matters. Avoids premature SwiftData container deallocation and duplicated cleanup.

What to look at. TestTemporaryDirectory / retainedContainer / readContext

Takeaway. ModelContext does not retain its container.
Rationale. Approved lifecycle requirement and recalled SwiftData ownership note.

Scoped seeds release before readiness publication

Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift

Why it matters. The full gate exposed surviving containers after the fixture frame ended; the retaining owner is unproven.

What to look at. scoped / seedReady

Takeaway. Fixture reference release and physical object deallocation are different guarantees.
Rationale. Preserved full-suite failures, exact-boundary Boolean observations and bounded teardown controls; acceptance remains blocked.

Nine contracts guard lifecycle and raw mutation

Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupportTests.swift

Why it matters. Verifies the behavior the extraction must preserve.

What to look at. OnDiskLibraryTestSupportTests

Rationale. Approved contracts; cleanup assertions retained with outer pool ending after cleanup.

Equivalent live factories preserve custom paths

Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift

Why it matters. Reuses V20 configuration without redirecting library.store.

What to look at. ReconcilerStore and ProjectionStore initializers

Rationale. Source comparison confirmed schema/configuration/migration/mirroring equivalence.

Key decisions

Keep scenario construction local where values differ

Entry/Work defaults, URLs, membership and malformed relationships differ. Share only the identical raw Site constructor.

Preserve failed gates and limit unrelated scope

Four compile-only attempts and three failed Core gates remain evidence. The latest also fails the new Site-save ownership case; untouched PR105 platform-seam failures remain. No allowlist relaxation, UI rerun or installation was used.

Review findings

SeverityAreaFindingResolution
majorSeed/container lifetimeFull Core retained seed ownership at readiness publication.Pools and public teardown controls did not establish immediate physical death. Strict checks remain failed; proposed fixture lease plus actual-context proof awaits approval.
majorCleanup regression environmentAn observer-only pool could hide an outer retain.Restore original caller shape and keep outer pool alive through cleanup and all assertions. Helper-side factory boundary retained.
majorExisting main platform seamsCoverDropTarget.swift is outside platform-conditional and UIKit-import allowlists.Preserved as two unchanged baseline failures; outside approved T1958 scope.

Tests

Source: local run at 2026-10-13T05:59:24.129425+00:00 · snapshot 33c479fe6ea328cc96db399b29856471df9048d4 (dirty working tree)

Baseline: none

Execution: failed · JUnit: 1 file · Coverage: none · Baseline: absent

Coverage scope: as the project configures it

Totals: 3793 passed · 3 failed · 55 skipped · 0 errored · 0 flaky

Failed tests

SuiteTestJob or artifactMessage
AsterismCoreTests.PlatformSeamTestsconditionalsOnlyAtSeams()—Expectation failed: offenders.isEmpty (error): Platform conditionals outside the design's seams: Thumbnails/CoverDropTarget.swift: #if os(iOS) Thumbnails/CoverDropTarget.swift: #if os(iOS) Thumbnails/CoverDropTarget.swift: #if os(iOS)
AsterismCoreTests.PlatformSeamTestsuiKitImportedOnlyInIOSOnlyFiles()—Expectation failed: offenders.isEmpty (error): import UIKit outside the UIKit bridge files: Thumbnails/CoverDropTarget.swift
AsterismCoreTests.OnDiskLibraryTestSupportTestsfactoryAndContextRelease(shape:)—Expectation failed: factoryReleased (error)

New and removed tests

Derived by declaration name, from the diff (no baseline run).

Blast radius

Files that import a changed file on the left, changed files in the centre, files a changed file imports on the right. Snapshot working-tree against base fba443e9b3a80fbc962ee39688c8d7ed3804fed8.

Dependents none found Changed Dependencies none found …mCore/Tests/AsterismCoreTests Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift…ortDegradedRefusalTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift…/CertificationPathTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CitationResolutionParityTests.swift…onResolutionParityTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CitedPatternResolutionTests.swift…dPatternResolutionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/EntryDetailAndMergeToleranceTests.swift…lAndMergeToleranceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/FailClosedRegressionTests.swift…ilClosedRegressionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/IdentityLookupToleranceTests.swift…ityLookupToleranceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift…sts/MarkerContractTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift…BootstrapLifecycleTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift…nDiskLibraryTestSupport.swift Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupportTests.swift…LibraryTestSupportTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift…reshUnionInvariantTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ReteachDiagnosisComparisonTests.swift…iagnosisComparisonTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift…sts/SiteReconcilerTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift…iteUnionProjectionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift…ests/StoreMetadataTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/TodayPresentationToleranceTests.swift…sentationToleranceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift…ts/V4RecordedStoreTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift…ritePathQuarantineTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift…teSiteRelationshipTests.swift
addedmodifieddeletedrenamedunchangedcollapsed package group or +N more⚑N test files with an edge to the node

Per-file diffs

26 files: 20 code · 6 docs. Click to expand.

Code (20)

Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swiftindex 204ce06a..d15143d0 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift@@ -914,19 +914,14 @@ struct BackupExportDegradedRefusalTests { private struct DegradedExportFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration-    let container: ModelContainer+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }+    var container: ModelContainer { support.container }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismDegradedExport-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)-        container = try LibraryRepository.openContainer(at: configuration.storeURL)+        support = try OnDiskLibraryTestSupport("AsterismDegradedExport")+        _ = try support.retainedContainer()     }      func seed(_ body: (SeedStore) throws -> Void) throws {@@ -944,10 +939,8 @@ private struct DegradedExportFixture {     /// the diagnoses and the quarantine projection.     func diagnosedRepository() throws -> LibraryRepository {         let diagnostics = try LibraryValidator.validate(context: ModelContext(container))-        return LibraryRepository.makeRepository(-            configuration, container, .m4,-            FixedRepositoryClock(Self.epoch), ModelContextSaveStrategy(),-            quarantined: diagnostics.quarantineMap(), diagnostics: diagnostics)+        return support.repository(+            container: container, clock: FixedRepositoryClock(Self.epoch), diagnostics: diagnostics)     } } @@ -960,9 +953,7 @@ private final class SeedStore {      @discardableResult     func insertSite(hostname: String, displayName: String? = nil) -> Site {-        let site = Site(hostname: hostname, displayName: displayName)-        context.insert(site)-        return site+        RawLibraryTestRecords.insertSite(in: context, hostname: hostname, displayName: displayName)     }      @discardableResult
Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swiftindex b4a2db72..b05e549c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift@@ -25,13 +25,9 @@ struct CertificationPathTests {     // MARK: - Helpers      private final class TempDir {-        let url: URL-        init() throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "Certify-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init() throws { root = try TestTemporaryDirectory("Certify") }     }      private func config() throws -> (TempDir, LibraryConfiguration) {
Packages/AsterismCore/Tests/AsterismCoreTests/CitationResolutionParityTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CitationResolutionParityTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CitationResolutionParityTests.swiftindex 355f8def..83e3b259 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CitationResolutionParityTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CitationResolutionParityTests.swift@@ -469,60 +469,36 @@ struct ReparseSiteResolutionTests { private final class ParityFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismCitationParity-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismCitationParity")     }      func seed(_ body: (ParitySeedStore) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let store = ParitySeedStore(context: ModelContext(container))-        try body(store)-        try store.context.save()-        try SiteRelationshipPopulationPass.run(context: store.context)-        withExtendedLifetime(container) {}-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)+        try support.seedReady { context in+            let store = ParitySeedStore(context: context)+            try body(store)+            try store.context.save()+            try SiteRelationshipPopulationPass.run(context: store.context)+        }     }      func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      /// Mutates the seeded store *without* re-running the relationship pass —     /// for the one shape the pass cannot express (Decision 4): a record pinned     /// to a duplicate row other than the hostname winner.     func mutate(_ body: (ModelContext) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let context = ModelContext(container)-        try body(context)-        try context.save()-        withExtendedLifetime(container) {}+        try support.write(body)     }      func openForApp() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForApp(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository-    }--    /// A `ModelContext` does not retain its container, so every container this-    /// fixture hands out has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)+        try await support.openForApp(epoch: Self.epoch)     } } @@ -546,9 +522,7 @@ private final class ParitySeedStore {      @discardableResult     func insertSite(hostname: String, displayName: String? = nil) -> Site {-        let site = Site(hostname: hostname, displayName: displayName)-        context.insert(site)-        return site+        RawLibraryTestRecords.insertSite(in: context, hostname: hostname, displayName: displayName)     }      @discardableResult
Packages/AsterismCore/Tests/AsterismCoreTests/CitedPatternResolutionTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CitedPatternResolutionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CitedPatternResolutionTests.swiftindex ef77e942..b0b46983 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CitedPatternResolutionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CitedPatternResolutionTests.swift@@ -141,21 +141,16 @@ private final class CitedResolutionFixture {     static let winningEntryID = UUID(uuidString: "00000000-0000-0000-0000-000000000021")!     static let losingEntryID = UUID(uuidString: "00000000-0000-0000-0000-000000000022")! -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismCitedResolution-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismCitedResolution")     }      func seedTwoTaughtRows() throws {-        try write { context in+        try support.seedReady { context in             try Self.insertTaughtRow(                 into: context, label: "win-row",                 patternID: Self.winningPatternID, ruleID: Self.winningRuleID,@@ -166,10 +161,8 @@ private final class CitedResolutionFixture {                 patternID: Self.losingPatternID, ruleID: Self.losingRuleID,                 entryID: Self.losingEntryID,                 workQuery: "series", sequenceQuery: "chapter", workIdentity: "43", sequence: "8")+            try context.save()         }-        // Seeded at the current schema, so it is marked migrated — the extension-        // opens only that version (Q14).-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)     }      /// Retains the losing row's title rule and activates a new version whose id@@ -203,17 +196,11 @@ private final class CitedResolutionFixture {     /// A fresh container and context over the seeded file — the offline stand-in     /// for a relaunch, and the only way to see another writer's committed state.     func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      func openForExtension() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForExtension(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository+        try await support.openForExtension(epoch: Self.epoch)     }      // MARK: - Seeding@@ -230,11 +217,7 @@ private final class CitedResolutionFixture {     /// Decision 1): a synced relationship arrives as a pointer to its     /// originating row, never through hostname resolution.     private func write(_ body: (ModelContext) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let context = ModelContext(container)-        try body(context)-        try context.save()-        withExtendedLifetime(container) {}+        try support.write(body)     }      /// One legal taught row: `.phrase` title rule, `.workAndSequence` URL rule,@@ -308,14 +291,6 @@ private final class CitedResolutionFixture {         entry.site = site         work.entries = [entry]     }--    /// A `ModelContext` does not retain its container, so every container this-    /// fixture hands out has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)-    } }  private enum CitedResolutionFixtureError: Error {
Packages/AsterismCore/Tests/AsterismCoreTests/EntryDetailAndMergeToleranceTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/EntryDetailAndMergeToleranceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/EntryDetailAndMergeToleranceTests.swiftindex ed628692..bf3b9d35 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/EntryDetailAndMergeToleranceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/EntryDetailAndMergeToleranceTests.swift@@ -607,58 +607,42 @@ private extension PatternDefinition { private final class ToleranceFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismDetailMergeTolerance-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismDetailMergeTolerance")     }      func seed(_ body: (ToleranceSeedStore) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let store = ToleranceSeedStore(context: ModelContext(container))-        try body(store)-        try store.context.save()-        // Task 19: the marker published below says the relationship pass has-        // run, so the seeded graph must look as though it did — every record-        // pinned to the row `SiteResolutionOrder` picks, and nil only where the-        // hostname carries no Site row at all.-        try SiteRelationshipPopulationPass.run(context: store.context)-        withExtendedLifetime(container) {}-        // Seeded at the current schema, so it is marked migrated (Q14, Q26);-        // nothing here simulates a library awaiting the relationship pass.-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)+        try support.seedReady { context in+            let store = ToleranceSeedStore(context: context)+            try body(store)+            try store.context.save()+            // Task 19: the marker published below says the relationship pass has+            // run, so the seeded graph must look as though it did — every record+            // pinned to the row `SiteResolutionOrder` picks, and nil only where the+            // hostname carries no Site row at all.+            try SiteRelationshipPopulationPass.run(context: store.context)+            // Seeded at the current schema, so it is marked migrated (Q14, Q26);+            // nothing here simulates a library awaiting the relationship pass.+        }     }      func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      /// Mutates the seeded store *without* re-running the relationship pass —     /// for the one shape the pass cannot express (Decision 4): a record pinned     /// to the duplicate row that owns its citations rather than to the winner.     func mutate(_ body: (ModelContext) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let context = ModelContext(container)-        try body(context)-        try context.save()-        withExtendedLifetime(container) {}+        try support.write(body)     }      func openForApp() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForApp(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository+        try await support.openForApp(epoch: Self.epoch)     }      /// A repository over the seeded store carrying diagnoses the store itself@@ -667,20 +651,9 @@ private final class ToleranceFixture {     /// stays legal — a store whose tuple really is illegal fails this screen     /// earlier (Q39).     func repository(withDiagnostics diagnostics: LibraryDiagnostics) throws -> LibraryRepository {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return LibraryRepository.makeRepository(-            configuration, container, .m4,-            FixedRepositoryClock(Self.epoch), ModelContextSaveStrategy(),-            quarantined: diagnostics.quarantineMap(), diagnostics: diagnostics)-    }--    /// A `ModelContext` does not retain its container, so every container handed-    /// out here has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)+        let container = try support.retainedContainer()+        return support.repository(+            container: container, clock: FixedRepositoryClock(Self.epoch), diagnostics: diagnostics)     } } @@ -693,9 +666,7 @@ private final class ToleranceSeedStore {      @discardableResult     func insertSite(hostname: String, displayName: String? = nil) -> Site {-        let site = Site(hostname: hostname, displayName: displayName)-        context.insert(site)-        return site+        RawLibraryTestRecords.insertSite(in: context, hostname: hostname, displayName: displayName)     }      @discardableResult
Packages/AsterismCore/Tests/AsterismCoreTests/FailClosedRegressionTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/FailClosedRegressionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/FailClosedRegressionTests.swiftindex c1553d1c..8aba1d5f 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/FailClosedRegressionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/FailClosedRegressionTests.swift@@ -171,33 +171,27 @@ struct FailClosedRegressionTests { private final class FailClosedFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismFailClosed-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismFailClosed")     }      func seed(_ body: (FailClosedSeedStore) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let store = FailClosedSeedStore(context: ModelContext(container))-        try body(store)-        try store.context.save()-        // Task 19: the marker published below says the relationship pass has-        // run, so the seeded graph must look as though it did — every record-        // pinned to the row `SiteResolutionOrder` picks, and nil only where the-        // hostname carries no Site row at all.-        try SiteRelationshipPopulationPass.run(context: store.context)-        withExtendedLifetime(container) {}-        // Marked migrated, or the extension would decline on the marker alone-        // and never reach the state under test (Q14).-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)+        try support.seedReady { context in+            let store = FailClosedSeedStore(context: context)+            try body(store)+            try store.context.save()+            // Task 19: the marker published below says the relationship pass has+            // run, so the seeded graph must look as though it did — every record+            // pinned to the row `SiteResolutionOrder` picks, and nil only where the+            // hostname carries no Site row at all.+            try SiteRelationshipPopulationPass.run(context: store.context)+            // Marked migrated, or the extension would decline on the marker alone+            // and never reach the state under test (Q14).+        }     }      /// A store file that is not a store, plus a readiness marker claiming it is.@@ -210,33 +204,15 @@ private final class FailClosedFixture {     }      func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      func openForApp() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForApp(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository+        try await support.openForApp(epoch: Self.epoch)     }      func openForExtension() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForExtension(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository-    }--    /// A `ModelContext` does not retain its container, so every container this-    /// fixture hands out has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)+        try await support.openForExtension(epoch: Self.epoch)     } } 
Packages/AsterismCore/Tests/AsterismCoreTests/IdentityLookupToleranceTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityLookupToleranceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityLookupToleranceTests.swiftindex e2b8aeee..c27c9634 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityLookupToleranceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityLookupToleranceTests.swift@@ -313,66 +313,42 @@ struct IdentityLookupToleranceTests { private final class LibraryFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismIdentityLookup-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismIdentityLookup")     }      /// Seeds the store in a scoped container, releases it, and publishes     /// migrated readiness so both bootstrap paths accept the library — the     /// extension accepts no other version (Q14).     func seed(_ body: (SeedStore) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let store = SeedStore(context: ModelContext(container))-        try body(store)-        try store.context.save()-        // Task 19: the marker published below says the relationship pass has-        // run, so the seeded graph must look as though it did — every record-        // pinned to the row `SiteResolutionOrder` picks, and nil only where the-        // hostname carries no Site row at all.-        try SiteRelationshipPopulationPass.run(context: store.context)-        withExtendedLifetime(container) {}-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)+        try support.seedReady { context in+            let store = SeedStore(context: context)+            try body(store)+            try store.context.save()+            // Task 19: the marker published below says the relationship pass has+            // run, so the seeded graph must look as though it did — every record+            // pinned to the row `SiteResolutionOrder` picks, and nil only where the+            // hostname carries no Site row at all.+            try SiteRelationshipPopulationPass.run(context: store.context)+        }     }      /// A fresh container and context over the seeded file — the offline stand-in     /// for a relaunch.     func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      func openForApp() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForApp(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository+        try await support.openForApp(epoch: Self.epoch)     }      func openForExtension() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForExtension(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository-    }--    /// A `ModelContext` does not retain its container, so every container this-    /// fixture hands out has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)+        try await support.openForExtension(epoch: Self.epoch)     } } @@ -385,9 +361,7 @@ private final class SeedStore {      @discardableResult     func insertSite(hostname: String, displayName: String? = nil) -> Site {-        let site = Site(hostname: hostname, displayName: displayName)-        context.insert(site)-        return site+        RawLibraryTestRecords.insertSite(in: context, hostname: hostname, displayName: displayName)     }      @discardableResult
Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swiftindex 1e7f0b26..07c77a0e 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift@@ -12,13 +12,9 @@ struct MarkerContractTests {     // MARK: - Helpers      private final class TempDir {-        let url: URL-        init() throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "MarkerContract-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init() throws { root = try TestTemporaryDirectory("MarkerContract") }     }      private func config() throws -> (TempDir, LibraryConfiguration) {
Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swiftindex 61b385a9..dfa51af9 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift@@ -22,13 +22,9 @@ struct MirroringBootstrapLifecycleTests {     // MARK: - Fixtures      private final class TempDir {-        let url: URL-        init() throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "Mirroring-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init() throws { root = try TestTemporaryDirectory("Mirroring") }     }      /// A container identifier that resembles no real one: the package holds no
Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift Added
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swiftnew file mode 100644index 00000000..586f2275--- /dev/null+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift@@ -0,0 +1,127 @@+import Foundation+import SwiftData+@testable import AsterismCore++/// Owns only an isolated test root; it never selects or opens a schema.+final class TestTemporaryDirectory {+    let url: URL+    /// A ModelContext does not retain its container. Owning every returned+    /// context's container here keeps it alive; release our ownership before root removal.+    private var containers: [ModelContainer] = []+    var firstContainer: ModelContainer { containers[0] }+    func retain(_ container: ModelContainer) { containers.append(container) }+    private let beforeRemoval: (URL) -> Void+    init(_ prefix: String, beforeRemoval: @escaping (URL) -> Void = { _ in },+         prepare: (URL) throws -> Void = { _ in }) throws {+        self.beforeRemoval = beforeRemoval+        url = FileManager.default.temporaryDirectory.appending(+            path: "\(prefix)-\(UUID())", directoryHint: .isDirectory)+        do {+            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)+            try prepare(url)+        } catch {+            try? FileManager.default.removeItem(at: url)+            throw error+        }+    }+    deinit {+        autoreleasepool { containers.removeAll() }+        beforeRemoval(url)+        try? FileManager.default.removeItem(at: url)+    }+}++/// Configuration is cheap and must not implicitly open a container.+final class OnDiskLibraryTestSupport {+    private let root: TestTemporaryDirectory+    var directory: URL { root.url }+    let configuration: LibraryConfiguration+    var container: ModelContainer { root.firstContainer }++    init(_ prefix: String, beforeRemoval: @escaping (URL) -> Void = { _ in }) throws {+        root = try TestTemporaryDirectory(prefix, beforeRemoval: beforeRemoval) { directory in+            let configuration = LibraryConfiguration(rootDirectory: directory)+            try FileManager.default.createDirectory(+                at: configuration.storeURL.deletingLastPathComponent(),+                withIntermediateDirectories: true)+        }+        configuration = LibraryConfiguration(rootDirectory: root.url)+    }++    func retainedContainer() throws -> ModelContainer {+        try autoreleasepool {+            let container = try LibraryRepository.openContainer(at: configuration.storeURL)+            root.retain(container)+            return container+        }+    }++    func readContext() throws -> ModelContext { ModelContext(try retainedContainer()) }++    /// A separate frame guarantees seed ownership ends before publication.+    private func scoped(+        _ body: (ModelContext) throws -> Void,+        observe: (ModelContainer) -> Void = { _ in }+    ) throws {+        // SwiftData/Core Data can autorelease temporary ownership during a save.+        // Give this operation its own teardown boundary instead of relying on+        // the enclosing runner's autorelease pool.+        try autoreleasepool {+            let container = try LibraryRepository.openContainer(at: configuration.storeURL)+            let context = ModelContext(container)+            observe(container)+            try body(context)+            withExtendedLifetime(container) {}+        }+    }++    func write(_ body: (ModelContext) throws -> Void) throws {+        try scoped { context in+            try body(context)+            try context.save()+        }+    }++    /// The caller preserves its exact save/population order.+    func seedReady(+        _ body: (ModelContext) throws -> Void,+        observeSeedContainer: (ModelContainer) -> Void = { _ in },+        publish: (URL) throws -> Void = { try LibraryRepository.publishReadiness(at: $0) }+    ) throws {+        try scoped(body, observe: observeSeedContainer)+        try publish(configuration.readinessMarkerURL)+    }++    func openForApp(epoch: Date) async throws -> LibraryRepository {+        let (_, repository) = try await LibraryRepository.openForApp(+            configuration, capabilities: .multiSite, clock: FixedRepositoryClock(epoch),+            saveStrategy: ModelContextSaveStrategy())+        return repository+    }++    func openForExtension(epoch: Date) async throws -> LibraryRepository {+        let (_, repository) = try await LibraryRepository.openForExtension(+            configuration, capabilities: .multiSite, clock: FixedRepositoryClock(epoch),+            saveStrategy: ModelContextSaveStrategy())+        return repository+    }++    func repository(+        container: ModelContainer, clock: any RepositoryClock,+        saveStrategy: any RepositorySaveStrategy = ModelContextSaveStrategy(),+        diagnostics: LibraryDiagnostics+    ) -> LibraryRepository {+        LibraryRepository.makeRepository(+            configuration, container, .m4, clock, saveStrategy,+            quarantined: diagnostics.quarantineMap(), diagnostics: diagnostics)+    }+}++/// Identical raw Site construction; scenario-specific Entry/Work builders stay local.+enum RawLibraryTestRecords {+    static func insertSite(in context: ModelContext, hostname: String, displayName: String?) -> Site {+        let site = Site(hostname: hostname, displayName: displayName)+        context.insert(site)+        return site+    }+}
Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupportTests.swift Added
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupportTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupportTests.swiftnew file mode 100644index 00000000..07583f1b--- /dev/null+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupportTests.swift@@ -0,0 +1,196 @@+import Foundation+import SwiftData+import Testing+@testable import AsterismCore++@Suite("Shared on-disk fixture contracts", .serialized)+struct OnDiskLibraryTestSupportTests {+    private final class WeakContainerBox {+        weak var value: ModelContainer?+    }+    private enum Failure: Error { case expected }++    @Test("Configuration creates directories without opening a store")+    func configurationDoesNotOpenStore() throws {+        let fixture = try OnDiskLibraryTestSupport("FixtureConfiguration")+        #expect(!FileManager.default.fileExists(atPath: fixture.configuration.storeURL.path))+        #expect(!FileManager.default.fileExists(atPath: fixture.configuration.readinessMarkerURL.path))+    }++    @Test("Fresh contexts use one retained container; disk reads reopen and remain usable")+    func retainedAndReopenedContexts() throws {+        let fixture = try OnDiskLibraryTestSupport("FixtureContexts")+        let container = try fixture.retainedContainer()+        let first = ModelContext(container)+        let second = ModelContext(container)+        #expect(first !== second)+        #expect(first.container === second.container)+        first.insert(Site(hostname: "fixture.example"))+        try first.save()+        let reopened = try fixture.readContext()+        let another = try fixture.readContext()+        #expect(reopened.container !== container)+        #expect(another.container !== reopened.container)+        #expect(try second.fetch(FetchDescriptor<Site>()).count == 1)+        #expect(try reopened.fetch(FetchDescriptor<Site>()).count == 1)+        #expect(try another.fetch(FetchDescriptor<Site>()).count == 1)+    }++    @Test("A raw ready seed releases its container before publication and keeps orphan pointers")+    func rawReadyReleaseBeforePublication() throws {+        let fixture = try OnDiskLibraryTestSupport("FixtureRawReady")+        let box = WeakContainerBox()+        var published = false+        try fixture.seedReady({ context in+            box.value = context.container+            context.insert(Site(hostname: "orphan.example"))+            let entry = Entry(captureTitle: "Raw", captureTitleSource: .host,+                              rawURLString: "https://orphan.example/raw", hostname: "orphan.example",+                              entryIdentityKey: "https://orphan.example/raw",+                              timestamp: Date(timeIntervalSince1970: 1))+            context.insert(entry)+            try context.save()+        }, publish: { marker in+            let releasedAtBoundary = box.value == nil+            #expect(releasedAtBoundary)+            published = true+            try LibraryRepository.publishReadiness(at: marker)+        })+        #expect(published)+        let context = try fixture.readContext()+        #expect(try context.fetch(FetchDescriptor<Entry>()).first?.site == nil)+        #expect(FileManager.default.fileExists(atPath: fixture.configuration.readinessMarkerURL.path))+    }++    @Test("Failed seeds release ownership without publishing readiness")+    func failedSeedDoesNotPublish() throws {+        let fixture = try OnDiskLibraryTestSupport("FixtureFailedSeed")+        let box = WeakContainerBox()+        var published = false+        #expect(throws: Failure.self) {+            try fixture.seedReady({ context in+                box.value = context.container+                throw Failure.expected+            }, publish: { _ in published = true })+        }+        #expect(box.value == nil)+        #expect(!published)+        #expect(!FileManager.default.fileExists(atPath: fixture.configuration.readinessMarkerURL.path))+    }++    @Test("Mutation preserves intentionally losing site ownership")+    func mutationDoesNotRepairRelationship() throws {+        let fixture = try OnDiskLibraryTestSupport("FixtureMutation")+        try fixture.write { context in+            let winner = Site(hostname: "duplicate.example", displayName: "winner")+            let loser = Site(hostname: "duplicate.example", displayName: "loser")+            context.insert(winner)+            context.insert(loser)+            let entry = Entry(captureTitle: "Raw", captureTitleSource: .host,+                              rawURLString: "https://duplicate.example/raw", hostname: "duplicate.example",+                              entryIdentityKey: "https://duplicate.example/raw",+                              timestamp: Date(timeIntervalSince1970: 1))+            entry.site = winner+            context.insert(entry)+        }+        try fixture.write { context in+            let loser = try #require(context.fetch(FetchDescriptor<Site>()).first { $0.displayName == "loser" })+            let entry = try #require(context.fetch(FetchDescriptor<Entry>()).first)+            entry.site = loser+        }+        let context = try fixture.readContext()+        #expect(try context.fetch(FetchDescriptor<Entry>()).first?.site?.displayName == "loser")+    }++    @Test("Owners isolate and remove roots after successful and failed use")+    func rootIsolationAndCleanup() throws {+        var first: OnDiskLibraryTestSupport? = try OnDiskLibraryTestSupport("FixtureCleanup")+        var second: OnDiskLibraryTestSupport? = try OnDiskLibraryTestSupport("FixtureCleanup")+        let firstURL = try #require(first?.directory)+        let secondURL = try #require(second?.directory)+        #expect(firstURL != secondURL)+        try first?.write { context in context.insert(Site(hostname: "cleanup.example")) }+        #expect(throws: Failure.self) { try second?.write { _ in throw Failure.expected } }+        #expect(FileManager.default.fileExists(atPath: secondURL.path))+        first = nil+        #expect(!FileManager.default.fileExists(atPath: firstURL.path))+        #expect(FileManager.default.fileExists(atPath: secondURL.path))+        second = nil+        #expect(!FileManager.default.fileExists(atPath: secondURL.path))+    }++    @Test("Container ownership ends before root removal")+    func cleanupReleasesContainerBeforeRoot() throws {+        // Keep the enclosing pool alive until after fixture cleanup, as in a+        // long-running host suite: helper ownership must end before that pool.+        try autoreleasepool {+            let box = WeakContainerBox()+            var removalObserved = false+            var fixture: OnDiskLibraryTestSupport? = try OnDiskLibraryTestSupport(+                "FixtureReleaseOrder", beforeRemoval: { root in+                    let releasedAtBoundary = box.value == nil+                    #expect(releasedAtBoundary)+                    #expect(FileManager.default.fileExists(atPath: root.path))+                    removalObserved = true+                })+            do {+                let context = try #require(fixture).readContext()+                box.value = context.container+                let ownedDuringUse = box.value != nil+                #expect(ownedDuringUse)+                context.insert(Site(hostname: "release.example"))+                try context.save()+            }+            fixture = nil+            #expect(removalObserved)+            let releasedAtBoundary = box.value == nil+            #expect(releasedAtBoundary)+        }+    }++    private enum SeedShape: CaseIterable { case empty, site, entry }++    @Test("The actual seed container and context owner release for each write shape", arguments: SeedShape.allCases)+    private func factoryAndContextRelease(shape: SeedShape) throws {+        let fixture = try OnDiskLibraryTestSupport("FixtureSeedShape")+        let factory = WeakContainerBox()+        let contextOwner = WeakContainerBox()+        var published = false+        try fixture.seedReady({ context in+            contextOwner.value = context.container+            if shape != .empty {+                context.insert(Site(hostname: "shape.example"))+            }+            if shape == .entry {+                context.insert(Entry(+                    captureTitle: "Raw", captureTitleSource: .host,+                    rawURLString: "https://shape.example/raw", hostname: "shape.example",+                    entryIdentityKey: "https://shape.example/raw",+                    timestamp: Date(timeIntervalSince1970: 1)))+            }+            try context.save()+        }, observeSeedContainer: { factory.value = $0 }, publish: { marker in+            // Measure before passing only Boolean values to the assertion recorder.+            let factoryReleased = factory.value == nil+            let contextOwnerReleased = contextOwner.value == nil+            #expect(factoryReleased)+            #expect(contextOwnerReleased)+            published = true+            try LibraryRepository.publishReadiness(at: marker)+        })+        #expect(published)+    }++    @Test("Initialization failure removes a partially prepared root")+    func failedInitializationCleansRoot() throws {+        var failedURL: URL?+        #expect(throws: Failure.self) {+            _ = try TestTemporaryDirectory("FixtureInitFailure", prepare: { directory in+                failedURL = directory+                try Data([1]).write(to: directory.appending(path: "partial"))+                throw Failure.expected+            })+        }+        #expect(!FileManager.default.fileExists(atPath: try #require(failedURL).path))+    }+}
Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swiftindex ce198ed1..c0a38f41 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift@@ -321,17 +321,12 @@ extension LibraryRepository { private final class RefreshFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismRefreshUnion-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismRefreshUnion")     }      /// All three tolerated states plus an illegal Site tuple — the one class the@@ -366,49 +361,30 @@ private final class RefreshFixture {     /// readiness so both bootstrap paths accept the library — the extension     /// accepts no other version (Q14).     func seed(_ body: (SeedStore) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let store = SeedStore(context: ModelContext(container))-        try body(store)-        try store.context.save()-        // Task 19: the marker published below says the relationship pass has-        // run, so the seeded graph must look as though it did — every record-        // pinned to the row `SiteResolutionOrder` picks, and nil only where the-        // hostname carries no Site row at all.-        try SiteRelationshipPopulationPass.run(context: store.context)-        withExtendedLifetime(container) {}-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)+        try support.seedReady { context in+            let store = SeedStore(context: context)+            try body(store)+            try store.context.save()+            // Task 19: the marker published below says the relationship pass has+            // run, so the seeded graph must look as though it did — every record+            // pinned to the row `SiteResolutionOrder` picks, and nil only where the+            // hostname carries no Site row at all.+            try SiteRelationshipPopulationPass.run(context: store.context)+        }     }      /// A fresh container and context over the seeded file — the offline stand-in     /// for another reader of the same store.     func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      func openForApp() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForApp(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository+        try await support.openForApp(epoch: Self.epoch)     }      func openForExtension() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForExtension(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository-    }--    /// A `ModelContext` does not retain its container, so every container this-    /// fixture hands out has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)+        try await support.openForExtension(epoch: Self.epoch)     } } @@ -421,9 +397,7 @@ private final class SeedStore {      @discardableResult     func insertSite(hostname: String, displayName: String? = nil) -> Site {-        let site = Site(hostname: hostname, displayName: displayName)-        context.insert(site)-        return site+        RawLibraryTestRecords.insertSite(in: context, hostname: hostname, displayName: displayName)     }      /// The one rule an untaught row may legally retain: non-current, imported
Packages/AsterismCore/Tests/AsterismCoreTests/ReteachDiagnosisComparisonTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ReteachDiagnosisComparisonTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ReteachDiagnosisComparisonTests.swiftindex 832d695b..293b4203 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ReteachDiagnosisComparisonTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ReteachDiagnosisComparisonTests.swift@@ -262,22 +262,18 @@ struct ReteachDiagnosisComparisonTests { // MARK: - Fixture  private struct ReteachFixture {-    let directory: URL-    let configuration: LibraryConfiguration-    let container: ModelContainer+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }+    var container: ModelContainer { support.container }     let save: InstrumentedSaveStrategy-    private let clock: ReteachClock+    private let clock: FixedRepositoryClock      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismReteachTests-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(), withIntermediateDirectories: true)-        container = try LibraryRepository.openContainer(at: configuration.storeURL)+        support = try OnDiskLibraryTestSupport("AsterismReteachTests")+        _ = try support.retainedContainer()         save = InstrumentedSaveStrategy()-        clock = ReteachClock(Date(timeIntervalSince1970: 1_800_000_000))+        clock = FixedRepositoryClock(Date(timeIntervalSince1970: 1_800_000_000))     }      func freshContext() -> ModelContext { ModelContext(container) }@@ -292,9 +288,8 @@ private struct ReteachFixture {     /// both the diagnoses and the quarantine projection.     func diagnosedRepository() throws -> LibraryRepository {         let diagnostics = try LibraryValidator.validate(context: freshContext())-        return LibraryRepository.makeRepository(-            configuration, container, .m4, clock, save,-            quarantined: diagnostics.quarantineMap(), diagnostics: diagnostics)+        return support.repository(+            container: container, clock: clock, saveStrategy: save, diagnostics: diagnostics)     }      static func wcSegment() throws -> PatternDefinition {@@ -340,10 +335,3 @@ private struct ReteachFixture {         return entry     } }--private final class ReteachClock: RepositoryClock, @unchecked Sendable {-    private let lock = NSLock()-    private var value: Date-    init(_ value: Date) { self.value = value }-    func now() -> Date { lock.withLock { MillisecondInstant.quantize(value) } }-}
Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swiftindex 3cfbf4a2..e5b7978e 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift@@ -443,23 +443,17 @@ private final class ReconcilerStore {     static let hostname = "duplicated.example"     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let container: ModelContainer+    private let root: TestTemporaryDirectory+    var directory: URL { root.url }+    var container: ModelContainer { root.firstContainer }     let context: ModelContext     let saveRecorder = InstrumentedSaveStrategy()     private let saveStrategy: any RepositorySaveStrategy      init(saveStrategy: (any RepositorySaveStrategy)? = nil) throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismSiteReconciler-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV20.self)-        let configuration = ModelConfiguration(-            "AsterismV3", schema: schema,-            url: directory.appending(path: "library.store"), cloudKitDatabase: .none)-        container = try ModelContainer(-            for: schema, migrationPlan: AsterismV20MigrationPlan.self,-            configurations: [configuration])+        root = try TestTemporaryDirectory("AsterismSiteReconciler")+        let container = try LibraryRepository.openContainer(at: root.url.appending(path: "library.store"))+        root.retain(container)         context = ModelContext(container)         self.saveStrategy = saveStrategy ?? saveRecorder     }
Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swiftindex 737ba411..485c2066 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift@@ -421,21 +421,15 @@ private final class ProjectionStore {     static let hostname = "duplicated.example"     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let container: ModelContainer+    private let root: TestTemporaryDirectory+    var directory: URL { root.url }+    var container: ModelContainer { root.firstContainer }     let context: ModelContext      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismSiteUnion-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV20.self)-        let configuration = ModelConfiguration(-            "AsterismV3", schema: schema,-            url: directory.appending(path: "library.store"), cloudKitDatabase: .none)-        container = try ModelContainer(-            for: schema, migrationPlan: AsterismV20MigrationPlan.self,-            configurations: [configuration])+        root = try TestTemporaryDirectory("AsterismSiteUnion")+        let container = try LibraryRepository.openContainer(at: root.url.appending(path: "library.store"))+        root.retain(container)         context = ModelContext(container)     } 
Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swiftindex e47f0168..7f61538d 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift@@ -43,13 +43,9 @@ struct StoreMetadataTests {     // MARK: - Fixtures      private final class TempDir {-        let url: URL-        init() throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "StoreMetadata-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init() throws { root = try TestTemporaryDirectory("StoreMetadata") }         var storeURL: URL { url.appending(path: "store.sqlite") }     } 
Packages/AsterismCore/Tests/AsterismCoreTests/TodayPresentationToleranceTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/TodayPresentationToleranceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/TodayPresentationToleranceTests.swiftindex eb14fe89..25aca2cc 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/TodayPresentationToleranceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/TodayPresentationToleranceTests.swift@@ -617,58 +617,42 @@ struct TodayPresentationToleranceTests { private final class RecentToleranceFixture {     static let epoch = Date(timeIntervalSince1970: 1_800_000_000) -    let directory: URL-    let configuration: LibraryConfiguration+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismRecentTolerance-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(),-            withIntermediateDirectories: true)+        support = try OnDiskLibraryTestSupport("AsterismRecentTolerance")     }      func seed(_ body: (RecentSeedStore) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let store = RecentSeedStore(context: ModelContext(container))-        try body(store)-        try store.context.save()-        // Task 19: the marker published below says the relationship pass has-        // run, so the seeded graph must look as though it did — every record-        // pinned to the row `SiteResolutionOrder` picks, and nil only where the-        // hostname carries no Site row at all.-        try SiteRelationshipPopulationPass.run(context: store.context)-        withExtendedLifetime(container) {}-        // Seeded at the current schema, so it is marked migrated (Q14, Q26);-        // nothing here simulates a library awaiting the relationship pass.-        try LibraryRepository.publishReadiness(at: configuration.readinessMarkerURL)+        try support.seedReady { context in+            let store = RecentSeedStore(context: context)+            try body(store)+            try store.context.save()+            // Task 19: the marker published below says the relationship pass has+            // run, so the seeded graph must look as though it did — every record+            // pinned to the row `SiteResolutionOrder` picks, and nil only where the+            // hostname carries no Site row at all.+            try SiteRelationshipPopulationPass.run(context: store.context)+            // Seeded at the current schema, so it is marked migrated (Q14, Q26);+            // nothing here simulates a library awaiting the relationship pass.+        }     }      func readContext() throws -> ModelContext {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return ModelContext(container)+        try support.readContext()     }      /// Mutates the seeded store *without* re-running the relationship pass —     /// for the one shape the pass cannot express (Decision 4): a record pinned     /// to the duplicate row that owns its citations rather than to the winner.     func mutate(_ body: (ModelContext) throws -> Void) throws {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        let context = ModelContext(container)-        try body(context)-        try context.save()-        withExtendedLifetime(container) {}+        try support.write(body)     }      func openForApp() async throws -> LibraryRepository {-        let (_, repository) = try await LibraryRepository.openForApp(-            configuration, capabilities: .multiSite,-            clock: FixedRepositoryClock(Self.epoch),-            saveStrategy: ModelContextSaveStrategy())-        return repository+        try await support.openForApp(epoch: Self.epoch)     }      /// A repository over the seeded store carrying diagnoses the store itself@@ -677,20 +661,9 @@ private final class RecentToleranceFixture {     /// legal, which is what separating `.siteTuple` from `.duplicateSiteRows`     /// needs.     func repository(withDiagnostics diagnostics: LibraryDiagnostics) throws -> LibraryRepository {-        let container = try LibraryRepository.openContainer(at: configuration.storeURL)-        containers.append(container)-        return LibraryRepository.makeRepository(-            configuration, container, .m4,-            FixedRepositoryClock(Self.epoch), ModelContextSaveStrategy(),-            quarantined: diagnostics.quarantineMap(), diagnostics: diagnostics)-    }--    /// A `ModelContext` does not retain its container, so every container handed-    /// out here has to outlive the test using it.-    private var containers: [ModelContainer] = []--    deinit {-        try? FileManager.default.removeItem(at: directory)+        let container = try support.retainedContainer()+        return support.repository(+            container: container, clock: FixedRepositoryClock(Self.epoch), diagnostics: diagnostics)     } } @@ -703,9 +676,7 @@ private final class RecentSeedStore {      @discardableResult     func insertSite(hostname: String, displayName: String? = nil) -> Site {-        let site = Site(hostname: hostname, displayName: displayName)-        context.insert(site)-        return site+        RawLibraryTestRecords.insertSite(in: context, hostname: hostname, displayName: displayName)     }      @discardableResult
Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swiftindex 9b79507a..2056e4c8 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift@@ -123,13 +123,9 @@ enum V4RecordedStoreFixture { struct V4RecordedStoreTests {      private final class TempDir {-        let url: URL-        init() throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "V4Recorded-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init() throws { root = try TestTemporaryDirectory("V4Recorded") }     }      @Test("The fixture really is recorded at 4.0.0")
Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swiftindex 5596805b..8da31f5e 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift@@ -221,22 +221,18 @@ struct WritePathQuarantineTests { /// hostname, so every assertion can check both that the guard fires and that it /// is scoped to the hostname it names. private struct WritePathFixture {-    let directory: URL-    let configuration: LibraryConfiguration-    let container: ModelContainer+    private let support: OnDiskLibraryTestSupport+    var directory: URL { support.directory }+    var configuration: LibraryConfiguration { support.configuration }+    var container: ModelContainer { support.container }     let save: InstrumentedSaveStrategy-    private let clock: WritePathClock+    private let clock: FixedRepositoryClock      init() throws {-        directory = FileManager.default.temporaryDirectory-            .appending(path: "AsterismWritePathTests-\(UUID())", directoryHint: .isDirectory)-        try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        configuration = LibraryConfiguration(rootDirectory: directory)-        try FileManager.default.createDirectory(-            at: configuration.storeURL.deletingLastPathComponent(), withIntermediateDirectories: true)-        container = try LibraryRepository.openContainer(at: configuration.storeURL)+        support = try OnDiskLibraryTestSupport("AsterismWritePathTests")+        _ = try support.retainedContainer()         save = InstrumentedSaveStrategy()-        clock = WritePathClock(Date(timeIntervalSince1970: 1_800_000_000))+        clock = FixedRepositoryClock(Date(timeIntervalSince1970: 1_800_000_000))         try seed()     } @@ -246,9 +242,8 @@ private struct WritePathFixture {     /// come from one validation of the store as it stands.     func diagnosedRepository() throws -> LibraryRepository {         let diagnostics = try LibraryValidator.validate(context: freshContext())-        return LibraryRepository.makeRepository(-            configuration, container, .m4, clock, save,-            quarantined: diagnostics.quarantineMap(), diagnostics: diagnostics)+        return support.repository(+            container: container, clock: clock, saveStrategy: save, diagnostics: diagnostics)     }      private func seed() throws {@@ -286,10 +281,3 @@ private struct WritePathFixture {         context.insert(entry)     } }--private final class WritePathClock: RepositoryClock, @unchecked Sendable {-    private let lock = NSLock()-    private var value: Date-    init(_ value: Date) { self.value = value }-    func now() -> Date { lock.withLock { MillisecondInstant.quantize(value) } }-}
Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift Modified
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swiftindex e417b38f..476ff9e8 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift@@ -19,13 +19,9 @@ struct WriteSiteRelationshipTests {     // MARK: - Fixture      private final class TempDir {-        let url: URL-        init(_ name: String) throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "\(name)-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init(_ name: String) throws { root = try TestTemporaryDirectory(name) }     }      private static let ts = Date(timeIntervalSince1970: 1_800_000_000)@@ -615,13 +611,9 @@ struct WriteSiteRelationshipTests { struct FixtureRelationshipTests {      private final class TempDir {-        let url: URL-        init() throws {-            url = FileManager.default.temporaryDirectory.appending(-                path: "FixtureRelationships-\(UUID())", directoryHint: .isDirectory)-            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)-        }-        deinit { try? FileManager.default.removeItem(at: url) }+        private let root: TestTemporaryDirectory+        var url: URL { root.url }+        init() throws { root = try TestTemporaryDirectory("FixtureRelationships") }     }      /// `.siteMissing` is the one kind whose correct state is a nil relationship:

Docs (6)

specs/OVERVIEW.md Modified
diff --git a/specs/OVERVIEW.md b/specs/OVERVIEW.mdindex 73e4a801..0f7225fd 100644--- a/specs/OVERVIEW.md+++ b/specs/OVERVIEW.md@@ -64,6 +64,7 @@ | [Hiatus End Date](#hiatus-end-date) | 2026-09-30 | Done | Full spec (T-2375). All 22 tasks complete, including save-day eligibility that preserves earlier releases for dated and undated hiatus. Core, simulator, focused phone/iPad UI and signed Xcode MCP Mac gates pass. Two-Development-device sync verification remains before merge. | | [URL-optional Works and Chapter Notes](#url-optional-works-and-chapter-notes) | 2026-10-10 | In Progress | T-2416: URL-free works and manual notes/ratings, optional titles, work-scoped chapter identity and source links across shared/mixed page layouts, preserved corrections and additive migration/archive compatibility. | | [Manual Note Character Chips](#manual-note-character-chips) | 2026-10-12 | In Progress — source preparation; checks pending coordinated slot | Read-only ranked cast chips and alias/note cards in Add note, reusing the share component and preserving URL-free/title/rating draft semantics. |+| [Shared On-Disk Test Fixture](#shared-on-disk-test-fixture) | 2026-10-13 | In Progress — WIP; lifecycle acceptance blocked | T-1958. Consolidate test ownership, seeding, directories, factories and clocks while preserving raw graphs. |  --- @@ -1023,3 +1024,14 @@ T-2433 adds a local image-file drop source to the existing work cover crop/draft T-2436 removes the appearance of mandatory chapter confirmation on automatic ordinary capture while retaining required ambiguity and shared-page choices.  - [Bugfix report and evidence](bugfixes/redundant-chapter-confirmation/report.md)+++## Shared On-Disk Test Fixture++T-1958. Consolidate test ownership, seeding, directories, factories and clocks while preserving raw graphs. Both outcomes remain active; strict physical-deallocation acceptance fails. The documented lease/context boundary proposal awaits approval.++- [smolspec.md](shared-on-disk-test-fixture/smolspec.md)+- [tasks.md](shared-on-disk-test-fixture/tasks.md)+- [decision_log.md](shared-on-disk-test-fixture/decision_log.md)+- [implementation.md](shared-on-disk-test-fixture/implementation.md)+- [lifecycle-contract-proposal.md](shared-on-disk-test-fixture/lifecycle-contract-proposal.md)
specs/shared-on-disk-test-fixture/decision_log.md Added
diff --git a/specs/shared-on-disk-test-fixture/decision_log.md b/specs/shared-on-disk-test-fixture/decision_log.mdnew file mode 100644index 00000000..4a08edaa--- /dev/null+++ b/specs/shared-on-disk-test-fixture/decision_log.md@@ -0,0 +1,36 @@+# Decisions and current relevance — T-1958++| ID | Decision | Source/evidence |+| --- | --- | --- |+| Q1 | Proposed name shared-on-disk-test-fixture; isolated branch T-1958/shared-on-disk-test-fixture from main fba443e9. | Existing ticket scope; PR107 is separate and complete. Name remains overridable during review. |+| Q2 | T1958 is still relevant: ten primary consumers retain duplicate on-disk setup/lifecycle, with 118 existing declarations. | Current source inventory; original Recent/Cited suite names changed and CitationResolutionParity added a sibling copy. |+| Q3 | Share infrastructure and truly identical builders, preserve differing local scenario factories. | Current raw-work/membership construction and URL/default policies differ; original assertion/fixture semantics take precedence over stale line references. |+| Q4 | Clock cleanup is partly done. Replace only remaining ReteachClock/WritePathClock with existing FixedRepositoryClock. | Both private stubs are immutable, quantized and have no mutator; shared production clock already exists. |+| Q5 | Consolidate current identical directory ownership copies, without changing frozen-schema opening. | Six current files/seven copies remain from the historical addendum; retired migration fixture names are not reintroduced. |+| Q6 | Live-schema factory duplication still exists in SiteReconcilerTests and SiteUnionProjectionTests, now at V20. Reuse openContainer(at:) at their existing custom library.store URL. | Their Schema/ModelConfiguration/ModelContainer blocks match LibraryRepository+Bootstrap.swift openContainer with default .none mirroring and V20 migration plan. Old V4 names are obsolete, not the duplication. |+| Q8 | Keep benchmark sampling/requirement-specific ceilings separate. | Current M4ToleratedScalePerformanceTests explicitly explains why distinct requirement ceiling messages stay separate; calibration warmups/sample setup are intentional measurement policy. No budget or sampling-policy change belongs in the primary on-disk-fixture extraction. |+| Q7 | Preserve all existing assertions and use targeted Core evidence plus final Core/Mac compile bars; no unchanged broad UI rerun. | Repo AGENTS phase/dependency policy and user instruction. Test-only helpers are not linked into the app. |++Scope assessment: no user-owned product ambiguity, production public/schema/auth boundary, or contested architecture fires a full-spec trigger. The shared support follows existing class-owned fixture lifetimes and uses local composition; every change is internal to tests and incrementally reversible.++Recall applied: the configured vault note “Flaky SwiftData test crashes from a non-retained ModelContainer” documents that contexts do not retain their containers. Retention is a required correctness property, not an unused property to remove.++Workflow state: clean-context explanation validation and adversarial design critique completed; findings were incorporated and no escalation signal remains. The user explicitly approved this concrete mechanical plan and both outcomes.++Explanation validation completed from a clean context at the document path. It confirmed current118 declaration inventory and both immutable clock stubs, and found a wording contradiction: CitedResolutionFixture publishes readiness after raw writes without population. Classified as a document edit (existing source settles behavior), corrected in the implementation approach. The two WriteSiteRelationshipTests directory scopes are named explicitly. No escalation signal or code change.++Design-critic self-review clarified two lifecycle guarantees: common configuration must not implicitly open a container, and same-container fresh contexts must remain distinct from disk reopen contexts. Current addendum audit found two V20 factory copies still matching the production factory; add their source-equivalent replacement and preserve custom library.store paths. Benchmark sampling and requirement-specific messages remain explicitly separate. These are source-settled wording/scope clarifications, not product decisions.++Adversarial design-critic follow-up confirmed no full-spec escalation trigger and source equivalence of both V20 factory copies (25 declarations). Three source-settled questions are now answered in the spec: the shared root owner cleans previously leaking isolated roots and partial initialization failures; a separate scoped seed frame precedes an injectable test-only readiness publisher, where a weak container probe proves release ordering; same-container fresh contexts and different-container disk reopen contexts receive separate contracts. No production API/comment, benchmark measurement or persisted format changes.+++## Approval and execution — 2026-10-13++User Sentinel_2a6d180632d48191a4965e05dd10ddc6 explicitly replied “Approved” to the reviewed spec/plan and both implementation outcomes, conveyed by the parent task. The proposed name, spec and both coding outcomes are approved; formal Rune records mirror those outcomes without a new product decision or repeated approval gate. Implementation begins only in the isolated T1958 worktree. No Halo deletion, Library update, merge or deployment is authorized by this receipt.+++## WIP verification boundary — 2026-10-13++WIP code checkpoint21bb415c preserves all202 original test blocks and passes affected211 declarations/300 invocations. Fast456 and signed Mac app/extension compile passed with explicit unchanged-consumer scope reuse. Three accumulated Core gates remain failed: first two3850 declarations/four failing cases/four issues; final3851 declarations/three failing cases/four issues; each retains55 opt-in skips. Two deterministic platform-seam cases flag untouched main PR105 CoverDropTarget.swift; both scanner and target source are byte-identical to basefba443e9. No unrelated allowlist correction was made.++The new physical container-death probes remain unmet. Pools, pending-change processing, actor placement, explicit owner nil and durable rollback did not establish synchronous death. The final192-operation control observed four surviving saved containers/eight weak-container issues while all actual contexts died and reopened data remained unchanged. The retaining owner and eventual release are unproven. A concrete owned-lease plus actual-context-death correction is documented in lifecycle-contract-proposal.md, including the risk of root removal with a surviving container. This changes a specifically approved assertion and awaits approval; current source keeps strict failures. Both task outcomes are active. No phase-completion changelog or Done status is claimed. All owned commands drained; no further broad rerun, install, production change or merge.
specs/shared-on-disk-test-fixture/implementation.md Added
diff --git a/specs/shared-on-disk-test-fixture/implementation.md b/specs/shared-on-disk-test-fixture/implementation.mdnew file mode 100644index 00000000..6bde4ebc--- /dev/null+++ b/specs/shared-on-disk-test-fixture/implementation.md@@ -0,0 +1,51 @@+# Shared on-disk test fixture — implementation++## Beginner Level++### What Changed / Why It Matters+The affected Core tests now share the code that creates an isolated temporary library, keeps it alive while the test reads it, and removes it afterwards. Tests still construct their original examples, including deliberately broken relationships and duplicate records. This reduces repeated setup without weakening what the tests check.++### Key Concepts+A SwiftData context reads and writes a library, but does not keep its container alive. The fixture owns the containers until the test finishes. Readiness is a marker saying a library can be opened; the seed container must be released before that marker is published.++## Intermediate Level++### Changes Overview+`OnDiskLibraryTestSupport` supplies configuration, scoped write/seed operations, retained disk reopening, app/extension bootstrap and diagnosed repository construction. Ten existing fixture families compose it. `TestTemporaryDirectory` supplies isolated root ownership to six directory consumer files and the two live-factory consumers. The latter reuse `LibraryRepository.openContainer(at:)` at their existing `library.store` URL. Reteach and write-path fixtures reuse `FixedRepositoryClock`.++### Implementation Approach+Callers retain their exact save and relationship-population order. Raw citation fixtures publish readiness without a population pass; mutation helpers save without repairing relationships. Shared raw Site insertion has identical arguments and values across consumers. Entry/Work factories remain local because their URL defaults, provenance, membership and malformed graph policies differ.++### Trade-offs+The helper owns infrastructure rather than an all-purpose scenario builder. This leaves a small amount of explicit fixture code while preserving the intent of tolerance tests. Directory-only consumers retain their frozen-schema factories. No performance budgets, warmups, sampling or requirement-specific ceiling messages change.++## Expert Level++### Technical Deep Dive+The root owner retains every returned context's `ModelContainer`; its deinitializer clears the fixture-owned storage before removing the directory. Physical container deallocation at that boundary is not established. Retained fixtures use computed accessors into that ownership, avoiding parallel strong references that could outlive removal. `readContext()` opens a new retained container over the same store on each call; retained-container fixtures construct fresh contexts on their original container. Configuration initialization never opens a store, preserving corrupt-file fail-closed scenarios. Partially initialized roots are removed on failure; operation failures leave a still-owned root available for diagnosis.++Scoped seeding runs in a separate stack frame with an explicit autorelease pool. This ends the fixture frame and drains that caller pool; repeated controls show it does not guarantee actual container deallocation. Retained-container construction uses a pool while the root preserves its owning reference. The publisher runs only after that frame returns successfully. Weak probes snapshot release predicates into Booleans at publication entry before the assertion recorder receives them; the direct factory observer also measures the actual constructed container. Callers choose normalization; the shared helper introduces none. Nine contract declarations (eleven invocations) cover unopened configuration, context/container identity, retained read usability, release before publication, failed seed suppression, raw mutation, root isolation and cleanup, release-before-removal, partial initialization cleanup, and direct factory/context-owner release across empty, Site-save and Entry-save shapes.++### Architecture Impact+All Swift changes live in the Core test target. Existing production configuration, V20 factory, readiness publisher, clocks and repository construction are reused without changing APIs, schema, migration, persisted paths or archive formats. The app and extension do not link this helper.++### Potential Issues+A context must not escape its fixture owner's lifetime. A seed callback must not retain its scoped container or context beyond the callback; existing callers do neither. The helper intentionally does not repair malformed data or publish readiness after failed work.++## Completeness Assessment+The approved source consolidation is present as a WIP candidate. Its physical-deallocation acceptance criterion remains unmet. Initial reviews found no extraction mismatch; accumulated gates then exposed lifecycle failures that isolated checks missed. Every verdict is retained. Followup review confirms the observer conditions remain strict, while a proposed ownership-contract correction awaits approval. All 202 original declarations, parameters and test bodies in the 18 touched consumer files are byte-identical to the baseline. Nine new contract declarations are added. Both tasks remain in progress while accumulated ownership verification is unresolved. All commands are drained; neither task is complete. The approved physical container-death assertion is still present and failing. See [the concrete proposal](lifecycle-contract-proposal.md).++## Verification checkpoint++- Four original compile-only attempts failed before any test executed; their receipts remain preserved.+- Affected consumer gate before the final observer delta: 210 declarations / 297 invocations passed. All 202 original full test blocks are byte-identical.+- Official fast manifest: 456 expected declarations passed.+- Both unfiltered serial Core attempts: 3,850 aggregate declarations, four failures and 55 opt-in skips. Each failed two new ownership probes and two untouched platform-seam checks in main (CoverDropTarget.swift from PR105). Neither is superseded by isolated passes.+- Bounded direct factory/context observation over empty, Site-save and Entry-save shapes: nine declarations / eleven invocations passed with JUnit reporting. Factory and context owner identities matched in instrumentation, but the causal retain source is not proven. Boolean boundary snapshots retain the same predicates and timing without handing measured objects to the assertion recorder.+- Signed Mac app/embedded-extension compile passed in 70.13 seconds; app signing, embedded extension and validation succeeded. Untouched-source GenerationOptions(sampling:) deprecation, captured-self concurrency and skipped extension AppIntents metadata warnings remain. No installation or launch.+- Final affected source: 211 declarations / 300 invocations passed with JUnit enabled, no failures or skips. Source restored after diagnostic experiments matches all 20 tested Swift input hashes.+- Third accumulated confirmation: 3,851 declarations; three failed cases containing four issue nodes; 55 skips; exit 2 in 205.38 seconds. Original seed/cleanup Boolean probes passed, but the new Site-save direct factory/context-owner case failed both predicates. Two untouched platform-seam cases remain failed. This is a failed full acceptance gate.+- Bounded 192-write baseline: six retained saved-container observations / twelve issues. Pending-change processing: three / six issues. MainActor: failed with 75 issues. Explicit owning-slot teardown: six / twelve issues. Final durable rollback: four / eight issues; all 192 actual contexts died and reopened data assertions passed. These controls do not trace the retaining owner or prove eventual release. Experiments were removed; no delays, polling, destructive reset or private API was added.+- Reviewed WIP source committed as 21bb415c17ebe217f773193a665d6dfd2f8c117b. Both tasks remain active. No further broad gate is justified without new causal evidence or approval of the documented contract correction.+- Fast and signed Mac results are reused with explicit scope proof: final observer changes affect only CoreTests, intersect no official-fast suite, and change no Mac-linked production source. Existing warnings remain. No installs, native/UI repeats or merges.+- Review proposal: [lifecycle-contract-proposal.md](lifecycle-contract-proposal.md). Physical deallocation and safe absence of later SDK activity are unproven; the strict assertions have not been silently replaced.
specs/shared-on-disk-test-fixture/lifecycle-contract-proposal.md Added
diff --git a/specs/shared-on-disk-test-fixture/lifecycle-contract-proposal.md b/specs/shared-on-disk-test-fixture/lifecycle-contract-proposal.mdnew file mode 100644index 00000000..3e1ac17d--- /dev/null+++ b/specs/shared-on-disk-test-fixture/lifecycle-contract-proposal.md@@ -0,0 +1,25 @@+# T1958 lifecycle contract — proposal awaiting approval++The approved approach says to capture `context.container` weakly during seeding and “assert nil at publisher entry.” Current source preserves that strict check. Unfiltered acceptance remains failed; this proposal is not implemented.++## Evidence and limit++The last controlled experiment performed 192 empty/Site/Entry operations. Four saved Site-container observations produced eight failed weak-container assertions: the direct factory and `context.container` probes each failed. Every weak actual `ModelContext` probe was nil after context-first/container-last release. Rollback ran only after confirming no unsaved changes following the existing durable save. All reopened row counts and raw nil relationships passed.++Saved containers also survived caller-pool draining, public pending-change processing, MainActor creation and explicit owning-slot teardown. This establishes observed retention beyond the context and measured fixture references. The retaining owner and eventual release are unproven; SDK/backend ownership is an inference, not a traced cause. The inspected public API provides no nondestructive synchronous container-close operation. No sleeps, polling, private API, destructive erase, app launch or live-data change was used.++## Proposed acceptance correction++A test-only owned-store lease would retain the actual container for each scoped operation or retained fixture. Every fixture-owned container must pass through that lease. Verify weak lease death **and actual ModelContext death** at readiness publication and root-removal entry. Scoped lease/context ownership must end before publication; retained ownership must remain valid throughout fixture use and end before root cleanup. Keep independent disk reopening, usable retained contexts, durable row-count and raw-relationship assertions. Preserve all 202 original test blocks, save/population order, capabilities, clocks, prefixes, custom paths and frozen-schema factories.++Physical container retention would remain explicitly documented and observable, rather than a claim of synchronous object death. The proposal adds no asynchronous fixture conversion, actor policy, polling, production API, schema or persisted-format change. It changes a specifically approved acceptance assertion and requires approval before implementation.++## Remaining risk++Lease/context death does not prove physical container deallocation, synchronous file-handle closure or absence of later SDK activity. Removing an isolated root while a container survives may affect delayed cleanup or produce late diagnostics. Reopened durable data and unchanged raw relationships support this narrower fixture-ownership contract, but do not prove that risk absent. The alternative is to retain the strict physical-death criterion and leave this extraction blocked until a supported lifetime boundary is established.++## Review and current deliverable++Quality and spec reviewers accept this as a concrete local proposal, with the limits above. Current WIP source retains failed strict checks; both Rune outcomes remain in progress. The affected 211 declarations / 300 invocations, fast 456 declarations and signed Mac app/extension build passed. Three unfiltered Core verdicts and all bounded diagnostic failures remain preserved. Latest unfiltered Core: 3,851 declarations, three failed cases containing four issues, and 55 opt-in skips; one new lifecycle case and two unchanged main platform-seam cases fail.++Evidence: `implementation.md`, `/tmp/t1958-ownership-inspection.md`, `/tmp/t1958-durable-rollback-control.log`, its receipt and `durable-rollback-swift-testing.xml` under `/tmp/t1958-review-inputs`. WIP code commit: `21bb415c17ebe217f773193a665d6dfd2f8c117b`; restored source matches the reviewed candidate and exact tested inputs. No command remains active.
specs/shared-on-disk-test-fixture/smolspec.md Added
diff --git a/specs/shared-on-disk-test-fixture/smolspec.md b/specs/shared-on-disk-test-fixture/smolspec.mdnew file mode 100644index 00000000..6dc01b96--- /dev/null+++ b/specs/shared-on-disk-test-fixture/smolspec.md@@ -0,0 +1,41 @@+# Shared on-disk test fixture — T-1958++## Overview+Core test suites duplicate temporary on-disk store setup, raw seeding, reopening and container retention. Consolidate that test infrastructure while preserving each suite's deliberately malformed data, bootstrap capabilities, epoch and original assertions. Current main fba443e9 has ten primary fixture consumers and six additional temporary-directory consumer files.++## Requirements+- Test fixtures MUST retain every ModelContainer backing a returned context for the fixture's lifetime. The explanatory retention comment MUST remain beside the shared owning storage.+- Scoped seeds MUST finish and release their container before readiness is published. Readiness publication and relationship population MUST occur only where the existing fixture already performs them. Retained-container fixtures MUST keep fresh contexts on their same retained container; reopen fixtures MUST keep opening a fresh container over the same file.+- Existing raw versus normalized seeding, post-seed mutation, .m4 versus .multiSite capabilities, diagnostics/quarantine inputs, save strategies, path prefixes, timestamps, URLs and graph identities MUST be preserved.+- Every existing test declaration, parameter set and assertion MUST remain. Fixtures MUST keep intentional orphan, duplicate-row, losing-citation and corrupt-file shapes without repairing them during extraction.+- Fixture clocks MUST preserve their immutable millisecond-quantized dates without duplicate stub classes.+- Temporary-directory ownership/cleanup MUST remain scoped to each test. The shared owner MUST remove its isolated root after fixture use, including consumers that currently leak roots; partially created roots MUST be removed if initialization throws. Operation failures MUST leave the still-owned fixture available for its existing diagnosis assertions, then cleanup on owner release. Frozen-schema fixtures MUST retain their existing schema-opening paths.+- Identical raw-record builders SHOULD share implementation; suite-specific builders MUST remain explicit when their default values or malformed-graph semantics differ.+- Existing opt-in performance budgets, warmups, sample counts, diagnostic labels and intentional requirement-specific ceiling helpers MUST remain unchanged.++## Implementation Approach+- Add test-only `Packages/AsterismCore/Tests/AsterismCoreTests/OnDiskLibraryTestSupport.swift`: shared temporary-directory ownership, current-schema store configuration without implicitly opening a container, scoped seed/mutation operations, retained reopen contexts, ordinary app/extension bootstrap and explicitly diagnosed repository construction.+- Compose the shared store in the fixtures in `IdentityLookupToleranceTests.swift`, `EntryDetailAndMergeToleranceTests.swift`, `TodayPresentationToleranceTests.swift`, `RefreshUnionInvariantTests.swift`, `FailClosedRegressionTests.swift`, `CitedPatternResolutionTests.swift`, `CitationResolutionParityTests.swift`, `BackupExportDegradedRefusalTests.swift`, `WritePathQuarantineTests.swift` and `ReteachDiagnosisComparisonTests.swift`, all under `Packages/AsterismCore/Tests/AsterismCoreTests/`.+- Keep local scenario construction where it differs; centralize matching low-level construction only after comparing values. Raw retained-container fixtures use their existing seed/diagnose conventions; normalized ready-marker fixtures keep their population pass followed by marker publication; CitedResolutionFixture keeps scoped raw writes and marker publication without a population pass because citation ownership intentionally stays on losing rows. Do not introduce a boolean mode that silently changes malformed data.+- Reuse the temporary-directory owner in `MarkerContractTests.swift`, `CertificationPathTests.swift`, `WriteSiteRelationshipTests.swift` (`WriteSiteRelationshipTests.TempDir` and `FixtureRelationshipTests.TempDir`), `V4RecordedStoreTests.swift`, `MirroringBootstrapLifecycleTests.swift` and `StoreMetadataTests.swift`. Schema factories in those suites remain local and unchanged.+- Replace the identical live-schema factory blocks in `SiteReconcilerTests.swift` and `SiteUnionProjectionTests.swift` with `LibraryRepository.openContainer(at:)`, preserving their explicit `directory/library.store` URL, configuration name, migration plan and `.none` mirroring. Share only directory ownership where useful; do not redirect these fixtures to the default store path.+- Replace only ReteachClock/WritePathClock with the existing FixedRepositoryClock; their callers preserve the same immutable dates.+- Reuse existing `LibraryRepository.openContainer`, `publishReadiness`, `SiteRelationshipPopulationPass`, `FixedRepositoryClock` and `LibraryConfiguration`; do not change production APIs. `M5Fixture` is the existing lifetime-owning class pattern, but seeds through the repository and cannot replace raw malformed-store fixtures.+- Shared seed/write work runs in a separate scoped helper so its context/container leave scope before readiness publication. Use a test-only readiness-publisher seam (defaulting to the existing publisher) and the existing WeakContainerBox pattern from MirroringBootstrapLifecycleTests: capture `context.container` weakly during seeding and assert nil at publisher entry. A failed seed must not invoke the publisher.+- Add focused contracts in `OnDiskLibraryTestSupportTests.swift` for same-container fresh contexts versus different-container disk reopening, both with usable retained contexts; scoped ready seeding/release, mutation that does not repair relationships, isolated roots and cleanup after success/failure. Run the ten existing fixture suites (118 current declarations), the two live-factory suites (25 current declarations) and the six directory consumers, verifying actual identifiers and counts.+- Run the official fast manifest and one final unfiltered serial Core gate through Makefile with private scratch/cache paths. Retain actual opt-in skips. Keep the signed Mac app/extension compile bar. No app/native or rendered UI behavior changes: no unchanged broad UI repeat is needed for this test-only dependency scope.+- Out of scope: production schema/store/lock paths, migration/archive/wire formats, live data, device installation, app behavior, budget re-banding, sampling/ceiling-policy consolidation, unrelated fixture families and PR107.+++## Planned implementation outcomes+1. Shared on-disk lifecycle and raw-seeding support preserves all ten fixture consumers and their 118 existing declarations; new lifetime/readiness/mutation contracts and each affected suite verify the unchanged graph semantics.+2. Shared directory ownership, equivalent live-factory reuse and immutable clock reuse preserve the six directory files and two factory suites (25 declarations), including frozen-schema paths and failure cleanup. Targeted consumer checks plus official fast, final unfiltered Core and signed Mac/extension compilation verify this complete test-only change.++## Risks and Assumptions+- Risk: shortening ModelContainer lifetime crashes real SwiftData tests. Mitigation: explicit shared retention, documented ownership, lifecycle contracts and real on-disk targeted suites; no in-memory substitute.+- Risk: universal seeding repairs data a tolerance test intentionally keeps broken. Mitigation: preserve each fixture's exact normalization/marker policy and local scenario construction; verify all original assertions.+- Risk: temporary-directory reuse opens a recorded store with the live schema. Mitigation: share directory ownership only in frozen-schema consumers, preserving their current factories and release-before-live-open ordering.+- Assumption: this is mechanical test-support maintenance. No user-visible choice or irreversible public/persisted boundary changes; the whole change can be reverted without changing library data.++## Escalation Note+This change was scoped as a smolspec. If implementation reveals ambiguity only the user can resolve, an irreversible boundary (public API, persisted schema, auth path), or a contested architectural choice, stop and escalate to the full spec workflow rather than deciding it inline.
specs/shared-on-disk-test-fixture/tasks.md Added
diff --git a/specs/shared-on-disk-test-fixture/tasks.md b/specs/shared-on-disk-test-fixture/tasks.mdnew file mode 100644index 00000000..5a606c71--- /dev/null+++ b/specs/shared-on-disk-test-fixture/tasks.md@@ -0,0 +1,17 @@+---+references:+    - specs/shared-on-disk-test-fixture/smolspec.md+    - specs/shared-on-disk-test-fixture/decision_log.md+---+# T-1958 approved implementation outcomes++## Shared test support++- [-] 1. On-disk fixture consumers preserve graph semantics through shared lifecycle support and verified lifetime/readiness contracts <!-- id:e8iyb8t -->+  - Stream: 1+  - References: specs/shared-on-disk-test-fixture/smolspec.md++- [-] 2. Remaining directory/factory/clock consumers preserve paths, isolation and failure cleanup with targeted and final Core/Mac verification <!-- id:e8iyb8u -->+  - Blocked-by: e8iyb8t (On-disk fixture consumers preserve graph semantics through shared lifecycle support and verified lifetime/readiness contracts)+  - Stream: 1+  - References: specs/shared-on-disk-test-fixture/smolspec.md

Things to double-check

Full gate qualification

Full Core failed one new lifetime case (Site-save direct factory/context-owner probes) and two untouched main platform-seam cases. Physical container death, the retaining owner, eventual release and absence of later SDK activity remain unproven. All owned commands drained.

Historical failures

Four compile-only failures executed zero tests. First two Core gates failed four cases/four issues. Latest failed three cases/four issues; earlier seed/cleanup probes pass in that run but the added Site-save physical-release case fails. Opt-in skips are not passes; no unchanged broad UI/native gates were repeated.

Exact tested source

Tests ran on dirty approved-plan checkpoint33c479fe. All20 restored Swift input hashes match the reviewed candidate committed as21bb415c; finaldf736659 adds only documentation. The Mac and fast results have explicit unchanged-consumer scope proof. Historical failures are preserved separately, without another broad rerun.