Skip to content

Export flare.get_task_name from nvflare.client#4854

Merged
pcnudde merged 3 commits into
NVIDIA:mainfrom
YuanTingHsieh:yuantingh/client-api-ex1-get-task-name
Jul 2, 2026
Merged

Export flare.get_task_name from nvflare.client#4854
pcnudde merged 3 commits into
NVIDIA:mainfrom
YuanTingHsieh:yuantingh/client-api-ex1-get-task-name

Conversation

@YuanTingHsieh

Copy link
Copy Markdown
Collaborator

What

Export get_task_name from the nvflare.client package. It exists in nvflare/client/api.py but was never re-exported, so flare.get_task_name() failed despite being part of the Client API control surface.

Program context

Client API Execution Modes (2.9) — EX-1, Wave 0 of the plan.
Design: docs/design/client_api_execution_modes.md § "Client API Backends" / rank contract (which lists get_task_name() among the control-rank APIs)
Plan: docs/design/client_api_execution_modes_plan.md (PR #4853)
Depends on: none · Unblocks: nothing directly (removes a latent gap the rank contract assumes).

Testing

New package_exports_test.py asserts, by identity (flare.X is api.X), that all 10 control-API names resolve to the api module functions — so a future refactor that rebinds a name to the wrong object fails CI. 10 pass; black/isort/flake8 clean.

🤖 Generated with Claude Code

EX-1 (Wave 0) of the Client API Execution Modes program (see
docs/design/client_api_execution_modes_plan.md on PR NVIDIA#4853).

get_task_name exists in nvflare/client/api.py but was not exported from
the package, so flare.get_task_name() did not work despite being part of
the rank contract's control-API surface. Adds the export and a test
pinning the public control-API surface.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 2, 2026 16:40
@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the missing get_task_name re-export to nvflare/client/__init__.py so that import nvflare.client as flare; flare.get_task_name() works as advertised by the Client API rank contract. A new parametrized identity-check test guards all 10 control-API names against future re-binding regressions.

  • nvflare/client/__init__.py: Adds one line — from .api import get_task_name as get_task_name — in alphabetical order with the surrounding exports.
  • tests/unit_test/client/package_exports_test.py: New test that asserts each of the 10 control-API symbols exported from nvflare.client is the exact same object as its counterpart in nvflare.client.api, catching both missing exports and accidental shadowing.

Confidence Score: 5/5

Safe to merge — the change is a single-line re-export of a function that already existed and worked in the api module.

The change only adds one import line to the package's init.py, restoring the missing export. The function itself is unchanged. The new identity-check test validates all 10 control-API symbols and will catch any future regression in this area.

No files require special attention.

Important Files Changed

Filename Overview
nvflare/client/init.py Adds one-line re-export of get_task_name from the api module; change is correct, minimal, and alphabetically ordered.
tests/unit_test/client/package_exports_test.py New parametrized identity-check test for all 10 control-API exports; covers the missing get_task_name and guards against future re-binding regressions.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User as User Code
    participant flare as nvflare.client (__init__.py)
    participant api as nvflare.client.api

    User->>flare: import nvflare.client as flare
    flare->>api: from .api import get_task_name as get_task_name
    User->>flare: flare.get_task_name()
    flare->>api: delegates to api.get_task_name()
    api-->>User: returns task name string
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User as User Code
    participant flare as nvflare.client (__init__.py)
    participant api as nvflare.client.api

    User->>flare: import nvflare.client as flare
    flare->>api: from .api import get_task_name as get_task_name
    User->>flare: flare.get_task_name()
    flare->>api: delegates to api.get_task_name()
    api-->>User: returns task name string
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into yuantingh/clien..." | Re-trigger Greptile

Copilot AI 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.

Pull request overview

Exports get_task_name from the nvflare.client package so flare.get_task_name() works as part of the intended public Client API surface, and adds a regression test to ensure the control-API names remain bound to the canonical nvflare.client.api functions.

Changes:

  • Re-export get_task_name from nvflare/client/__init__.py.
  • Add a unit test that asserts (by object identity) that the control-API names on nvflare.client resolve to the same objects as nvflare.client.api.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/unit_test/client/package_exports_test.py Adds an identity-based regression test covering the control-API exports from nvflare.client.
nvflare/client/init.py Re-exports get_task_name from nvflare.client.api to complete the expected package-level API surface.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

codecov-commenter commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.97%. Comparing base (9fb7f0b) to head (09018bd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4854      +/-   ##
==========================================
+ Coverage   56.95%   56.97%   +0.01%     
==========================================
  Files         969      969              
  Lines       92261    92262       +1     
==========================================
+ Hits        52551    52564      +13     
+ Misses      39710    39698      -12     
Flag Coverage Δ
unit-tests 56.97% <100.00%> (+0.01%) ⬆️

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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pcnudde pcnudde enabled auto-merge (squash) July 2, 2026 21:34
@pcnudde pcnudde merged commit 022b1eb into NVIDIA:main Jul 2, 2026
18 checks passed
@YuanTingHsieh YuanTingHsieh deleted the yuantingh/client-api-ex1-get-task-name branch July 2, 2026 22:32
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.

4 participants