Skip to content

ELM migrations: status compatibility, create-flow enhancements, and device auth UX#1494

Merged
mishrarish merged 32 commits into
Azure:masterfrom
bhuvanshahMSFT:elm-migrations-preview-1p
May 14, 2026
Merged

ELM migrations: status compatibility, create-flow enhancements, and device auth UX#1494
mishrarish merged 32 commits into
Azure:masterfrom
bhuvanshahMSFT:elm-migrations-preview-1p

Conversation

@bhuvanshahMSFT
Copy link
Copy Markdown
Contributor

@bhuvanshahMSFT bhuvanshahMSFT commented Apr 28, 2026

Summary

This PR now includes the combined ELM migrations updates for preview labeling, status compatibility, create-flow enhancements, and device auth UX.

What Changed

  1. Status compatibility:
  • Treat both succeeded and completed as success terminal states.
  1. Create migration enhancements:
  • Added optional --service-endpoint-id passthrough as serviceEndpointId (camelCase).
  • Kept --github-token support.
  • If token is not provided, CLI checks ELM_GITHUB_TOKEN, then falls back to GitHub device flow.
  1. Device flow UX:
  • Shows verification URL and device code.
  • Copies device code to clipboard when host OS supports it.
  1. UX improvements across migration commands:
  • Improved pause/cancel/abandon/list messaging.
  • Improved resume guidance and terminal-state handling.
  1. Preview label:
  • Keeps ELM migration command group marked as Preview.

Validation

  1. Migration unit tests passed: 65/65.
  2. Wheel rebuilt and installed: azure_devops-1.0.4-py2.py3-none-any.whl.
  3. CLI smoke checks passed for command help and merged arguments (--service-endpoint-id, --github-token).

Notes

  • serviceEndpointId is sent only when provided.
  • API contract confirmed camelCase and nullable GUID behavior.

- Add --github-token and ELM_GITHUB_TOKEN fallback

- Run GitHub device flow when token is not provided

- Keep target-owner-user-id optional for FF-off compatibility

- Add deviceFlowConfig endpoint fallback support

- Expand migration auth edge-case tests

- Update ELM docs for token/device-flow create behavior
- Translate generic 409 TF400898 during migration create into a clear active-migration message

- Keep non-conflict errors unchanged

- Add regression tests for conflict mapping and pass-through behavior
- Add troubleshooting entry in migrations.md

- Add pitfall row and dedicated 409 section in elm_migrations_tsg.md
- Show PAT guidance when both device-flow config endpoints return 404

- Validate interval/expires_in as positive integers and fail with explicit invalid response errors

- Add regression tests for new fallback and validation behavior
- Map 401/403 to generic app/service-unavailable message

- Preserve PAT fallback guidance in message

- Add unit test coverage for HTTP 401 handling
- Enforce target repository format as https://host/org/repo client-side

- Prefer PreCheckIssueType/validation issue messages from response body for CLI errors

- Keep non-TF400898 409 handling unchanged

- Add regression tests for new validation and error-detail extraction
Add is_preview for migrations command groups and align help/docs with preview and limited-availability messaging.
@bhuvanshahMSFT
Copy link
Copy Markdown
Contributor Author

Reviewer context: this change is metadata and docs only. It marks ELM migration command groups as Preview to reflect current limited 1P or allowlisted availability. Existing CLI usage is unchanged for eligible users; non-eligible users continue to be governed by service-side access controls.

@bhuvanshahMSFT
Copy link
Copy Markdown
Contributor Author

Update after branch refresh:

This PR branch now includes the merged ELM migration functional updates (not just preview metadata):

  1. Status compatibility:
  • Treats both succeeded and completed as success terminal states.
  1. Create migration enhancements:
  • Adds optional --service-endpoint-id passthrough as serviceEndpointId (camelCase).
  • Keeps --github-token support.
  • If token is not provided, CLI checks ELM_GITHUB_TOKEN, then falls back to GitHub device flow.
  1. Device flow UX:
  • Displays device verification URL and code.
  • Copies device code to clipboard when supported by host OS tooling.
  1. UX improvements across migration commands:
  • Better pause/cancel/abandon/list messaging.
  • Improved resume guidance and terminal-state handling.
  1. Validation done on this branch:
  • Migration unit tests passed: 65/65.
  • Wheel rebuilt and installed: azure_devops-1.0.4-py2.py3-none-any.whl.
  • CLI help smoke checks confirm merged args/commands (including --service-endpoint-id and --github-token).

If preferred, I can update PR title/description to match this expanded scope for easier review.

@bhuvanshahMSFT bhuvanshahMSFT changed the title Mark ELM migrations command group as preview ELM migrations: status compatibility, create-flow enhancements, and device auth UX Apr 29, 2026
@bhuvanshahMSFT bhuvanshahMSFT force-pushed the elm-migrations-preview-1p branch from 0e63a5a to 0e84488 Compare May 11, 2026 16:49
Copy link
Copy Markdown
Collaborator

@bhaveshbhati bhaveshbhati left a comment

Choose a reason for hiding this comment

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

Need to delete extra/wrong files

Comment thread docs Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Delete this file.

Comment thread hello.js Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Delete this file

Demo User added 5 commits May 13, 2026 09:39
When a service connection is supplied via --service-endpoint-id, GitHub auth is handled server-side by the service endpoint. The CLI must not call /_apis/migrations/deviceFlowConfig, which fails (400) against GHES when the ELM GitHub App is not reachable from the caller's network.

- Gate _resolve_github_user_token on service_endpoint_id

- Reject --service-endpoint-id and --github-token together (ambiguous)

- Update help text to document precedence

- Add tests covering: SE-only, SE+token mutex, SE ignores env token, SE+whitespace token, SE+409 conflict message, SE+all optional fields
…led cutover date

The ELM service silently ignores 'null' for scheduledCutoverDate and only treats DateTimeOffset.MinValue ('0001-01-01T00:00:00+00:00') as the clear sentinel. Previously, 'az devops migrations cutover cancel' returned 200 OK but the server left the field set, leading users to believe the cancel had taken effect when it had not.

Verified empirically via 'az devops invoke' against a live stuck migration: sending the MinValue sentinel cleared scheduledCutoverDate to null in the response, while sending null was a silent no-op.

Updated unit test to assert the sentinel value is sent.
Replace specific pool names and aliases with generic placeholders in customer-facing help text, docs, and test fixtures.
Clearing scheduledCutoverDate after the worker has entered the Cutover stage puts the migration into a state that requires server-side recovery (the post-cutover drain uses the field as a 'final sync ran' marker). Tracked service-side as Bug 2394803.

Guard the dangerous case client-side until the service-side reject ships, so customers running 'az devops migrations cutover cancel' against an in-progress cutover get a clear error instead of corrupting the migration state.
Copy link
Copy Markdown
Collaborator

@bhaveshbhati bhaveshbhati left a comment

Choose a reason for hiding this comment

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

LGTM

@mishrarish mishrarish merged commit 08344c5 into Azure:master May 14, 2026
21 checks passed
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