Skip to content

feat(workflow): align history propagation API with go-sdk#1047

Open
nelson-parente wants to merge 1 commit into
dapr:mainfrom
nelson-parente:align-history-propagation-go-sdk
Open

feat(workflow): align history propagation API with go-sdk#1047
nelson-parente wants to merge 1 commit into
dapr:mainfrom
nelson-parente:align-history-propagation-go-sdk

Conversation

@nelson-parente
Copy link
Copy Markdown

Summary

Aligns the workflow history propagation surface added in #1025 with the freshly-renamed go-sdk helpers (durabletask-go#105, merged 2026-05-19). That rename landed four days after #1025 merged, so this is drift, not a defect — Cassie flagged it post-merge while building the cross-SDK quickstarts.

This brings python-sdk back in line for cross-SDK parity before 1.18 ships.

Read API renames

Mirror durabletask-go's GetLast*ByName form to make it obvious these return the most-recent occurrence (with plural get_*s_by_name siblings for the full list):

Old New
PropagatedHistory.get_workflow_by_name get_last_workflow_by_name
WorkflowResult.get_activity_by_name get_last_activity_by_name
WorkflowResult.get_child_workflow_by_name get_last_child_workflow_by_name

Plural variants (get_workflows_by_name, get_activities_by_name, get_child_workflows_by_name) and chain-level helpers (get_app_ids, get_events_by_*) are unchanged.

Scheduling helpers

Add factory helpers mirroring workflow.PropagateLineage() / workflow.PropagateOwnHistory() from go-sdk:

import dapr.ext.workflow as wf

yield ctx.call_child_workflow(
    process_payment,
    input=req,
    propagation=wf.propagate_own_history(),
)

yield ctx.call_activity(
    log_summary,
    input=None,
    propagation=wf.propagate_lineage(),
)

The PropagationScope enum is kept as the underlying value, so propagation=PropagationScope.LINEAGE and propagation=propagate_lineage() are both supported.

Non-goals

  • Kwarg name unchanged (propagation=). Renaming to with_history_propagation= would mirror go-sdk's WithHistoryPropagation() more literally but isn't idiomatic Python; happy to follow up if reviewers prefer it.
  • No proto / runtime changes. This PR is purely surface-level: factory funcs return enum values; renamed methods are direct renames.

Test plan

  • uv run ruff check --fix && uv run ruff format — clean
  • uv run pytest ext/dapr-ext-workflow/tests/durabletask/test_propagation.py ext/dapr-ext-workflow/tests/durabletask/test_propagation_wiring.py — 31 passed
  • uv run python -m unittest discover -v ./ext/dapr-ext-workflow/tests — 133 passed
  • uv run pytest tests/examples/test_workflow.py::test_history_propagation against a 1.18-RC sidecar (output-based test; print statements unchanged, should still pass)
  • CI green

References

cc @cicoyle @acroca

Cassie (durabletask-go author) flagged divergence between python-sdk dapr#1025
and the freshly-renamed go-sdk helpers in durabletask-go dapr#105 (merged
2026-05-19, after dapr#1025 landed). This brings python-sdk's surface back
in line for cross-SDK parity before 1.18 ships.

Read API renames (mirror durabletask-go GetLast*ByName):
- PropagatedHistory.get_workflow_by_name      -> get_last_workflow_by_name
- WorkflowResult.get_activity_by_name         -> get_last_activity_by_name
- WorkflowResult.get_child_workflow_by_name   -> get_last_child_workflow_by_name

Plural variants (get_workflows_by_name, get_activities_by_name,
get_child_workflows_by_name) and the chain-level helpers are unchanged.

Scheduling helpers (mirror go-sdk workflow.PropagateLineage /
workflow.PropagateOwnHistory):
- propagate_lineage()      -> PropagationScope.LINEAGE
- propagate_own_history()  -> PropagationScope.OWN_HISTORY

PropagationScope enum is kept as the underlying value, so both
`propagation=propagate_lineage()` and
`propagation=PropagationScope.LINEAGE` work.

Example, README snippet, and tests updated to use the renamed/new
surface. No runtime/proto changes.

Refs: dapr#1001, dapr/durabletask-go#105, dapr/go-sdk#823
Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
@nelson-parente nelson-parente requested review from a team as code owners May 20, 2026 21:08
@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.47%. Comparing base (bffb749) to head (e01361c).
⚠️ Report is 133 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1047      +/-   ##
==========================================
- Coverage   86.63%   82.47%   -4.16%     
==========================================
  Files          84      146      +62     
  Lines        4473    14509   +10036     
==========================================
+ Hits         3875    11966    +8091     
- Misses        598     2543    +1945     

☔ View full report in Codecov by Sentry.
📢 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.

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.

1 participant