Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Audit extends BaseModel {
COMMERCE_PRODUCT_CATALOG_ENRICHMENT_AUTO_FIX: 'commerce-product-catalog-enrichment-auto-fix',
CWV_TRENDS_AUDIT: 'cwv-trends-audit',
OFFSITE_BRAND_PRESENCE: 'offsite-brand-presence',
SEMANTIC_VALUE_VISIBILITY: 'semantic-value-visibility',
IMAGE_ENRICHMENT: 'image-enrichment',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important: removing SEMANTIC_VALUE_VISIBILITY is a breaking change to the published AUDIT_TYPES enum.

No symbolic consumer was found across adobe/* (consumers use the string literal directly), but AUDIT_TYPES is part of the @adobe/spacecat-shared-data-access contract. Since this PR lands first in the 4-PR cross-repo sequence, the lower-risk path is to keep both keys for one minor cycle:

IMAGE_ENRICHMENT: 'image-enrichment',
/** @deprecated use IMAGE_ENRICHMENT - remove after mystique PR 1704 + audit-worker PR 2447 in prod */
SEMANTIC_VALUE_VISIBILITY: 'image-enrichment',

Delete the alias in a follow-up PR once the producer side is fully cut over.

};

static AUDIT_TYPE_PROPERTIES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe('AuditModel', () => {
COMMERCE_PRODUCT_CATALOG_ENRICHMENT_AUTO_FIX: 'commerce-product-catalog-enrichment-auto-fix',
CWV_TRENDS_AUDIT: 'cwv-trends-audit',
OFFSITE_BRAND_PRESENCE: 'offsite-brand-presence',
SEMANTIC_VALUE_VISIBILITY: 'semantic-value-visibility',
IMAGE_ENRICHMENT: 'image-enrichment',
};

it('should have all audit types present in AUDIT_TYPES', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import BaseOpportunityMapper from './base-mapper.js';
import { htmlToHast } from '../utils/html-utils.js';

/**
* Mapper for semantic-value-visibility opportunity
* Mapper for image-enrichment opportunity
* Handles conversion of image semantic HTML suggestions to Tokowaka patches
*/
export default class SemanticValueVisibilityMapper extends BaseOpportunityMapper {
export default class ImageEnrichmentMapper extends BaseOpportunityMapper {
constructor(log) {
super(log);
this.opportunityType = 'semantic-value-visibility';
this.opportunityType = 'image-enrichment';
this.prerenderRequired = true;
this.validActions = ['insertAfter', 'insertBefore', 'appendChild'];
}
Expand All @@ -48,7 +48,7 @@ export default class SemanticValueVisibilityMapper extends BaseOpportunityMapper
suggestions.forEach((suggestion) => {
const eligibility = this.canDeploy(suggestion);
if (!eligibility.eligible) {
this.log.warn(`Semantic-value-visibility suggestion ${suggestion.getId()} cannot be deployed: ${eligibility.reason}`);
this.log.warn(`Image-enrichment suggestion ${suggestion.getId()} cannot be deployed: ${eligibility.reason}`);
return;
}

Expand All @@ -74,7 +74,7 @@ export default class SemanticValueVisibilityMapper extends BaseOpportunityMapper
}

/**
* Checks if a semantic-value-visibility suggestion can be deployed
* Checks if an image-enrichment suggestion can be deployed
* @param {Object} suggestion - Suggestion object
* @returns {Object} { eligible: boolean, reason?: string }
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import TocMapper from './toc-mapper.js';
import GenericMapper from './generic-mapper.js';
import PrerenderMapper from './prerender-mapper.js';
import CommercePageEnrichmentMapper from './commerce-page-enrichment-mapper.js';
import SemanticValueVisibilityMapper from './semantic-value-visibility-mapper.js';
import ImageEnrichmentMapper from './image-enrichment-mapper.js';

/**
* Registry for opportunity mappers
Expand All @@ -45,7 +45,7 @@ export default class MapperRegistry {
GenericMapper,
PrerenderMapper,
CommercePageEnrichmentMapper,
SemanticValueVisibilityMapper,
ImageEnrichmentMapper,
];

defaultMappers.forEach((MapperClass) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url": "https://carahsoft.com/",
"opportunityType": "semantic-value-visibility",
"opportunityType": "image-enrichment",
"suggestions": [
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url": "https://koffievoordeel.nl/",
"opportunityType": "semantic-value-visibility",
"opportunityType": "image-enrichment",
"suggestions": [
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url": "https://www.krisshop.com/en",
"opportunityType": "semantic-value-visibility",
"opportunityType": "image-enrichment",
"suggestions": [
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url": "https://veseris.com/default/",
"opportunityType": "semantic-value-visibility",
"opportunityType": "image-enrichment",
"suggestions": [
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url": "https://www.vuse.com/ch/en",
"opportunityType": "semantic-value-visibility",
"opportunityType": "image-enrichment",
"suggestions": [
{
"data": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { expect } from 'chai';
import GenericMapper from '../../src/mappers/generic-mapper.js';

const filename = fileURLToPath(import.meta.url);
const fixturesPath = join(dirname(filename), '../fixtures/semantic-value-visibility');
const fixturesPath = join(dirname(filename), '../fixtures/image-enrichment');
const carahsoftFixture = JSON.parse(
readFileSync(join(fixturesPath, 'Carahsoft.json'), 'utf8'),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { expect } from 'chai';
import { readFileSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import SemanticValueVisibilityMapper from '../../src/mappers/semantic-value-visibility-mapper.js';
import ImageEnrichmentMapper from '../../src/mappers/image-enrichment-mapper.js';

const filename = fileURLToPath(import.meta.url);
const fixturesPath = join(dirname(filename), '../fixtures/semantic-value-visibility');
const fixturesPath = join(dirname(filename), '../fixtures/image-enrichment');

// Load real Mystique response fixtures
// Carahsoft proves the logic is correct, others prove it doesn't crash with different real inputs.
Expand All @@ -27,7 +27,7 @@ const krisshopFixture = JSON.parse(readFileSync(join(fixturesPath, 'Krisshop.jso
const veserisFixture = JSON.parse(readFileSync(join(fixturesPath, 'Veseris.json'), 'utf8'));
const vuseFixture = JSON.parse(readFileSync(join(fixturesPath, 'Vuse.json'), 'utf8'));

describe('SemanticValueVisibilityMapper', () => {
describe('ImageEnrichmentMapper', () => {
let mapper;
let log;

Expand All @@ -38,12 +38,12 @@ describe('SemanticValueVisibilityMapper', () => {
warn: () => {},
error: () => {},
};
mapper = new SemanticValueVisibilityMapper(log);
mapper = new ImageEnrichmentMapper(log);
});

describe('getOpportunityType', () => {
it('should return semantic-value-visibility', () => {
expect(mapper.getOpportunityType()).to.equal('semantic-value-visibility');
it('should return image-enrichment', () => {
expect(mapper.getOpportunityType()).to.equal('image-enrichment');
});
});

Expand Down
Loading