Skip to content

[azure-ai-ml] Populate DeploymentTemplate.creation_context.last_modified_by from service modifiedBy - #48545

Open
Swarup Chanda (swarupecenits) wants to merge 2 commits into
Azure:mainfrom
swarupecenits:fix/deployment-template-last-modified-by
Open

[azure-ai-ml] Populate DeploymentTemplate.creation_context.last_modified_by from service modifiedBy#48545
Swarup Chanda (swarupecenits) wants to merge 2 commits into
Azure:mainfrom
swarupecenits:fix/deployment-template-last-modified-by

Conversation

@swarupecenits

@swarupecenits Swarup Chanda (swarupecenits) commented Aug 12, 2026

Copy link
Copy Markdown
Member

Notes

  • Fixes internal bug #5402673 (last_modified_by metadata parity; the service-side portion was tracked via #5475875): DeploymentTemplate.creation_context.last_modified_by was always None, even after the service began returning the modifying identity — so it did not reach parity with Model / Environment (which populate last_modified_by).
  • Root cause: unlike Model / Environment (which return a nested systemData block), the deployment-template API returns flattened createdTime / modifiedTime / createdBy / modifiedBy fields top-level in get(), nested under properties in list(). _from_rest_object read createdBy but never read modifiedBy, so SystemData.last_modified_by was never populated. (The service also sends a lastModifiedBy key, but it is null.)
  • Fix: extract the modifying identity from modifiedBy (properties-first with a top-level fallback), preferring it over the present-but-null lastModifiedBy, and pass it into SystemData(last_modified_by=...). Reuses the existing _extract_created_by helper, so the dict (get() shape) and stringified-dict (list() shape) are handled identically to created_by.
  • This mirrors the existing created_by handling already present in _from_rest_object; both get() (L390) and list() (L308) go through the same method, so both paths are covered and there is no separate async path. By agreement with the service owner, last_modified_by is populated for newly-created templates only pre-existing templates (no modifiedBy recorded) return None by design, no backfill.

Testing

  • Added test_deployment_template_from_rest_object_populates_last_modified_by_flattened feeds the get() shape (top-level modifiedBy object + null lastModifiedBy) and asserts last_modified_by == "azure-huggingface".
  • Added test_deployment_template_from_rest_object_populates_last_modified_by_nested_in_properties feeds the real list() shape (stringified modifiedBy nested under properties, plus a null lastModifiedBy) and asserts last_modified_by == "azure-huggingface-staging".
  • Verified live against the azure-huggingface registry (East US): a freshly-created template now returns a populated last_modified_by via both get() and list() (previously None), matching Model / Environment; created_at / created_by / last_modified_at are unchanged.
  • Full deployment_template unit suite passes (113 tests); black and isort clean.

Verification (screenshots)

1. Unit tests — test_deployment_template.py (29 passed, incl. the 2 new last_modified_by regression tests)

Screenshot 2026-08-12 174010

2. Live run against azure-huggingface (East US) - get() / list() values
Existing glm v5 shows the by-design last_modified_by=None (no modifier recorded), while a freshly-created template returns last_modified_by via both get() (azure-huggingface) and list() (azure-huggingface-staging).
Screenshot 2026-08-12 173651

3. Acceptance verdict — 9/9 checks passed (remaining list() last_modified_at is service-side, #5475875)
Screenshot 2026-08-12 173706

Description

Fixes internal bug #5402673. DeploymentTemplate.creation_context.last_modified_by is no longer always None: it is now populated from the service's modifiedBy field, completing creation_context metadata parity with Model / Environment. The deployment-template API returns the modifying identity as a flattened modifiedBy value (top-level in get(), nested under properties in list()) alongside a present-but-null lastModifiedBy; _from_rest_object now reads modifiedBy (preferring it over the null lastModifiedBy) using the same _extract_created_by helper as created_by, so both the get() and list() shapes are handled. Per service-owner agreement, last_modified_by is populated for newly-created templates; pre-existing templates without a recorded modifier remain None. The separate list() last_modified_at discrepancy is service-side (#5475875, LIST path) and out of scope here.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

…rvice modifiedBy

The deployment-template service now returns the modifying identity as a flattened modifiedBy field (top-level for get(), nested under properties for list()) alongside a present-but-null lastModifiedBy, but _from_rest_object never read it, so last_modified_by was always None. Extract modifiedBy (properties-first with obj fallback, preferring it over the null lastModifiedBy) via _extract_created_by and populate SystemData.last_modified_by, matching how created_by is read. Adds get()- and list()-shape regression tests. Bug 5475875.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@swarupecenits Swarup Chanda (swarupecenits) changed the title [azure-ai-ml] Populate DeploymentTemplate.creation_context.last_modified_by from service modifiedBy [azure-ai-ml] Populate DeploymentTemplate.creation_context.last_modified_by from service modifiedBy Aug 12, 2026
@swarupecenits Swarup Chanda (swarupecenits) changed the title [azure-ai-ml] Populate DeploymentTemplate.creation_context.last_modified_by from service modifiedBy [azure-ai-ml] Populate DeploymentTemplate.creation_context.last_modified_by from service modifiedBy Aug 12, 2026
@swarupecenits
Swarup Chanda (swarupecenits) marked this pull request as ready for review August 12, 2026 13:10
Copilot AI balanced review requested due to automatic review settings August 12, 2026 13:10
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

Populates deployment-template modifier metadata from flattened service responses.

Changes:

  • Reads modifiedBy for both get() and list() response shapes.
  • Adds regression tests for object and stringified-dictionary identities.
  • Documents the fix in the changelog.

Reviewed changes

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

File Description
deployment_template.py Maps modifiedBy to last_modified_by.
test_deployment_template.py Tests both response shapes.
CHANGELOG.md Records the bug fix.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants