Skip to content

Commit e19e476

Browse files
authored
Merge branch 'feature/cloudformation' into feature/cloudformation
2 parents 89434cb + e005c2a commit e19e476

File tree

15 files changed

+140
-24
lines changed

15 files changed

+140
-24
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"date": "2025-11-06",
3+
"version": "1.103.0",
4+
"entries": [
5+
{
6+
"type": "Feature",
7+
"description": "Q CodeTransformation: add more job metadata to history table"
8+
}
9+
]
10+
}

packages/amazonq/.changes/next-release/Feature-ab31cbb6-3fe4-4ee3-a0a3-290430277856.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/amazonq/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.103.0 2025-11-06
2+
3+
- **Feature** Q CodeTransformation: add more job metadata to history table
4+
15
## 1.102.0 2025-10-30
26

37
- Miscellaneous non-user-facing changes

packages/amazonq/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amazon-q-vscode",
33
"displayName": "Amazon Q",
44
"description": "The most capable generative AI–powered assistant for software development.",
5-
"version": "1.103.0-SNAPSHOT",
5+
"version": "1.104.0-SNAPSHOT",
66
"extensionKind": [
77
"workspace"
88
],

packages/core/src/awsService/sagemaker/commands.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export async function stopSpace(
171171
await client.deleteApp({
172172
DomainId: node.spaceApp.DomainId!,
173173
SpaceName: spaceName,
174-
AppType: node.spaceApp.App!.AppType!,
174+
AppType: node.spaceApp.SpaceSettingsSummary!.AppType!,
175175
AppName: node.spaceApp.App?.AppName,
176176
})
177177
} catch (err) {
@@ -319,7 +319,7 @@ async function handleRunningSpaceWithDisabledAccess(
319319
await client.deleteApp({
320320
DomainId: node.spaceApp.DomainId!,
321321
SpaceName: spaceName,
322-
AppType: node.spaceApp.App!.AppType!,
322+
AppType: node.spaceApp.SpaceSettingsSummary!.AppType!,
323323
AppName: node.spaceApp.App?.AppName,
324324
})
325325

@@ -329,7 +329,11 @@ async function handleRunningSpaceWithDisabledAccess(
329329
// Start the space with remote access enabled (skip prompts since user already consented)
330330
await client.startSpace(spaceName, node.spaceApp.DomainId!, true)
331331
await tryRefreshNode(node)
332-
await client.waitForAppInService(node.spaceApp.DomainId!, spaceName, node.spaceApp.App!.AppType!)
332+
await client.waitForAppInService(
333+
node.spaceApp.DomainId!,
334+
spaceName,
335+
node.spaceApp.SpaceSettingsSummary!.AppType!
336+
)
333337
await tryRemoteConnection(node, ctx, progress)
334338
} catch (err: any) {
335339
// Handle user declining instance type upgrade
@@ -369,7 +373,11 @@ async function handleStoppedSpace(
369373
},
370374
async (progress) => {
371375
progress.report({ message: 'Starting the space' })
372-
await client.waitForAppInService(node.spaceApp.DomainId!, spaceName, node.spaceApp.App!.AppType!)
376+
await client.waitForAppInService(
377+
node.spaceApp.DomainId!,
378+
spaceName,
379+
node.spaceApp.SpaceSettingsSummary!.AppType!
380+
)
373381
await tryRemoteConnection(node, ctx, progress)
374382
}
375383
)

packages/core/src/awsService/sagemaker/sagemakerSpace.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ import { getIcon, IconPath } from '../../shared/icons'
1111
import { generateSpaceStatus, updateIdleFile, startMonitoringTerminalActivity, ActivityCheckInterval } from './utils'
1212
import { UserActivity } from '../../shared/extensionUtilities'
1313
import { getLogger } from '../../shared/logger/logger'
14+
import { ToolkitError } from '../../shared/errors'
1415
import { SpaceStatus, RemoteAccess } from './constants'
1516

17+
const logger = getLogger('sagemaker')
18+
1619
export class SagemakerSpace {
1720
public label: string = ''
1821
public contextValue: string = ''
@@ -34,6 +37,10 @@ export class SagemakerSpace {
3437
}
3538

3639
public updateSpace(spaceApp: SagemakerSpaceApp) {
40+
// Edge case when this.spaceApp.App is null, returned by ListApp API for a Space that is not connected to for over 24 hours
41+
if (!this.spaceApp.App) {
42+
this.spaceApp.App = spaceApp.App
43+
}
3744
this.setSpaceStatus(spaceApp.Status ?? '', spaceApp.App?.Status ?? '')
3845
// Only update RemoteAccess property to minimize impact due to minor structural differences between variables
3946
if (this.spaceApp.SpaceSettingsSummary && spaceApp.SpaceSettingsSummary?.RemoteAccess) {
@@ -107,13 +114,19 @@ export class SagemakerSpace {
107114
DomainId: this.spaceApp.DomainId,
108115
SpaceName: this.spaceApp.SpaceName,
109116
})
110-
111-
const app = await this.client.describeApp({
112-
DomainId: this.spaceApp.DomainId,
113-
AppName: this.spaceApp.App?.AppName,
114-
AppType: this.spaceApp?.SpaceSettingsSummary?.AppType,
115-
SpaceName: this.spaceApp.SpaceName,
116-
})
117+
// get app using ListApps API, with given DomainId and SpaceName
118+
const app =
119+
this.spaceApp.DomainId && this.spaceApp.SpaceName
120+
? await this.client.listAppForSpace(this.spaceApp.DomainId, this.spaceApp.SpaceName)
121+
: undefined
122+
if (!app) {
123+
logger.error(
124+
`updateSpaceAppStatus: unable to get app, [DomainId: ${this.spaceApp.DomainId}], [SpaceName: ${this.spaceApp.SpaceName}]`
125+
)
126+
throw new ToolkitError(
127+
`Cannot update app status without [DomainId: ${this.spaceApp.DomainId} and SpaceName: ${this.spaceApp.SpaceName}]`
128+
)
129+
}
117130

118131
// AWS DescribeSpace API returns full details with property names like 'SpaceSettings'
119132
// but our internal SagemakerSpaceApp type expects 'SpaceSettingsSummary' (from ListSpaces API)
@@ -195,7 +208,6 @@ export class SagemakerSpace {
195208
* Sets up user activity monitoring for SageMaker spaces
196209
*/
197210
export async function setupUserActivityMonitoring(extensionContext: vscode.ExtensionContext): Promise<void> {
198-
const logger = getLogger()
199211
logger.info('setupUserActivityMonitoring: Starting user activity monitoring setup')
200212

201213
const tmpDirectory = '/tmp/'

packages/core/src/shared/clients/sagemaker.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ export class SagemakerClient extends ClientWrapper<SageMakerClient> {
128128
return this.makeRequest(DeleteAppCommand, request)
129129
}
130130

131+
public async listAppForSpace(domainId: string, spaceName: string): Promise<AppDetails | undefined> {
132+
const appsList = await this.listApps({ DomainIdEquals: domainId, SpaceNameEquals: spaceName })
133+
.flatten()
134+
.promise()
135+
return appsList[0] // At most one App for one SagemakerSpace
136+
}
137+
131138
public async startSpace(spaceName: string, domainId: string, skipInstanceTypePrompts: boolean = false) {
132139
let spaceDetails: DescribeSpaceCommandOutput
133140

packages/core/src/test/awsService/sagemaker/commands.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('SageMaker Commands', () => {
5959
AppName: 'default',
6060
},
6161
SpaceSettingsSummary: {
62+
AppType: 'JupyterLab',
6263
RemoteAccess: 'DISABLED',
6364
},
6465
},

packages/core/src/test/awsService/sagemaker/explorer/sagemakerSpaceNode.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ describe('SagemakerSpaceNode', function () {
112112
it('updates space app status', async function () {
113113
const describeSpaceStub = sinon.stub(SagemakerClient.prototype, 'describeSpace')
114114
describeSpaceStub.resolves({ SpaceName: 'TestSpace', Status: 'InService', $metadata: {} })
115-
describeAppStub.resolves({ AppName: 'TestApp', Status: 'InService', $metadata: {} })
115+
116+
const listAppForSpaceStub = sinon.stub(SagemakerClient.prototype, 'listAppForSpace')
117+
listAppForSpaceStub.resolves({ AppName: 'TestApp', Status: 'InService' })
116118

117119
await testSpaceAppNode.updateSpaceAppStatus()
118120

119121
sinon.assert.calledOnce(describeSpaceStub)
120-
sinon.assert.calledOnce(describeAppStub)
122+
sinon.assert.calledOnce(listAppForSpaceStub)
121123
})
122124
})

0 commit comments

Comments
 (0)