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

Ouverte
#384 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
72/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Python
Étoiles
17
Forks
15
Merge moyen
1 j 8 h
PR mergées (30 j)
6

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de ynput/ayon-python-api

Toutes les issues de ynput/ayon-python-api

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.