get_last_versions(active=True) returns nothing when the newest version is inactive — next publish restarts at v001

Aperta
#384 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start in ayon_api/_api_helpers/versions.py and trace how latestOnly is sent and how the client applies the active filter. Check the query behavior against the reproduction with active versions v001–v005 and inactive v006; verify that the last active version returned is v005. Done means a subsequent publish uses v006 rather than restarting at v001.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

get_last_versions(..., active=True) (the default) returns nothing for a product whose newest version is inactive, even when older active versions exist. Publishing then restarts at version 1, and the core integrator updates the existing v001 instead of creating a new version.

Where

ayon_api/_api_helpers/versions.py (checked on develop at 4b248d4): with latest=True the query sends latestOnly: true to the server, and the active filter is applied afterwards, on the client:

if latest:
    standard_query.set_variable_value("latestOnly", True)
...
for version in parsed_data["project"]["versions"]:
    if active is not None and version["active"] is not active:
        continue

The server returns only the newest version (the inactive one), the client drops it, and the product looks like it has no versions.

Steps to reproduce

  1. A product with versions v001…v005, all active.
  2. Publish v006, then deactivate it (active = False), e.g. from the web UI.
  3. get_last_versions(project, [product_id]) → {} (expected: v005).
  4. Publish again: ayon-core's CollectAnatomyInstanceData finds no last version and uses the versioning start (1); IntegrateAsset finds the existing v001 and updates it in place: its representations/files are replaced by the new publish (and on a shared storage the v001 files would be overwritten).

Expected

The latest active version (v005), so the next publish is v006 (but never v001).

Environment

AYON server 1.17.3, ayon-core 1.9.12, AYON launcher 1.6.3 (Python 3.11.9), Windows client. Same code on ayon-python-api develop 4b248d4.

Possible fix

When latest and active are both set, either filter by active on the server side before "latest" is applied, or (if the server can't) query without latestOnly and pick the highest version per product among the matching ones on the client.

Lingua principale
Python
Stelle
17
Fork
15
Merge medio
1g 8h
PR unite (30g)
6

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ynput/ayon-python-api

Tutte le issue di ynput/ayon-python-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.