You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract and publish output was a flat, hard-to-scan stream. Extract silently dropped APIs that had no spec or operations. Neither command reported elapsed time. Retry warnings showed raw millisecond delays with no resource or attempt number, and they appeared between PUT lines.
Publish output (before → after)
PUT namedvalue/src-nv-plain
Server error 503, retrying after 1175.1730686888397ms
PUT tag/tag1
--- Summary ---
2 creates/updates, 0 patches, 0 deletes, 0 skipped
── Tier 1: Independent resources (2) ──
PUT namedvalue/src-nv-plain (2 retries)
PUT tag/tag1
Tier 1 completed in 3.2s
--- Summary ---
2 creates/updates, 0 patches, 0 deletes, 0 skipped
2 retries across 1 resource
Completed in 12.3s
Extract (src/cli/extract-command.ts)
The Extracted N <Type>(s) / Failed … lines are grouped under Tier N: <label> headings.
Every API is listed. APIs without a spec, operations or revisions show as definition only.
The total line includes duration: Total: 96 resources extracted, 0 errors in 12.3s. The time covers extraction plus moving the files into the output directory.
Each tier gets a header and a Tier N completed in … line; delete tiers get the same, labelled Delete tier N.
The header count is the number of descriptors scheduled in the tier, after skipping auto-generated named values and children already published by their parent API or product.
It can differ from the number of PUT lines, because publishing an API or product also emits lines for its children.
PublishResult gains optional elapsedMs, totalRetries and retriedResources; PublishActionResult gains retries. The existing function body moved into runPublishPipeline so these fields are filled on every return path.
Text summary adds the retry line (only when retries occurred) and Completed in ….
JSON summary adds totalRetries, retriedResources and elapsedMs; each action adds retries.
Retries (src/clients/apim-client.ts)
New message format: Server error 503 on PUT namedValues/nv-1 (attempt 1/4), retrying in 1.2s. The same format applies to 429s, network failures, and delete conflicts.
describeRequestTarget(url) shortens ARM URLs to the path below the APIM service and drops query strings, so storage signatures never appear in logs.
New src/lib/retry-tracker.ts counts retries per resource using AsyncLocalStorage, which keeps counts correct while resources publish in parallel.
Publish wraps each resource in trackRetries().
The client calls recordRetry() on every retry.
Inside a tracked scope the retry message is logged at debug level; outside one it stays a warning.
Shared helpers
src/lib/format-duration.ts: formats times as 1.2s or 2m 5.0s.
TIER_LABELS in src/lib/dependency-graph.ts, used by both extract and publish.
Review notes
Behaviour change: during publish, the individual retry messages only appear at --log-level debug. Extract and other callers still show them as warnings.
JSON mode: publish already wrote PUT lines to stdout in --format json mode. The tier headers follow the same path; that existing problem is not fixed here.
Per the repo's code-review requirement, this PR still needs the CodeReviewer step from .squad/ceremonies.md.
Align retry tracking identities for mapped API and product resources
src/services/publish-service.ts:1137
When environment mapping changes resource names, this lookup compares different identities: ApimClient records retries under the deployed descriptor (for example dev-api1/get-items), while publisher results retain the canonical descriptor (api1/get-items; see api-publisher.ts:788-797 and resource-publisher.ts:524-536). The child key therefore never matches, and remainder assigns all retries to the root action, making per-action retry suffixes and retriedResources incorrect for mapped API/product children. Preserve or translate the canonical descriptor key at the request-tracking boundary so both sides use the same identity.
Match retry lookups against environment-mapped descriptors
src/services/publish-service.ts:1137
With environment mapping enabled, the client records retries under the deployed descriptor key (for example ApiOperation:dev-api/get), while related action results retain the canonical descriptor (ApiOperation:api/get). This lookup therefore misses child results and assigns their retries to the root action via the remainder fallback, making the per-action suffix and retriedResources incorrect for mapped APIs/products. Match against the env-mapped form of each result descriptor (while preserving canonical output), or carry the canonical key into the retry scope.
The assertion runs after mockRestore(), which resets the spy's mock state and clears its call history, so this test can pass even if runPublish wrote text to stdout. Assert before restoring the spy (inside the try) so the regression test observes the actual calls.
Workspace APIs are omitted from the every-API listing
src/cli/extract-command.ts:267
The new “every API” listing still excludes all workspace-scoped APIs. Those APIs are extracted separately in workspace-extractor.ts:193-219; they are not added to result.typeResults or result.apiResults, and WorkspaceExtractionResult only exposes aggregate counts. Include workspace API summaries in the extraction result and merge them into this detail section so the PR's stated behavior applies to every extracted API.
Failed extraction entries are counted as successful
src/cli/extract-command.ts:289
These lengths include entries whose extraction status is error; both extractApiRevisions and extractResourceType retain failed entries in their result arrays. A failed operation/revision is therefore reported as successfully present (for example, 1 ops). Count only entries with status === 'success', as the JSON summary and total extraction count already do.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extract and publish output was a flat, hard-to-scan stream. Extract silently dropped APIs that had no spec or operations. Neither command reported elapsed time. Retry warnings showed raw millisecond delays with no resource or attempt number, and they appeared between PUT lines.
Publish output (before → after)
Extract (
src/cli/extract-command.ts)Extracted N <Type>(s)/Failed …lines are grouped underTier N: <label>headings.definition only.Total: 96 resources extracted, 0 errors in 12.3s. The time covers extraction plus moving the files into the output directory.summary.elapsedMsadded.Publish (
src/services/publish-service.ts,src/cli/publish-command.ts)Tier N completed in …line; delete tiers get the same, labelledDelete tier N.PublishResultgains optionalelapsedMs,totalRetriesandretriedResources;PublishActionResultgainsretries. The existing function body moved intorunPublishPipelineso these fields are filled on every return path.Completed in ….totalRetries,retriedResourcesandelapsedMs; each action addsretries.Retries (
src/clients/apim-client.ts)Server error 503 on PUT namedValues/nv-1 (attempt 1/4), retrying in 1.2s. The same format applies to 429s, network failures, and delete conflicts.describeRequestTarget(url)shortens ARM URLs to the path below the APIM service and drops query strings, so storage signatures never appear in logs.src/lib/retry-tracker.tscounts retries per resource usingAsyncLocalStorage, which keeps counts correct while resources publish in parallel.trackRetries().recordRetry()on every retry.Shared helpers
src/lib/format-duration.ts: formats times as1.2sor2m 5.0s.TIER_LABELSinsrc/lib/dependency-graph.ts, used by both extract and publish.Review notes
--log-level debug. Extract and other callers still show them as warnings.--format jsonmode. The tier headers follow the same path; that existing problem is not fixed here..squad/ceremonies.md.