commit 44c44b25cdd3cb66157185f4278080b1396b5928
parent d395b375a0af64690b76bea6afc6e21ab18c5f34
Author: triesap <tyson@radroots.org>
Date: Fri, 4 Sep 2026 22:00:16 +0000
fix(desktop): provision packaged health state root
- create the governed RepoLocal state root only inside the claimed health directory
- preserve runtime authority over the service and instance suffix
- assert both created and caller-provided health roots are ready before open
- retain ownership-checked cleanup after successful or failed health execution
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/app/desktop/src/main/kotlin/org/harvestcircle/desktop/Main.kt b/app/desktop/src/main/kotlin/org/harvestcircle/desktop/Main.kt
@@ -54,6 +54,7 @@ internal const val HEALTH_DATA_ENVIRONMENT = "HARVESTCIRCLE_DEVELOPMENT_DATA_DIR
private const val HEALTH_FAILURE_EVIDENCE = "HARVESTCIRCLE_HEALTH_FAILED"
private const val HEALTH_TIMEOUT_MILLIS = 90_000L
private const val HEALTH_OWNER_MARKER = ".harvestcircle-health-owner-v1"
+internal const val HEALTH_REPO_LOCAL_STATE_ROOT = "data"
private const val HEALTH_OWNER_TOKEN_BYTES = 16
private val healthOwnershipRandom = SecureRandom()
@@ -192,6 +193,7 @@ internal suspend fun executeHealthCheck(
try {
withTimeout(timeoutMillis) {
ownedRoot = claimHealthDataRoot(developmentDataDirectory)
+ Files.createDirectory(requireNotNull(ownedRoot).path.resolve(HEALTH_REPO_LOCAL_STATE_ROOT))
stage = "COMPATIBILITY"
verifyNativeCompatibility(compatibilityDescriptor())
stage = "OPEN"
diff --git a/app/desktop/src/test/kotlin/org/harvestcircle/desktop/MainTest.kt b/app/desktop/src/test/kotlin/org/harvestcircle/desktop/MainTest.kt
@@ -118,6 +118,7 @@ class MainTest {
PackagedHealthRuntimeOpener { ownedRoot ->
openCalls += 1
openedRoots.add(ownedRoot)
+ assertTrue(Files.isDirectory(ownedRoot.resolve(HEALTH_REPO_LOCAL_STATE_ROOT)))
Files.writeString(ownedRoot.resolve("runtime.sqlite3"), "runtime data")
successfulRuntime()
},