Files
aego/asset/pipeline/current.go
T
sanspie 50be5c04bc
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
Stage 12.5: Art Workspace and asset authoring
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.
2026-11-15 10:37:50 +03:00

92 lines
2.7 KiB
Go

package pipeline
import (
"fmt"
"aego/core/ids"
)
// VerifyCurrent checks source and settings against the last successful import key without changing state.
// Strict export uses it when last-good artifacts may outlive invalid source; generated atlas pages require all source members to be current.
func (p *Pipeline) VerifyCurrent(id ids.AssetID) error {
p.mu.RLock()
defer p.mu.RUnlock()
if err := p.requireNoPendingSourceRecovery(); err != nil {
return fmt.Errorf("cannot verify an asset while source recovery is pending: %w", err)
}
if r := p.byID[id]; r != nil {
return p.verifyCurrent(r)
}
if r := p.subs[id]; r != nil {
return p.verifyCurrent(r)
}
for group, page := range p.pages {
if page != id {
continue
}
members := p.groups[group]
if len(members) == 0 {
return fmt.Errorf("atlas %s has no current source members", group)
}
for _, member := range members {
r := p.byID[member]
if r == nil {
return fmt.Errorf("atlas %s has a missing source member %s", group, member)
}
if err := p.verifyCurrent(r); err != nil {
return err
}
}
if p.groupKey[group] != p.groupCacheKey(group, members) {
return fmt.Errorf("atlas %s needs reimport", group)
}
return nil
}
return fmt.Errorf("asset %s has no current import record", id)
}
func (p *Pipeline) verifyCurrent(r *record) error {
if r.err != "" {
return fmt.Errorf("%s: latest import failed: %s", r.path, r.err)
}
if r.importer == nil || r.key == "" {
return fmt.Errorf("%s has no successful current import", r.path)
}
source, err := p.read(r.path)
if err != nil {
return fmt.Errorf("%s: cannot read current source: %w", r.path, err)
}
metaSource, err := p.read(r.path + MetaSuffix)
if err != nil {
return fmt.Errorf("%s: cannot read current metadata: %w", r.path, err)
}
meta, err := ParseMeta(metaSource, r.path+MetaSuffix)
if err != nil {
return err
}
if meta.Importer == "" {
meta.Importer = r.importer.ID()
}
for key, value := range r.importer.Defaults() {
if _, exists := meta.Settings[key]; !exists {
meta.Settings[key] = value
}
}
if meta.ID != r.id || meta.Importer != r.importer.ID() {
return fmt.Errorf("%s: asset identity or importer changed; rescan and reimport", r.path)
}
current := *r
current.meta = meta
var salt []byte
if imp, ok := r.importer.(CacheSalter); ok {
salt, err = imp.CacheSalt(&ImportContext{ID: r.id, Path: r.path, Source: source, Meta: meta, Read: p.read, Lookup: p.lookup, SourcePath: p.pathOf, Log: p.log})
if err != nil {
return err
}
}
if p.cacheKey(&current, source, r.deps, salt) != r.key {
return fmt.Errorf("%s: current source or import settings changed; reimport before export", r.path)
}
return nil
}