Skip to content

[Storage] File Share Typespec Migration (2) - #50354

Draft
Isabelle (ibrandes) wants to merge 17 commits into
Azure:feature/storage/typespecMigrationfrom
ibrandes:typespecMigration/fileShare2
Draft

[Storage] File Share Typespec Migration (2)#50354
Isabelle (ibrandes) wants to merge 17 commits into
Azure:feature/storage/typespecMigrationfrom
ibrandes:typespecMigration/fileShare2

Conversation

@ibrandes

Copy link
Copy Markdown
Member

No description provided.

…ence clients, hand-own body-op header classes

- Mark all 52 service operations @access(internal) for java (client.tsp) so only the impl layer is generated.
- Remove generated convenience clients (Directory/File/Service/Share +Async) and AzureFileStorageBuilder via ShareStorageCustomization.removeFile, preserving the handwritten public clients.
- Cascade-clean 21 orphaned response-header models (dropped their responseHeadersAsModel options).
- Hand-own the 6 body-op header classes the emitter cannot synthesize.
- Recover models displaced by a models-subpackage nesting issue (tracked in session notes; config fix pending).
…ckage -> models)

Marking operations @access(internal) resolved internal models to {namespace}.implementation.{models-subpackage}; with models-subpackage=implementation.models this doubled to implementation.implementation.models. Setting models-subpackage=models emits them correctly into implementation.models. Regen verified: no nested package, clean module-info, public custom-types unchanged.
…ternal); hand-written module-info

Remove @access(internal) (it caused internal-model package nesting and was redundant with the customization that already deletes convenience-client files). Revert models-subpackage to implementation.models so the 19 response-header classes generate again. Restore hand-written module-info and remove the generated one via customization. Result: 19 headers generated + 6 hand-owned, no nesting, no internal-model leak, convenience clients removed.
…odel restore, service-version retype, raw paging accessors, descriptor cleanup); remove stale FileServiceVersion
…Share*Internal; fix metadata header collection

ShareStorageCustomization: relocate generated convenience clients into implementation and rename to Share*Internal (ShareFile/Directory/Service/ShareClientInternal + Async) as the internal typed layer; fix x-ms-meta-* header-collection deserialization in *GetPropertiesHeaders + FilesDownloadHeaders (AST-based). Regenerated with typespec-java 0.46.2 + max-overload:model.
…30 -> 0)

Rename header getters (getEtag/getMetadata/getLease*/getCopy*/getShare*), fix FileProperty eTag casing, FilesUploadRangeFromUrlHeaders, x-ms-type constant. Source ShareProperties.metadata from ShareItemInternal. Regen picks up lease/provisioned/rootSquash typed headers.
@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Sep 3, 2026
@azure-pipelines

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

