diff --git a/docs/superpowers/plans/2026-08-04-release-decke.md b/docs/superpowers/plans/2026-08-04-release-decke.md index 5629256..4cd2ddd 100644 --- a/docs/superpowers/plans/2026-08-04-release-decke.md +++ b/docs/superpowers/plans/2026-08-04-release-decke.md @@ -275,29 +275,50 @@ use Illuminate\Support\Facades\Process; */ function runAgentWithCeiling(?string $ceiling, array $tags, string $deployedVersion = '1.7.3'): array { - $dir = storage_path('app/deploy'); - File::ensureDirectoryExists($dir); - File::delete(File::glob($dir.'/*')); + // Ein WEGWERF-Checkout mit EIGENEM .git — niemals das Repository dieses + // Arbeitsbaums. + // + // Tags liegen im gemeinsamen .git und sind damit auch fuer den Hauptbaum + // und jede Parallelsitzung sichtbar. Ein hier angelegtes v9.9.9 wuerde + // `git tag -l 'v*' --sort=-v:refname | head -1` falsch beantworten — und + // genau diese Frage entscheidet, wohin ein Server aktualisiert. Stirbt der + // Test vor seinem Aufraeumen, bliebe es liegen. + // + // Der Agent bestimmt seine Wurzel aus dem eigenen Pfad + // (`ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"`). Es genuegt + // also, deploy/ zu kopieren und ihn dort zu starten. + $root = sys_get_temp_dir().'/clupilot-ceiling-'.bin2hex(random_bytes(6)); + File::ensureDirectoryExists($root.'/deploy/lib'); + File::ensureDirectoryExists($root.'/storage/app/deploy'); - // Der Agent liest die ausgelieferte Version aus dem Manifest. - File::put($dir.'/deployment.json', json_encode([ + File::copy(base_path('deploy/update-agent.sh'), $root.'/deploy/update-agent.sh'); + File::copy(base_path('deploy/lib/release.sh'), $root.'/deploy/lib/release.sh'); + + // MANIFEST_FILE ist `storage/app/deployment.json` — eine Ebene UEBER + // storage/app/deploy/. Siehe deploy/lib/release.sh:19. + File::put($root.'/storage/app/deployment.json', json_encode([ 'version' => $deployedVersion, 'commit' => 'deadbeef', 'source' => 'refs/tags/v'.$deployedVersion, ])); if ($ceiling !== null) { - File::put($dir.'/release-ceiling', $ceiling); + File::put($root.'/storage/app/deploy/release-ceiling', $ceiling); } $tagCommands = ''; foreach ($tags as $tag) { - $tagCommands .= "git tag {$tag} 2>/dev/null || true\n"; + $tagCommands .= "git tag {$tag}\n"; } - $result = Process::path(base_path())->timeout(90)->run(<<timeout(90)->run(<< "\$stub/git" <<'GIT' #!/bin/sh if [ "\$1" = "fetch" ]; then exit 0; fi @@ -306,20 +327,18 @@ function runAgentWithCeiling(?string $ceiling, array $tags, string $deployedVers chmod +x "\$stub/git" printf '#!/bin/sh\nexit 1\n' > "\$stub/docker" chmod +x "\$stub/docker" - {$tagCommands} PATH="\$stub:\$PATH" bash deploy/update-agent.sh >/dev/null 2>&1 || true rm -rf "\$stub" BASH); expect($result->successful())->toBeTrue($result->errorOutput()); - return json_decode(File::get($dir.'/update-status.json'), true); -} + $status = json_decode(File::get($root.'/storage/app/deploy/update-status.json'), true); -afterEach(function () { - File::deleteDirectory(storage_path('app/deploy')); - Process::path(base_path())->run("git tag -d v9.9.8 v9.9.9 2>/dev/null || true"); -}); + File::deleteDirectory($root); + + return $status; +} it('offers only up to the ceiling', function () { // Ausgeliefert 1.7.3, vorhanden bis v9.9.9, Decke auf v9.9.8: genau eine