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

オープン
#384 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
17
フォーク
15
平均マージ
1日 8時間
マージ済み PR(30日)
6

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ynput/ayon-python-api のほかの issue

ynput/ayon-python-api の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。