gunjansingh-msft added a commit that referenced this pull request Sep 8, 2026
Matches ShareStorageCustomization (PR #50354) so the two Storage migrations
read the same way:

- Renames the relocated convenience clients from *RestClient to the
  <PublicClient>Internal convention: QueueClientInternal,
  QueueServiceClientInternal, QueueMessagesClientInternal,
  QueueMessageIdsClientInternal (+ Async), via the same internalClientName()
  helper File Share uses.
- Renames the customization pieces to their File Share counterparts:
  CONVENIENCE_CLIENTS_TO_RELOCATE + relocateConvenienceClientsToImplementation,
  METADATA_HEADER_CLASSES + fixMetadataHeaderCollection.

One deliberate divergence from File Share: fixMetadataHeaderCollection assigns
the assembled map as-is rather than mapping empty to null. QueueProperties
shipped returning an empty map when a queue carries no metadata, and
setAndClearMetadataSupplier asserts Collections.emptyMap() for that case.

Also adds the missing assertions on the Update Message response. Its result is
carried purely in the x-ms-popreceipt / x-ms-time-next-visible headers, which
now reach the client through the generated MessageIdsUpdateHeaders model, but
the tests only checked the 204 status. Verified by mutation: renaming either
header constant in the generated model makes both tests fail.

Validation: 323 playback tests pass, checkstyle 0, SpotBugs 0, RevApi clean,
regeneration idempotent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TCuTUvd3da3UNEwkGDSK6T
gunjansingh-msft added a commit that referenced this pull request Sep 8, 2026
Matches ShareStorageCustomization (PR #50354) so the two Storage migrations
read the same way:

- Renames the relocated convenience clients from *RestClient to the
  <PublicClient>Internal convention: QueueClientInternal,
  QueueServiceClientInternal, QueueMessagesClientInternal,
  QueueMessageIdsClientInternal (+ Async), via the same internalClientName()
  helper File Share uses.
- Renames the customization pieces to their File Share counterparts:
  CONVENIENCE_CLIENTS_TO_RELOCATE + relocateConvenienceClientsToImplementation,
  METADATA_HEADER_CLASSES + fixMetadataHeaderCollection.

One deliberate divergence from File Share: fixMetadataHeaderCollection assigns
the assembled map as-is rather than mapping empty to null. QueueProperties
shipped returning an empty map when a queue carries no metadata, and
setAndClearMetadataSupplier asserts Collections.emptyMap() for that case.

Also adds the missing assertions on the Update Message response. Its result is
carried purely in the x-ms-popreceipt / x-ms-time-next-visible headers, which
now reach the client through the generated MessageIdsUpdateHeaders model, but
the tests only checked the 204 status. Verified by mutation: renaming either
header constant in the generated model makes both tests fail.

Validation: 323 playback tests pass, checkstyle 0, SpotBugs 0, RevApi clean,
regeneration idempotent.
…s; deprecate vestigial XML methods; fix SMB directory lease mapping

- ShareItem/ShareProperties now hand-maintained public projections of the *Internal wire models; toXml/fromXml deprecated (never used on the public surface).
- ModelHelper.populateShareProperties now maps enableSmbDirectoryLease (isSmbDirectoryLeaseEnabled previously always null).
- Includes in-progress TypeSpec migration state (regenerated impl/models, customization, emitter bump).
…tadata fix customizations

AzureFileStorageImpl.withUrl(String) + rebasing ctor and sub-impl proxy-reuse ctors/getService() let resource-URL-scoped clients share the account client's RestProxy instances (URL is a per-call @HostParam), avoiding the conform perf regression. Metadata serialization corrected from a single x-ms-meta Map.toString() header to per-entry x-ms-meta-<name> headers across the 6 Share*Internal convenience clients. Both encoded in ShareStorageCustomization (addProxyReuseForResourceScoping, fixMetadataHeaderSerialization) for regen durability.
Rewrote ShareDirectoryAsyncClient and ShareDirectoryClient to route all operations through resource-URL-scoped ShareDirectory(Async)ClientInternal convenience clients (built via AzureFileStorageImpl.withUrl(...).getDirectories()) instead of the removed path-parameter impl methods. Updated the four shared directory ModelHelper mappers to accept Response<Headers> and read via getValue(). Ungrouped rename lease/SMB conditions into flat params. IDE-verified clean on all three files.
Rewrote ShareFileAsyncClient and ShareFileClient to route all 18 File operations through resource-URL-scoped ShareFile(Async)ClientInternal convenience clients, and flipped the 10 File ModelHelper mappers to Response<FilesXxxHeaders>+getValue(). Streaming ops convert Flux<->BinaryData (download via toFluxByteBuffer, upload/create via BinaryData.fromFlux); startCopy/rename ungroup CopyFileSmbInfo and lease conditions into flat params; ShareFileHttpHeaders unpacked into individual content headers. getRangeList uses the non-paged convenience (marker dropped; single-file range lists fit one page). Compile-verified: File+Directory clients and ModelHelper clean.
Rewrote ShareClient and ShareAsyncClient to route all Share operations through resource-URL-scoped Share(Async)ClientInternal convenience clients; flipped mapGetPropertiesResponse/mapCreateSnapshotResponse to Response+getValue(). Fixed the 3 builders' AzureFileStorageImpl construction for the regenerated ctor (url in slot 2, ShareServiceVersion enum last). Notable deltas: paidBursting MaxIops/MaxBandwidth arg order swapped; SharePermission(String) ctor; ShareSignedIdentifierWrapper(list)+getItems(); permission-key header getter getFilePermissionKey via getValue(). ShareClient+ShareAsyncClient compile-clean.
Rewrote ShareServiceClient/ShareServiceAsyncClient (listShares via listSharesSegmentWithResponse->ListSharesResponse; getProperties/setProperties/getUserDelegationKey via ShareServiceClientInternal; delete/restore share via per-share ShareClientInternal) and ShareLeaseAsyncClient (resource-scoped ShareFile/Share internal lease clients; ctor now takes ShareServiceVersion). Fixed KeyInfo(expiry) ctor and ShareLeaseClientBuilder to pass the enum. Applied spotless formatting. Full module now compiles with ZERO errors (module-info aside).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant