ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Add dockable Art tools, animation and previews, guarded asset workflows, and the Web Asset Studio built on the shared Art Core. Expand English and Russian documentation, interactive Try scenes, examples and editor icons. Add audio waveform navigation, source analysis, guarded previews and a browser Worker mixer. Preserve source changes and recovery with bounded checks, and strengthen native, browser and interoperability CI. Prepare version 0.12.5 and manually built native artifact candidates. Fix the production site image demo build dependency. Reuse immutable scene indices when capturing keyframes. Wait for real Persist save/load completion in component tests. Stabilize browser Game View captures outside pointer hover. Aseprite interchange and persistent Audio EDL recovery remain limited; the artifact workflow does not publish releases or change stable.
100 lines
3.3 KiB
Go
100 lines
3.3 KiB
Go
//go:build linux
|
|
|
|
package pipeline
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"aego/core/log"
|
|
)
|
|
|
|
// Both failures use actual directory permissions in this test-owned project:
|
|
// the second publication fails, and rollback of the first publication fails.
|
|
// Neither error may be lost, and recovery stays an explicit decision.
|
|
func TestSourceWriteAndRollbackFailureRequireExplicitRecovery(t *testing.T) {
|
|
if os.Geteuid() == 0 {
|
|
t.Skip("a privileged process can bypass the filesystem permission fixture")
|
|
}
|
|
p := newProject(t)
|
|
a := write(t, p, "assets/first/a.txt", "old-a")
|
|
b := write(t, p, "assets/second/b.txt", "old-b")
|
|
pl := recoveryTestPipeline(t, p)
|
|
defer pl.Close()
|
|
firstDir, secondDir := filepath.Dir(a), filepath.Dir(b)
|
|
defer func() {
|
|
_ = os.Chmod(firstDir, 0755)
|
|
_ = os.Chmod(secondDir, 0755)
|
|
}()
|
|
metaA, err := os.ReadFile(a + MetaSuffix)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
metaB, err := os.ReadFile(b + MetaSuffix)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
reached := false
|
|
pl.sourceTransactionCheckpoint = func(stage, rel string) {
|
|
if stage != "published" || rel != "assets/first/a.txt" {
|
|
return
|
|
}
|
|
reached = true
|
|
if err := os.Chmod(firstDir, 0555); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.Chmod(secondDir, 0555); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
edits := []SourceEdit{
|
|
{Path: "assets/first/a.txt", Before: []byte("old-a"), After: []byte("new-a")},
|
|
{Path: "assets/second/b.txt", Before: []byte("old-b"), After: []byte("new-b")},
|
|
}
|
|
_, err = pl.ApplySources(edits, false)
|
|
pl.sourceTransactionCheckpoint = nil
|
|
if !reached || err == nil || !errors.Is(err, os.ErrPermission) || !strings.Contains(err.Error(), "assets/second/") || !strings.Contains(err.Error(), "cannot roll back assets/first/a.txt") {
|
|
t.Fatalf("missing original write or rollback failure: reached=%v err=%v", reached, err)
|
|
}
|
|
t.Logf("real write and rollback failures preserved: %v", err)
|
|
if got, err := os.ReadFile(a); err != nil || string(got) != "new-a" {
|
|
t.Fatalf("expected the first source to remain interrupted: %q, %v", got, err)
|
|
}
|
|
if got, err := os.ReadFile(b); err != nil || string(got) != "old-b" {
|
|
t.Fatalf("failed publication changed the second source: %q, %v", got, err)
|
|
}
|
|
if status, err := SourceRecoveryStatus(p); err != nil || status == nil || status.State != "prepared" {
|
|
t.Fatalf("double failure did not retain the journal: %+v, %v", status, err)
|
|
}
|
|
if _, err := pl.ApplySources(edits, false); err == nil {
|
|
t.Fatal("a subsequent edit overtook the pending recovery")
|
|
}
|
|
if other, err := Open(p, NewImporterRegistry(), log.Nop()); err == nil {
|
|
other.Close()
|
|
t.Fatal("opening the project silently accepted pending recovery")
|
|
}
|
|
if err := os.Chmod(firstDir, 0755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.Chmod(secondDir, 0755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pl.Close()
|
|
if err := RestoreSourceRecovery(p); err != nil {
|
|
t.Fatalf("explicit recovery after fixing permissions: %v", err)
|
|
}
|
|
for name, want := range map[string][]byte{a: []byte("old-a"), b: []byte("old-b"), a + MetaSuffix: metaA, b + MetaSuffix: metaB} {
|
|
got, err := os.ReadFile(name)
|
|
if err != nil || !bytes.Equal(got, want) {
|
|
t.Fatalf("recovery did not restore %s: %q, %v", name, got, err)
|
|
}
|
|
}
|
|
if status, err := SourceRecoveryStatus(p); err != nil || status != nil {
|
|
t.Fatalf("recovery remains pending: %+v, %v", status, err)
|
|
}
|
|
}
|