SG-43935 data model derivative update (base branch)#224
Open
yungsiow wants to merge 24 commits into
Open
Conversation
Move Flow AM publish hooks from tk-config-flowam POC into upstream tk-multi-publish2 as a lift-and-shift with no logic changes. Added hooks/flowam/: - collector_dcc.py: DCC-specific collector extending base collector - pre_publish.py: pre-publish validation for Flow AM draft state - publish_alembic_derivative.py: publish alembic derivative workflow - publish_to_flow.py: base publish to Flow AM hook - publish_to_flow_dcc.py: DCC-specific publish to Flow AM hook - icons/alembic.png, icons/flow.png: icons referenced by publish hooks
- Remove collector_dcc.py - only called super() with no additional logic; Toolkit hook chain handles passthrough automatically - Remove alembic.png icon - licensing concern; icon() now returns the alembic icon under hooks/icons/alembic.png - Remove unused `settings` param from _publish_to_flow() across in publish_to_flow.py and its children - Add return type annotations to new (non-overridden) methods: _get_flow_module() -> ModuleType, _get_draft_id() -> str | None - Update class docstrings to accurately describe responsibilities and expected hook chain configuration for each hook - Add finalize() docstring explaining why the no-op override is needed
…tained hook The shared base class FlowPublishPlugin (publish_to_flow.py) and its DCC leaf (publish_to_flow_dcc.py) are merged into a single self-contained DccFlowPublishPlugin in publish_to_flow.py. This removes the 3-class hierarchy (publish_file -> FlowPublishPlugin -> FlowDccPublishPlugin) in favour of two independent plugins - one per context (DCC and desktop) - each subclassing publish_file.py directly. The desktop counterpart lives in tk-desktop. Independent release cycles between the two repos no longer require a shared base class in tk-multi-publish2. Changes: - publish_to_flow.py: rewritten as DccFlowPublishPlugin with all validation (project + draft + conflict check) merged into a single validate(), and _get_flow_args inlined into _publish_to_flow - publish_to_flow_dcc.py: deleted (merged into publish_to_flow.py)
…top subclasses Restore the base + subclass layout from the original tk-config-flowam POC, now living entirely under tk-multi-publish2 (no Flow AM publish hooks in tk-desktop anymore). - publish_to_flow.py: FlowPublishPlugin base class with shared properties, project-level validation, publish/finalize/get_publish_user, and _get_flow_args helper. - publish_to_flow_dcc.py: DccFlowPublishPlugin adds draft validation and conflict check; publishes via publish_dcc_draft. - publish_to_flow_desktop.py: DesktopFlowPublishPlugin rejects Maya files, adds revision validation, and publishes via publish_generic_revision or create_generic_workfile. - collector_desktop.py: desktop-only collector moved from tk-desktop.
- Embed Flow AM publish logic directly into the stock collector, pre_publish, and publish_file hooks, gated on ctx.flow_project_id - Add python/tk_multi_publish2/flowam/ package with publish, validate, inputs, constants, and exceptions modules - Expose flowam package via app.py as self.parent.flowam - collector.py: capture TK_FLOWAM_REVISION_ID_* env var for Desktop revision publishes; block DCC extensions via FLOWAM_DCC_EXTENSIONS - pre_publish.py: add Flow AM project validation branch - publish_file.py: add Flow AM validate/publish/finalize branches for both DCC (draft-based) and Desktop (generic asset) publish paths - publish_alembic_derivative.py: drop load_framework calls, use SDK imports and self.parent.flowam directly - Eliminate tk-framework-flowam dependency
feat: [SG-43419] Flow AM publish hooks migration (Phase 2) + single file mode - Add single_file_mode param to show_dialog() and AppDialog to restrict publisher to one file when republishing a Flow AM generic asset from Loader
- add .flake8 config copied from tk-core - handle flow generic publish from nuke FlowWrite node
- add vim file types to .gitignore - remove check for asset conflict - remove sg_task_name from CreateGenericInputs - removed several functions from validate.py and moved the one remaining function validate_generic_asset() into publish.py - after first dcc publish, add variant set component to parent pointing to dcc asset - better error handling in derivative publish process - store version id instead of revision id on derivative source component - after first derviative publish, add variant set component to parent pointing to derivative asset
When Flow AM is active, validate/publish/finalize were falling through into FPT logic after the Flow AM branch, causing both a Flow AM revision and an FPT PublishedFile to be created on every publish. On partial failure this left orphaned records in one system. - validate: return _flow_validate() result directly, skipping FPT conflict-publish check entirely - publish: return after _flow_publish(), skipping sgtk.util.register_publish - finalize: early return when Flow AM active, since sg_publish_data does not exist on Flow AM publishes
The accept() method was rejecting the plugin whenever storage_key_to_asset_id raised FlowError (asset not found in MEDM), which happens on first-time publishes before the asset exists. This caused the alembic derivative plugin to be invisible until at least one publish had already been completed. Fix by reading the local draft info instead of querying MEDM to determine whether the asset is a template: - NewDraftInfo (unpublished asset): check type_ids from local draft file - CheckoutDraftInfo (published asset): query FlowAsset.type_ids from MEDM This correctly distinguishes between "not a template" and "not yet published", so the plugin is visible from the very first publish attempt.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #224 +/- ##
==========================================
+ Coverage 41.21% 48.12% +6.90%
==========================================
Files 62 58 -4
Lines 5054 3836 -1218
==========================================
- Hits 2083 1846 -237
+ Misses 2971 1990 -981
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
chenm1adsk
reviewed
Jul 15, 2026
chenm1adsk
left a comment
Contributor
There was a problem hiding this comment.
Left a question and some small issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NOTE: this branch will be treated as the base branch for publisher changes involving the Data Model project