아바타 저장소 승격 계약을 완성

This commit is contained in:
Yun Chan 2026-08-29 23:58:33 +09:00
parent ac9b702688
commit ccdcfcd2f5
36 changed files with 14734 additions and 222 deletions

View file

@ -17,6 +17,10 @@ HIDDEN_TRIGGER = SCRIPTS / "watch-public-runtime-hidden.vbs"
TASK_LAUNCHER = SCRIPTS / "watch-public-runtime-task.vbs"
START = SCRIPTS / "start-public-runtime.ps1"
VOICE_PROBE = SCRIPTS / "probe-public-voice-sidecars.py"
UPLOAD_ROOT_CONTRACT = SCRIPTS / "public-runtime-upload-root.ps1"
UPLOAD_ROOT_PROBE = SCRIPTS / "probe-public-runtime-upload-root.py"
UPLOAD_MANIFEST_PROBE = SCRIPTS / "validate-public-runtime-upload-manifest.py"
DATABASE_IDENTITY = SCRIPTS / "public_runtime_database_identity.py"
REPO_ROOT = SCRIPTS.parent
RUNBOOK = REPO_ROOT / "docs" / "ops" / "public-runtime-watchdog.md"
LOCAL_DEVELOPMENT = REPO_ROOT / "docs" / "guides" / "local-development.md"
@ -72,6 +76,7 @@ class PublicRuntimeWatchdogProvenanceTest(unittest.TestCase):
'"-ExpectedSourceTree $sourceTree"',
'"-ExpectedWatchdogSha256 $watchdogSha256"',
'"-ExpectedStartScriptSha256 $startScriptSha256"',
'"-UserUploadDir `"$resolvedUserUploadDir`""',
"-WorkingDirectory $resolvedSourceRoot",
"Watchdog installer is not executing from the pinned stable source root",
):
@ -111,6 +116,7 @@ class PublicRuntimeWatchdogProvenanceTest(unittest.TestCase):
'"-ExpectedSourceTree $sourceTree"',
'"-ExpectedBootScriptSha256 $bootScriptSha256"',
'"-ExpectedStartScriptSha256 $startScriptSha256"',
'"-UserUploadDir `"$resolvedUserUploadDir`""',
"-WorkingDirectory $resolvedSourceRoot",
"Boot task registrar is not executing from the pinned stable source root",
):
@ -247,10 +253,19 @@ exit 0
self.assertIn("$voiceSidecarsAfter = Test-VoiceSidecarStack", WATCHDOG_SOURCE)
self.assertIn('-Name "voice-api"', WATCHDOG_SOURCE)
self.assertIn("$voiceApiAfter = Test-JsonHealth", WATCHDOG_SOURCE)
self.assertIn(
"(Test-ApiControlPlaneHealthy) -and (Test-EngineHealthy) -and (Test-VoiceApiHealthy) -and (Test-VoiceSidecarStack)",
BOOT_SOURCE,
)
boot_skip_gate = BOOT_SOURCE[
BOOT_SOURCE.index("$webHealthy = Test-WebPreviewHealthy") :
BOOT_SOURCE.index("$startArgs = @(")
]
for expected in (
"(Test-ApiControlPlaneHealthy)",
"(Test-EngineHealthy)",
"(Test-VoiceApiHealthy)",
"(Test-VoiceSidecarStack)",
"(Test-PublicRuntimeApiUploadRoot `",
):
with self.subTest(expected=expected):
self.assertIn(expected, boot_skip_gate)
self.assertGreaterEqual(BOOT_SOURCE.count("Test-VoiceApiHealthy"), 3)
self.assertIn('"-WhisperPort", $WhisperPort', BOOT_SOURCE)
self.assertIn('"-MeloTtsPort", $MeloTtsPort', BOOT_SOURCE)
@ -460,6 +475,7 @@ if ($result.Detail -ne 'exact readiness probe failed') {
"-ExpectedSourceTree",
"-ExpectedWatchdogSha256",
"-ExpectedStartScriptSha256",
"-UserUploadDir",
"WorkingDirectory",
"Pinned watchdog script path does not match its working directory",
"Pinned watchdog source root does not match its working directory",
@ -494,6 +510,7 @@ if ($result.Detail -ne 'exact readiness probe failed') {
"-ExpectedSourceTree",
"-ExpectedWatchdogSha256",
"-ExpectedStartScriptSha256",
"-UserUploadDir",
"--porcelain=v1 --untracked-files=normal",
):
with self.subTest(expected=expected):
@ -514,6 +531,10 @@ if ($result.Detail -ne 'exact readiness probe failed') {
copied_boot_register = scripts / BOOT_REGISTER.name
copied_start = scripts / START.name
copied_voice_probe = scripts / VOICE_PROBE.name
copied_upload_contract = scripts / UPLOAD_ROOT_CONTRACT.name
copied_upload_probe = scripts / UPLOAD_ROOT_PROBE.name
copied_upload_manifest_probe = scripts / UPLOAD_MANIFEST_PROBE.name
copied_database_identity = scripts / DATABASE_IDENTITY.name
copied_task_launcher = scripts / TASK_LAUNCHER.name
shutil.copy2(WATCHDOG, copied_watchdog)
shutil.copy2(INSTALLER, copied_installer)
@ -521,6 +542,10 @@ if ($result.Detail -ne 'exact readiness probe failed') {
shutil.copy2(BOOT_REGISTER, copied_boot_register)
shutil.copy2(START, copied_start)
shutil.copy2(VOICE_PROBE, copied_voice_probe)
shutil.copy2(UPLOAD_ROOT_CONTRACT, copied_upload_contract)
shutil.copy2(UPLOAD_ROOT_PROBE, copied_upload_probe)
shutil.copy2(UPLOAD_MANIFEST_PROBE, copied_upload_manifest_probe)
shutil.copy2(DATABASE_IDENTITY, copied_database_identity)
shutil.copy2(TASK_LAUNCHER, copied_task_launcher)
self._git(root, "init")
@ -535,6 +560,10 @@ if ($result.Detail -ne 'exact readiness probe failed') {
"scripts/register-boot-task.ps1",
"scripts/start-public-runtime.ps1",
"scripts/probe-public-voice-sidecars.py",
"scripts/public-runtime-upload-root.ps1",
"scripts/probe-public-runtime-upload-root.py",
"scripts/validate-public-runtime-upload-manifest.py",
"scripts/public_runtime_database_identity.py",
"scripts/watch-public-runtime-task.vbs",
)
self._git(root, "commit", "-m", "watchdog fixture")
@ -544,6 +573,10 @@ if ($result.Detail -ne 'exact readiness probe failed') {
watchdog_hash = sha256(copied_watchdog)
boot_hash = sha256(copied_boot)
start_hash = sha256(copied_start)
upload_root = Path(
tempfile.mkdtemp(prefix="vignette-watchdog-uploads-")
)
self.addCleanup(shutil.rmtree, upload_root, True)
with copied_start.open("ab") as stream:
stream.write(b"\n# dirty fixture\n")
@ -566,6 +599,14 @@ if ($result.Detail -ne 'exact readiness probe failed') {
watchdog_hash,
"-ExpectedStartScriptSha256",
start_hash,
"-UserUploadDir",
str(upload_root),
"-UserUploadManifestPath",
str(root / "private-manifest.json"),
"-ExpectedUserUploadManifestSha256",
"e" * 64,
"-UserUploadWriteFreezePath",
str(root / "private-freeze.json"),
"-CheckOnly",
"-SkipPublicHealth",
"-SkipCloudflaredRestart",
@ -601,6 +642,14 @@ if ($result.Detail -ne 'exact readiness probe failed') {
boot_hash,
"-ExpectedStartScriptSha256",
start_hash,
"-UserUploadDir",
str(upload_root),
"-UserUploadManifestPath",
str(root / "private-manifest.json"),
"-ExpectedUserUploadManifestSha256",
"e" * 64,
"-UserUploadWriteFreezePath",
str(root / "private-freeze.json"),
],
check=False,
capture_output=True,
@ -625,6 +674,14 @@ if ($result.Detail -ne 'exact readiness probe failed') {
str(registrar),
"-StableSourceRoot",
str(root),
"-UserUploadDir",
str(upload_root),
"-UserUploadManifestPath",
str(root / "private-manifest.json"),
"-ExpectedUserUploadManifestSha256",
"e" * 64,
"-UserUploadWriteFreezePath",
str(root / "private-freeze.json"),
],
check=False,
capture_output=True,
@ -644,7 +701,7 @@ if ($result.Detail -ne 'exact readiness probe failed') {
powershell = shutil.which("powershell.exe")
if powershell is None:
self.skipTest("Windows PowerShell 5.1 is unavailable")
for script in (WATCHDOG, INSTALLER, BOOT, BOOT_REGISTER):
for script in (WATCHDOG, INSTALLER, BOOT, BOOT_REGISTER, UPLOAD_ROOT_CONTRACT):
escaped = str(script.resolve()).replace("'", "''")
command = (
"$tokens=$null; $errors=$null; "
@ -710,7 +767,11 @@ if ($result.Detail -ne 'exact readiness probe failed') {
f"-ExpectedSourceCommit {'a' * 40} "
f"-ExpectedSourceTree {'b' * 40} "
f"-ExpectedWatchdogSha256 {'c' * 64} "
f"-ExpectedStartScriptSha256 {'d' * 64}"
f"-ExpectedStartScriptSha256 {'d' * 64} "
f'-UserUploadDir "C:\\Persistent Vignette Uploads" '
f'-UserUploadManifestPath "C:\\Private Vignette State\\manifest.json" '
f"-ExpectedUserUploadManifestSha256 {'e' * 64} "
f'-UserUploadWriteFreezePath "C:\\Private Vignette State\\freeze.json"'
)
fixture = (
"$script:watchdogTriggered=$false;"