Skip to content

Conversation

Kanishkavijay39
Copy link
Contributor

@Kanishkavijay39 Kanishkavijay39 commented Aug 28, 2025

Add Sandbox Audit Configuration API

Problem

Need centralized control over sandbox audit execution:

  • Currently sandbox audits are hardcoded in various places
  • Need rate limiting (cooldown) configuration for sandbox audits
  • Need flexible configuration system for sandbox environment testing

Solution

Adds global sandbox audit configuration with full API support:

  • New sandboxAudits attribute in Configuration model for centralized control
  • PATCH /configurations/sandbox API endpoint for runtime updates

Changes

spacecat-shared (Configuration Model):

  • Add getSandboxAudits(), setSandboxAudits(), getSandboxAuditConfig(auditType)
  • Add updateSandboxAuditConfig(auditType, config) for updates
  • Add isAuditEnabledForSandbox(auditType), hasSandboxAudits() helpers
  • Add getEnabledSandboxAudits() for listing enabled audit types

API Usage

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

Kanishka added 3 commits August 27, 2025 21:21
- Add sandboxAudits attribute to global configuration schema
- Add helper methods for managing sandbox audit configurations
- Enable sandbox sites to override regular audit handler settings
Copy link

This PR will trigger a minor release when merged.

@Kanishkavijay39 Kanishkavijay39 changed the title Feature/site sandbox configuration [WIP]Feature/site sandbox configuration Aug 29, 2025
… sandboxAudits

- Replace this.state.sandboxAudits with this.getSandboxAudits() and this.setSandboxAudits()
- Fix updateSandboxAuditConfig, getSandboxAuditConfig, getEnabledSandboxAudits, and removeSandboxAuditConfig methods
- Ensure sandbox audit configurations persist properly in database
- Add comprehensive logging for debugging sandbox audit operations
@Kanishkavijay39 Kanishkavijay39 force-pushed the feature/site-sandbox-configuration branch from efff862 to 4f00e5e Compare September 9, 2025 19:54
Kanishka added 3 commits September 10, 2025 01:51
- Add comprehensive documentation for the sandbox audit configuration update method
- Ensure clear understanding of method purpose and functionality
@Kanishkavijay39 Kanishkavijay39 force-pushed the feature/site-sandbox-configuration branch from 437e0f8 to 0b776e1 Compare September 10, 2025 18:18
Kanishka added 9 commits September 11, 2025 13:24
- Update updateSandboxAuditConfig to properly handle null values for removal
- Simplify schema validation to only require 'enabled' (boolean) and 'expire' (string/number)
- Allow additional properties for future extensibility
- Update tests to match new simplified schema and removal behavior

This ensures sandbox audit configurations can be properly removed by passing null values.
- Add sandbox audit methods to Configuration model
- Support updateSandboxAuditConfig, getSandboxAudits, etc.
- Fix regex pattern for audit type validation
- Simplify validation logic (remove null/undefined bypass)
- Remove auto-enable logic for sandbox sites
- Add comprehensive test coverage
- Rollback package-lock.json version updates
- Rollback unrelated test changes in audit/site models
- Rollback url-helpers.js export addition
- Remove unrelated test files (adobe-fetch.test.js, test-rum.js)
- Keep PR focused only on sandbox audit configuration
- Remove fix-entity.schema.test.js (99 lines, unrelated)
- Remove trial-user.schema.test.js (73 lines, unrelated)
- Keep feature branch focused only on sandbox configuration
…uration

- Update configuration schema to use cooldownHours instead of expire
- Update tests to reflect the new cooldownHours field
- Improve clarity: cooldownHours better describes the rate limiting behavior
- All tests passing with 100% coverage
- Restore original 768+ line API documentation file
- No functional changes to sandbox configuration feature
- Keep spacecat-shared focused on our sandbox changes only
@Kanishkavijay39 Kanishkavijay39 changed the title [WIP]Feature/site sandbox configuration Feature/site sandbox configuration Sep 16, 2025
@Kanishkavijay39 Kanishkavijay39 requested review from solaris007, iuliaangelescu and iuliag and removed request for iuliaangelescu September 17, 2025 07:05
@iuliag iuliag changed the title Feature/site sandbox configuration feat: site sandbox configuration Sep 17, 2025

// Get all enabled sandbox audit types
getEnabledSandboxAudits() {
return Object.keys(this.getSandboxAudits() || {});
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the list be filtered by enabled true, according to the schema https://github.com/adobe/spacecat-shared/pull/941/files#diff-ec6a8162056224108b6fc55e86bf6d58298ed01c9cd75a0bb024369f6356b49bR52 ?
Same for isAuditEnabledForSandbox below.

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.

3 participants