fix(export): AM 2.0 export under management token — detect via plan-check, skip assets + loud warn (DX-9314)#308
fix(export): AM 2.0 export under management token — detect via plan-check, skip assets + loud warn (DX-9314)#308naman-contentstack wants to merge 2 commits into
Conversation
…nt token (DX-9314) Exporting an AM 2.0 (spaces-based) stack with a management token silently produced the legacy asset layout, and the subsequent import reported success while entry-to-asset references were broken. Management tokens are rejected by the CS Assets APIs, and the linked-workspaces lookup returns [] on any failure, so AM 2.0 went undetected under --alias and the export emitted the wrong layout with no signal. Detect AM 2.0 up front via the feature-status plan-check (which accepts a management token) into config.planStatus. When the org is AM 2.0 and auth is a management token, skip the AM 2.0 asset export with a loud warning instead of emitting the legacy layout; the skip is surfaced in the final summary and logged to error.log. Export-only; import-side fix and a first-class skipped summary status are tracked separately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
Consider reviewing these vulnerabilities when fixes become available. |
|
|
||
| // cli-utilities' CLIProgressManager.globalSummary is runtime-accessible but typed private. These | ||
| // shapes describe the slice we mutate; the single accessor (getGlobalSummary) owns the structural | ||
| // cast + feature-detect so applyAssetSummaryCounts and markAssetsSkippedInSummary don't each copy it. |
There was a problem hiding this comment.
Types should be in the types folders and imported here, and these types are generic
| } | ||
|
|
||
| /** | ||
| * DX-9314 — record the AM 2.0 asset skip in the FINAL export summary without a live progress bar. |
There was a problem hiding this comment.
Remove the ticket details and all, write comments if it really required in that place
| } | ||
|
|
||
| async start(): Promise<void> { | ||
| // AM 2.0 assets cannot be exported with a management token — the CS Assets API only |
There was a problem hiding this comment.
Avoid using AM or 2.0 etc use cs assets , new naming which we have adopted
There was a problem hiding this comment.
why do we need the comments, code and the logs tells everything , no complex business logic abstraction here, one rule of thumb, if code is self explainable avoid adding comments explaining it ,
| // Add authentication details to config for context tracking | ||
| config.authenticationMethod = authenticationMethod; | ||
|
|
||
| // DX-9314: detect AM 2.0 via the plan-check API. Unlike the CS Assets API (which rejects |
There was a problem hiding this comment.
please remove everywhere else where comment is not really required, imagine we add this type of comments through out the code, will be hard find the code eventually and it makes the readability harder
|
|
||
| const setupConfig = async (exportCmdFlags: any): Promise<ExportConfig> => { | ||
| const setupConfig = async ( | ||
| exportCmdFlags: any, |
There was a problem hiding this comment.
Please check the export config implementation in the asset scan branch, please follow the same appraoch ,else it will have conflicts
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
Consider reviewing these vulnerabilities when fixes become available. |
What
Export-side fix for DX-9314. Exporting an AM 2.0 (spaces-based) stack with a management token previously fell back to the legacy asset layout silently, and a later import reported success while entry→asset references were broken (silent data loss).
Why
Management tokens are rejected by the CS Assets APIs, and
get-linked-workspacesreturns[]on any failure, so AM 2.0 went undetected under--aliasand the export emitted the legacy layout with no signal.How
contextintosetupExportConfig.feature-statusplan-check (isFeatureEnabled('amAssets')) — which accepts a management token — intoconfig.planStatus.✗ ASSETS+ reason) and logged toerror.log.Testing
spaces/and no legacyassets/files/;✗ ASSETS+ reason in the summary;⚠️ completed with failures; reason inerror.log.🤖 Generated with Claude Code