Skip to content

feat:[SG-43421] Migrate FlowAM publish hooks phase1 & 2#217

Open
chenm1adsk wants to merge 9 commits into
masterfrom
ticket/SG-43421-flowam-publish-hooks-phase1
Open

feat:[SG-43421] Migrate FlowAM publish hooks phase1 & 2#217
chenm1adsk wants to merge 9 commits into
masterfrom
ticket/SG-43421-flowam-publish-hooks-phase1

Conversation

@chenm1adsk

@chenm1adsk chenm1adsk commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates Flow AM publish hooks from tk-config-flowam POC into upstream tk-multi-publish2 in two phases, eliminating the tk-framework-flowam dependency.

Phase 1 - Lift-and-shift the hook chain into hooks/flowam/, then refactored into a single self-contained DccFlowPublishPlugin + Desktop counterpart, each subclassing publish_file.py directly.

Phase 2 - Embed Flow AM logic directly into the stock collector.py, pre_publish.py, and publish_file.py hooks, gated on ctx.flow_project_id at runtime. Adds a self-contained python/tk_multi_publish2/flowam/ package for publish orchestration.

Also includes single_file_mode for the publisher dialog (SG-43419), used when republishing an existing Flow AM generic asset from the Desktop Loader.

Note: Non-Flow-AM projects are unaffected - all Flow AM branches are gated on ctx.flow_project_id and engine.flow_host.

Dependencies

Config requirements

The stock hooks now handle Flow AM natively - no hook chain overrides needed for DCC environments.

env/includes/desktop/project.yml:

 tk-multi-publish2:
   publish_plugins:
   - name: Publish to Flow AM
     hook: "{self}/publish_file.py"
     settings: {}

env/includes/maya/apps.yml (same for houdini, nuke):

 maya.apps.tk-multi-publish2:
   publish_plugins:
   - name: Publish to Flow AM
     hook: "{self}/publish_file.py:{engine}/tk-multi-publish2/basic/publish_session.py"
     settings: {}
   - name: Publish Alembic Derivative
     hook: "{self}/publish_file.py:{engine}/tk-multi-publish2/basic/publish_session.py:{self}/flowam/publish_alembic_derivative.py"
     settings: {}

Test plan

  • Publish on DCC with FlowAM config
  • Publish on Desktop with Flow AM config
  • Non-Flow-AM project - publishes normally with no regression

TODO

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.28571% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.09%. Comparing base (0c85314) to head (945de1c).

Files with missing lines Patch % Lines
python/tk_multi_publish2/dialog.py 0.00% 14 Missing ⚠️
python/tk_multi_publish2/__init__.py 60.00% 2 Missing ⚠️
app.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #217      +/-   ##
==========================================
- Coverage   41.21%   40.09%   -1.13%     
==========================================
  Files          62       60       -2     
  Lines        5054     4617     -437     
==========================================
- Hits         2083     1851     -232     
+ Misses       2971     2766     -205     
Flag Coverage Δ
Linux 40.09% <39.28%> (-1.13%) ⬇️
Python-3.10 40.09% <39.28%> (-1.13%) ⬇️
Python-3.11 40.09% <39.28%> (-1.13%) ⬇️
Python-3.13 40.09% <39.28%> (-1.13%) ⬇️
Python-3.9 40.09% <39.28%> (-1.13%) ⬇️
Windows 40.09% <39.28%> (-1.13%) ⬇️
macOS 40.09% <39.28%> (-1.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chenm1adsk chenm1adsk marked this pull request as ready for review May 27, 2026 17:48
@chenm1adsk chenm1adsk requested a review from a team May 27, 2026 18:19

@carlos-villavicencio-adsk carlos-villavicencio-adsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for a first phase. I'm not sure if this is considered to change and merge it into the existing hook workflow once the dependencies (framework, etc) are migrated.

Comment thread hooks/flowam/publish_to_flow.py Outdated
@chenm1adsk

Copy link
Copy Markdown
Contributor Author

Looks good for a first phase. I'm not sure if this is considered to change and merge it into the existing hook workflow once the dependencies (framework, etc) are migrated.

My understanding was that the initial plan was to first get the hook in place, and then, after the framework dependency migration, design it so the hooks are picked up automatically when sg_flow_am_id and the draft ID (for publisher) are available in the context.
For the loader, the trigger condition might be slightly different, but I thought that was the original idea as well.
Please let me know if I’m misunderstanding anything or if there are any gaps in my understanding.
cc: @yungsiow

Comment thread hooks/flowam/pre_publish.py Outdated
Comment thread hooks/flowam/publish_alembic_derivative.py Outdated
Comment thread hooks/flowam/publish_alembic_derivative.py
@chenm1adsk chenm1adsk force-pushed the ticket/SG-43421-flowam-publish-hooks-phase1 branch from 20fd6c2 to d85e923 Compare May 30, 2026 04:21
@chenm1adsk chenm1adsk force-pushed the ticket/SG-43421-flowam-publish-hooks-phase1 branch from a12fe39 to 7769861 Compare June 4, 2026 16:16
@chenm1adsk chenm1adsk changed the title SG-43421 Add Flow AM publish hooks to hooks/flowam/ SG-43421 Migrate FlowAM publish hooks phase1 Jun 22, 2026
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
@chenm1adsk chenm1adsk force-pushed the ticket/SG-43421-flowam-publish-hooks-phase1 branch from 26497fd to 3140a1f Compare June 23, 2026 20:53
@chenm1adsk chenm1adsk changed the title SG-43421 Migrate FlowAM publish hooks phase1 feat:[SG-43421] Migrate FlowAM publish hooks phase1 Jun 23, 2026
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
@chenm1adsk chenm1adsk changed the title feat:[SG-43421] Migrate FlowAM publish hooks phase1 feat:[SG-43421] Migrate FlowAM publish hooks phase1 & 2 Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants