feat: rename semantic-value-visibility opportunity to image-enrichment#2447
feat: rename semantic-value-visibility opportunity to image-enrichment#2447yevheniia-severinovska wants to merge 3 commits intomainfrom
Conversation
- Rename src/semantic-value-visibility/ to src/image-enrichment/ - Rename test/audits/ and test/fixtures/ folders - Update HANDLERS map keys in src/index.js - Update AUDIT_TYPE, GUIDANCE_TYPE, OPPORTUNITY_TYPE constants - Update log prefixes, docstrings, test descriptions
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
dzehnder
left a comment
There was a problem hiding this comment.
The rename is mechanically clean and well-tested. One in-scope safety improvement to the HANDLERS dispatch map is worth landing before merge.
Strengths
- Surgical 268-line rename across 9 files: import identifiers, HANDLERS map keys, log prefixes, test descriptions, esmock paths, fixture path/value, and the three constants in
constants.jsall move in lockstep. - Constants centralized in
src/image-enrichment/constants.js:13-15(AUDIT_TYPE,GUIDANCE_TYPE,OPPORTUNITY_TYPE) - the wire contract has a single source of truth. - Wire-contract assertion at
test/audits/image-enrichment/handler.test.js:86pins the literal'guidance:image-enrichment'(not the constant), so a future typo inconstants.jswould still be caught. - Fixture stub coverage: stale-opportunity branch at
guidance-handler.test.js:319correctly returns'image-enrichment'fromgetType(), exercising theOPPORTUNITY_TYPEcomparison atguidance-handler.js:71. - No leftover references at PR head: zero
semantic-value-visibility/semanticValueVisibilitymentions in non-CHANGELOG files. semanticHtmluntrusted-LLM-content safety annotation atguidance-handler.js:48and theArray.isArray(suggestions)validation are preserved verbatim - the rename does not weaken any trust boundary.- Naming aligns
image-enrichmentwith the existingmultimedia-enrichment(video) pattern: clean two-token taxonomy (modality + intent) that future audit types can slot into.
Issues
Important (Should Fix)
src/index.js:220-221 - HANDLERS map should keep the old keys as aliases for one release. Removing 'semantic-value-visibility' and 'guidance:semantic-value-visibility' means any in-flight SQS message with the old type hits the if (!handler) branch in src/index.js#run, logs a warn, and returns notFound(). SQS treats that as success, the message is acked, and the audit/guidance is silently dropped. Producers of these messages include scheduled crons in spacecat-jobs-dispatcher and in-flight mystique guidance responses - none of which are guaranteed to redeploy in lock-step with this PR.
Fix: add aliases for one release.
'image-enrichment': imageEnrichment,
'guidance:image-enrichment': imageEnrichmentGuidance,
// Deprecated aliases - remove after jobs-dispatcher cron + mystique PR 1704 reach prod
'semantic-value-visibility': imageEnrichment,
'guidance:semantic-value-visibility': imageEnrichmentGuidance,Four in-scope lines. Converts a strict 4-PR merge ordering into a tolerant rollout, decouples deploy graphs of independently-deployed services, and survives any single-repo rollback. Removal is a one-line follow-up PR after the producers cut over.
Minor (Nice to Have)
No integration-level test asserts HANDLERS dispatcher registration. Both unit-test files import the handler module directly and bypass src/index.js#run. A future merge conflict that drops one of the HANDLERS map entries would not be caught by this audit's own tests. Optional follow-up: a single test that posts {type: 'image-enrichment'} and {type: 'guidance:image-enrichment'} to run and asserts dispatch lands in the right handler. Locks in the rename against wiring drift at very low cost.
Recommendations
- Add a one-line note to the PR description spelling out the deploy ordering constraint and the in-flight-message risk, so the on-call merger does not have to reconstruct it from the cross-repo merge list.
- If you take the alias path, add a
// TODO(remove after jobs-dispatcher + mystique PR 1704 in prod)comment so the cleanup PR is greppable. Schedule the cleanup PR for ~2 weeks out.
Out of scope, worth tracking
- spacecat-jobs-dispatcher cron entry for
auditType: 'semantic-value-visibility': if not renamed and deployed in lock-step, scheduled audits drop silently until updated. Highest-leverage external coupling. - Outbound message type change to mystique:
sendToMystiquenow emitstype: 'guidance:image-enrichment'(verified athandler.test.js:86). Per the documented merge order, mystique PR 1704 deploys after this PR, so messages sent during the window will be unrecognized on the mystique side. Mystique-side handling, but reinforces the case for the inbound alias above (symmetric tolerance on both sides of the boundary). - Coralogix dashboards/alerts and saved DataPrime queries pinned to log prefix
[semantic-value-visibility]will silently lose signal once this deploys. - Historical DDB opportunity records with
type: 'semantic-value-visibility'are not migrated. UI must continue to handle both for the lifetime of those records, or a backfill must be scheduled.
Assessment
Ready to merge? With fixes.
Reasoning: The rename mechanics in this repo are clean and well-covered. The one in-scope safety improvement worth landing here is the 4-line HANDLERS alias - it costs almost nothing and decouples this repo's deploy from the jobs-dispatcher and mystique deploys. Without it, the merge is still safe only if the four-repo deploy is truly lock-step.
Next Steps
- Add the HANDLERS aliases in
src/index.js(4 lines + comment). - Add a one-line deploy ordering note to the PR description.
- Track the jobs-dispatcher and Coralogix items separately (not in this PR).
| 'semantic-value-visibility': semanticValueVisibility, | ||
| 'guidance:semantic-value-visibility': semanticValueVisibilityGuidance, | ||
| 'image-enrichment': imageEnrichment, | ||
| 'guidance:image-enrichment': imageEnrichmentGuidance, |
There was a problem hiding this comment.
Important: keep the old keys as aliases for one release.
Removing 'semantic-value-visibility' and 'guidance:semantic-value-visibility' from HANDLERS means any in-flight SQS message with the old type hits the if (!handler) branch in src/index.js#run, logs a warn, and returns notFound(). SQS treats that as success - the message is acked and the audit/guidance is silently dropped. Producers (scheduled crons in spacecat-jobs-dispatcher, in-flight mystique guidance responses) are not guaranteed to redeploy in lock-step with this PR.
Fix:
'image-enrichment': imageEnrichment,
'guidance:image-enrichment': imageEnrichmentGuidance,
// Deprecated aliases - remove after jobs-dispatcher cron + mystique PR 1704 reach prod
'semantic-value-visibility': imageEnrichment,
'guidance:semantic-value-visibility': imageEnrichmentGuidance,Four in-scope lines. Converts a strict 4-PR merge ordering into a tolerant rollout.
|
This PR will trigger a minor release when merged. |
|
Addressed in a640c36: kept old |
|
Round 2 — addressed all in-scope items:
Skipped the integration test for HANDLERS dispatcher — the existing test setup requires Re-requesting review. |
dzehnder
left a comment
There was a problem hiding this comment.
Prior Important is cleanly addressed. Ready to merge.
Strengths
- Prior Important resolved:
src/index.js:229-230adds'semantic-value-visibility'and'guidance:semantic-value-visibility'as aliases to the sameimageEnrichment/imageEnrichmentGuidancehandler instances. The// @deprecated remove after jobs-dispatcher + mystique PR 1704 in prodcomment names a concrete cleanup trigger that is greppable. - Symmetric with the alias landing in the spacecat-shared companion: together they convert a strict 4-PR ordering into a tolerant rollout window. The deploy ordering note added to the PR description makes the strategy reviewable without spelunking through commits.
- 3-line change with no new code paths or behavior changes - just routes legacy SQS message types to the same handlers during the cross-repo rollout window.
Recommendations
- Worth lifting as a reusable pattern for future downstream-coupled renames in the spacecat ecosystem: every dual-key handler should name the specific upstream PR(s) whose merge unblocks removal, so the alias never outlives its reason. Not blocking - this PR already does it.
- Author offered to add the integration-level HANDLERS dispatcher test if pushed; the original Minor framing was "not blocking," and the local-env friction (
@adobe/spacecat-shared-drs-clientinstall) is a reasonable defer. Skipping is fine.
Assessment
Ready to merge? Yes.
Reasoning: The Important is cleanly resolved with the minimum viable diff. CI is green. Pushback on the integration test is reasonable given the original Minor framing and local validation gap.
…2481) ## Summary Fixes `ValidationError2: type is invalid` on PROD: the guidance handler set `type: 'SUGGESTION_CODE'`, which is not in the suggestion type enum. As a result, opportunities are created but all Mystique-returned suggestions fail to persist. Discovered during a prod debugging session with Daniel. ## Fix Replace `'SUGGESTION_CODE'` with `'CODE_CHANGE'` — matches the pattern used by other Tokowaka HTML-injection handlers: - `src/summarization/guidance-handler.js:52` - `src/toc/handler.js:454` - `src/headings/handler.js:545` - `src/hreflang/handler.js:293` - `src/canonical/handler.js:675` - `src/csp/csp.js:196` - `src/structured-data/handler.js:133` Image-enrichment generates `<section data-llm-shadow>...` HTML, same shape as those handlers. `CONTENT_UPDATE` (used by `faqs`, `wikipedia-analysis`) is for text/copy rewrites and does not fit HTML injection. ## Files changed - `src/semantic-value-visibility/guidance-handler.js:110` - `test/audits/semantic-value-visibility/guidance-handler.test.js:187` ## Test plan - [x] `npx mocha test/audits/semantic-value-visibility/guidance-handler.test.js` passes (11 tests) - [ ] Verified on PROD after merge: suggestions persist with `type: 'CODE_CHANGE'` ## Related - Rename PR #2447 (image-enrichment) — will absorb this fix via "Update branch" once this lands; git's rename detection moves the change into `src/image-enrichment/guidance-handler.js`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Yevheniia Severinovska <yevheniiaseverinovska@Yevheniias-MacBook-Pro.local>
Summary
Renames the audit/opportunity type from
semantic-value-visibilitytoimage-enrichmentto align withmultimedia-enrichment(video transcripts) naming convention. Decision per Slack alignment with Dirk + Yaashi.Changes in this repo
src/semantic-value-visibility/→src/image-enrichment/(handler, guidance-handler, constants, opportunity-data-mapper)test/audits/semantic-value-visibility/andtest/fixtures/semantic-value-visibility/folderssrc/index.js:'semantic-value-visibility'→'image-enrichment','guidance:semantic-value-visibility'→'guidance:image-enrichment'AUDIT_TYPE,GUIDANCE_TYPE,OPPORTUNITY_TYPEconstantsDeploy ordering note
This PR can land independently. The deprecated HANDLERS aliases tolerate
semantic-value-visibilitymessages from producers (jobs-dispatcher cron, mystique) that have not yet deployed. Aliases removed in a follow-up PR after producer cutover (mystique PR 1704 + jobs-dispatcher) reaches prod.Cross-repo PRs
Test plan
test/audits/image-enrichment/**(24 tests)buildjob passed (4m19s including coverage gate)type: image-enrichment→ elmo UI renders correctly🤖 Generated with Claude Code