@friggframework/devtools 2.0.0--canary.461.d885809.0 → 2.0.0--canary.461.39132db.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,6 +90,15 @@ async function gatherDiscoveredResources(appDefinition) {
90
90
  return stackResources;
91
91
  }
92
92
 
93
+ // In isolated mode, ONLY use CloudFormation discovery for this stage's stack
94
+ // Do NOT fall back to AWS API discovery (which finds resources from other stages)
95
+ if (appDefinition.managementMode === 'managed' && appDefinition.vpcIsolation === 'isolated') {
96
+ console.log(' ℹ Isolated mode: only discovering resources from this stage\'s stack');
97
+ console.log(' ℹ No existing stack resources found - will create fresh infrastructure');
98
+ console.log('✅ Cloud resource discovery completed successfully!');
99
+ return {};
100
+ }
101
+
93
102
  // Fallback to AWS API discovery (fresh deployment, stack not found, or stack has no useful data)
94
103
  if (stackResources && !hasSomeUsefulData) {
95
104
  console.log(' ℹ Stack found but contains no usable resources - running AWS API discovery...');
@@ -406,5 +406,80 @@ describe('Resource Discovery', () => {
406
406
  );
407
407
  });
408
408
  });
409
+
410
+ describe('Isolated Mode Discovery', () => {
411
+ beforeEach(() => {
412
+ // Mock CloudFormation discovery
413
+ jest.mock('./cloudformation-discovery');
414
+ const { CloudFormationDiscovery } = require('./cloudformation-discovery');
415
+ CloudFormationDiscovery.mockImplementation(() => ({
416
+ discoverFromStack: jest.fn().mockResolvedValue({}), // No stack found
417
+ }));
418
+ });
419
+
420
+ it('should return empty results for isolated mode (prevents cross-stage contamination)', async () => {
421
+ const appDefinition = {
422
+ name: 'test-app',
423
+ managementMode: 'managed',
424
+ vpcIsolation: 'isolated',
425
+ vpc: { enable: true },
426
+ database: { postgres: { enable: true } },
427
+ };
428
+
429
+ process.env.SLS_STAGE = 'dev';
430
+
431
+ const result = await gatherDiscoveredResources(appDefinition);
432
+
433
+ // Should return empty (no discovery)
434
+ expect(result).toEqual({});
435
+
436
+ // Should NOT call AWS API discovery
437
+ expect(mockVpcDiscovery.discover).not.toHaveBeenCalled();
438
+ expect(mockAuroraDiscovery.discover).not.toHaveBeenCalled();
439
+ });
440
+
441
+ it('should still use CloudFormation discovery in isolated mode for redeployments', async () => {
442
+ const { CloudFormationDiscovery } = require('./cloudformation-discovery');
443
+ const mockCfDiscover = jest.fn().mockResolvedValue({
444
+ defaultVpcId: 'vpc-stage-specific',
445
+ auroraClusterId: 'cluster-stage-specific',
446
+ });
447
+
448
+ CloudFormationDiscovery.mockImplementation(() => ({
449
+ discoverFromStack: mockCfDiscover,
450
+ }));
451
+
452
+ const appDefinition = {
453
+ name: 'test-app',
454
+ managementMode: 'managed',
455
+ vpcIsolation: 'isolated',
456
+ vpc: { enable: true },
457
+ };
458
+
459
+ process.env.SLS_STAGE = 'dev';
460
+
461
+ const result = await gatherDiscoveredResources(appDefinition);
462
+
463
+ // Should call CloudFormation discovery for stage-specific stack
464
+ expect(mockCfDiscover).toHaveBeenCalledWith('test-app-dev');
465
+
466
+ // If CF finds resources, use them (redeployment scenario)
467
+ expect(result.defaultVpcId).toBe('vpc-stage-specific');
468
+ });
469
+
470
+ it('should use AWS API discovery in shared mode', async () => {
471
+ const appDefinition = {
472
+ name: 'test-app',
473
+ managementMode: 'managed',
474
+ vpcIsolation: 'shared', // NOT isolated
475
+ vpc: { enable: true },
476
+ };
477
+
478
+ await gatherDiscoveredResources(appDefinition);
479
+
480
+ // Should call AWS API discovery (shared mode finds resources across stages)
481
+ expect(mockVpcDiscovery.discover).toHaveBeenCalled();
482
+ });
483
+ });
409
484
  });
410
485
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.d885809.0",
4
+ "version": "2.0.0--canary.461.39132db.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-ec2": "^3.835.0",
7
7
  "@aws-sdk/client-kms": "^3.835.0",
@@ -11,8 +11,8 @@
11
11
  "@babel/eslint-parser": "^7.18.9",
12
12
  "@babel/parser": "^7.25.3",
13
13
  "@babel/traverse": "^7.25.3",
14
- "@friggframework/schemas": "2.0.0--canary.461.d885809.0",
15
- "@friggframework/test": "2.0.0--canary.461.d885809.0",
14
+ "@friggframework/schemas": "2.0.0--canary.461.39132db.0",
15
+ "@friggframework/test": "2.0.0--canary.461.39132db.0",
16
16
  "@hapi/boom": "^10.0.1",
17
17
  "@inquirer/prompts": "^5.3.8",
18
18
  "axios": "^1.7.2",
@@ -34,8 +34,8 @@
34
34
  "serverless-http": "^2.7.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@friggframework/eslint-config": "2.0.0--canary.461.d885809.0",
38
- "@friggframework/prettier-config": "2.0.0--canary.461.d885809.0",
37
+ "@friggframework/eslint-config": "2.0.0--canary.461.39132db.0",
38
+ "@friggframework/prettier-config": "2.0.0--canary.461.39132db.0",
39
39
  "aws-sdk-client-mock": "^4.1.0",
40
40
  "aws-sdk-client-mock-jest": "^4.1.0",
41
41
  "jest": "^30.1.3",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "d8858090c719e05e3bd548c092844430f728ff05"
73
+ "gitHead": "39132dbc3da9052429c0ce6fe1f32f50be162b89"
74
74
  }