diff --git a/packages/spacecat-shared-data-access/src/models/geo-experiment/geo-experiment.model.js b/packages/spacecat-shared-data-access/src/models/geo-experiment/geo-experiment.model.js index 1dcd07168..36b11ba61 100644 --- a/packages/spacecat-shared-data-access/src/models/geo-experiment/geo-experiment.model.js +++ b/packages/spacecat-shared-data-access/src/models/geo-experiment/geo-experiment.model.js @@ -22,6 +22,7 @@ class GeoExperiment extends BaseModel { static TYPES = { ONSITE_OPPORTUNITY_DEPLOYMENT: 'onsite_opportunity_deployment', + OPTIMIZE_AT_SOURCE: 'optimize_at_source', }; static STATUSES = { @@ -47,6 +48,14 @@ class GeoExperiment extends BaseModel { POST_ANALYSIS_DONE: 'post_analysis_done', IMPACT_MEASUREMENT_STARTED: 'impact_measurement_started', IMPACT_MEASUREMENT_DONE: 'impact_measurement_done', + // optimize-at-source (OAS) strategy phases + OAS_INITIATED: 'oas_initiated', + OAS_BASELINE_STARTED: 'oas_baseline_started', + OAS_BASELINE_DONE: 'oas_baseline_done', + OAS_AWAITING_PUBLISH: 'oas_awaiting_publish', + OAS_PUBLISH_VERIFIED: 'oas_publish_verified', + OAS_POST_SNAPSHOT: 'oas_post_snapshot', + OAS_COMPLETED: 'oas_completed', }; /** @@ -83,6 +92,15 @@ class GeoExperiment extends BaseModel { OAE_VALIDATION_JOBS: 'oaeValidationJobs', // Baseline (window 0) measurement bookkeeping, e.g. { taskId, startedAt, retryCount }. BASELINE_MEASUREMENT: 'baselineMeasurement', + // optimize-at-source bookkeeping. + // URLs the external UI deployed, to be publish-checked, e.g. ['https://example.com/a']. + DEPLOYED_URLS: 'deployedUrls', + // Publish-check progress, e.g. { verifiedUrls: [...], lastCheckedAt }. + PUBLISH_CHECK: 'publishCheck', + // 14-day post window bookkeeping, e.g. { startedAt, lastSnapshotAt, snapshotCount }. + POST_WINDOW: 'postWindow', + // S3 location (key) of the raw daily SEO-metric snapshots. + SNAPSHOTS_LOCATION: 'snapshotsLocation', }; /** diff --git a/packages/spacecat-shared-data-access/test/unit/models/geo-experiment/geo-experiment.model.test.js b/packages/spacecat-shared-data-access/test/unit/models/geo-experiment/geo-experiment.model.test.js index edbb61e5a..101ca4756 100644 --- a/packages/spacecat-shared-data-access/test/unit/models/geo-experiment/geo-experiment.model.test.js +++ b/packages/spacecat-shared-data-access/test/unit/models/geo-experiment/geo-experiment.model.test.js @@ -83,9 +83,31 @@ describe('GeoExperimentModel', () => { ROUTING_VALIDATION: 'routingValidation', OAE_VALIDATION_JOBS: 'oaeValidationJobs', BASELINE_MEASUREMENT: 'baselineMeasurement', + DEPLOYED_URLS: 'deployedUrls', + PUBLISH_CHECK: 'publishCheck', + POST_WINDOW: 'postWindow', + SNAPSHOTS_LOCATION: 'snapshotsLocation', }); }); + it('exposes the optimize-at-source experiment type', () => { + expect(GeoExperiment.TYPES.OPTIMIZE_AT_SOURCE).to.equal('optimize_at_source'); + }); + + it('exposes the optimize-at-source phases, in lifecycle order', () => { + const oasPhases = Object.entries(GeoExperiment.PHASES) + .filter(([key]) => key.startsWith('OAS_')); + expect(oasPhases).to.deep.equal([ + ['OAS_INITIATED', 'oas_initiated'], + ['OAS_BASELINE_STARTED', 'oas_baseline_started'], + ['OAS_BASELINE_DONE', 'oas_baseline_done'], + ['OAS_AWAITING_PUBLISH', 'oas_awaiting_publish'], + ['OAS_PUBLISH_VERIFIED', 'oas_publish_verified'], + ['OAS_POST_SNAPSHOT', 'oas_post_snapshot'], + ['OAS_COMPLETED', 'oas_completed'], + ]); + }); + it('exposes SCHEDULE_CONFIG_KEYS constant', () => { expect(GeoExperiment.SCHEDULE_CONFIG_KEYS).to.deep.equal({ CRON_EXPRESSION: 'cronExpression',