Skip to content

Conversation

Kanishkavijay39
Copy link
Contributor

@Kanishkavijay39 Kanishkavijay39 commented Sep 6, 2025

Add Sandbox Configuration API

Problem

Need API endpoint to manage sandbox audit settings without code deployments.

Solution

Adds PATCH /configurations/sandbox endpoint for runtime sandbox audit management.

Changes

New API Endpoint:

  • PATCH /configurations/sandbox - Update sandbox audit configuration
  • Admin-only access with x-api-key authentication
  • Request: { sandboxConfigs: { "audit-type": { cooldownHours: "3", enabled: true } } }
  • Response: Success message with updated configs count

Controller Updates:

  • Add ConfigurationController.updateSandboxConfig() method
  • Validate request data and check admin permissions
  • Handle errors: 400 (bad request), 403 (forbidden), 404 (not found)

API Documentation:

  • Complete OpenAPI specs in configuration-api.yaml
  • Request/response schemas with examples
  • Proper error response documentation

Other:

  • Update ConfigurationDto to include sandboxAudits in responses
  • Fix function coverage issues (100% coverage maintained)
  • All tests passing (1,434 tests)

Usage

PATCH /configurations/sandbox
{
  "sandboxConfigs": {
    "meta-tags": { "cooldownHours": "3", "enabled": true }
  }
}

Testing

Note: Requires spacecat-shared Configuration model updates.
Testing
image
image

@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch from a34293f to 1958320 Compare September 6, 2025 19:41
Copy link

github-actions bot commented Sep 6, 2025

This PR will trigger a minor release when merged.

@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch 3 times, most recently from f31281e to d07c146 Compare September 7, 2025 19:41
- Add PATCH /configurations/sandbox endpoint for updating sandbox audit configurations
- Implement updateSandboxConfig method in ConfigurationController with admin access control
@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch from d07c146 to 2129b15 Compare September 7, 2025 21:17
Kanishka added 4 commits September 8, 2025 22:34
- Add updateSandboxConfig method to configuration controller
- Update sandbox audit configurations using spacecat-shared methods
- Add comprehensive tests for all scenarios including success and error paths
- Achieve 99.96% coverage (remaining 0.04% from pre-existing uncovered paths)
- Fix function coverage by replacing arrow functions with method references
@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch from 01dea9f to 1356e41 Compare September 9, 2025 17:57
@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch from 1356e41 to 28edfe3 Compare September 9, 2025 18:31
@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch from 325943b to 615bef8 Compare September 10, 2025 18:29
@@ -73,7 +73,7 @@
"@adobe/helix-universal-logger": "3.0.27",
"@adobe/spacecat-shared-athena-client": "1.3.0",
"@adobe/spacecat-shared-brand-client": "1.1.20",
"@adobe/spacecat-shared-data-access": "2.58.0",
"@adobe/spacecat-shared-data-access": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-data-access?feature/site-sandbox-configuration",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove this once spacecat shared configuration model is merged.

Kanishka added 3 commits September 11, 2025 19:41
- Add PATCH /configurations/sandbox endpoint
- Support updating sandbox audit configurations for multiple audit types
- Simplify validation to basic input checking (spacecat-shared handles business rules)
- Remove complex validation and excessive logging
… API

- Update OpenAPI documentation to use cooldownHours instead of expire
- Update test cases to use cooldownHours for better clarity
- Add comprehensive OpenAPI documentation for sandbox configuration endpoint
- Improve API clarity: cooldownHours better describes rate limiting behavior
- All tests passing with 100% coverage
@Kanishkavijay39 Kanishkavijay39 changed the title [WIP]feat: add sandbox configuration update API feat: add sandbox configuration update API Sep 16, 2025
Kanishka added 2 commits September 16, 2025 19:25
…ion updates

- spacecat-shared merged with sandbox configuration model updates
- redeploy needed to get updated dependencies with updateSandboxAuditConfig method
@Kanishkavijay39 Kanishkavijay39 force-pushed the SITES-sandbox-audit-configuration branch from be95367 to f5b6598 Compare September 17, 2025 01:48

const { sandboxConfigs } = context.data || {};

if (!sandboxConfigs || typeof sandboxConfigs !== 'object') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use isObject or even isNonEmptyObject from spacecat-shared-utils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants