adobe / adobe/spacecat-api-service
Distinguish a real user-dismiss from a pipeline regeneration (status=deleted conflates them)
- Dominant language
- JavaScript
- Stars
- 10
- Forks
- 15
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 150
Description
**Severity:** 🟠 inflates the "dismissed" count
**Group C — Postgres prompts**
## Problem
The `prompts` table has one `status=deleted` flag that mixes (a) a customer really rejecting a prompt with (b) the pipeline regenerating and superseding an old prompt with a near-duplicate. Any acceptance dashboard reading `status=deleted` as "dismissed" **over-counts rejections**.
## Evidence
Both the user-dismiss and the pipeline-regeneration go through the **same two functions**, with no reason recorded — which is exactly why they're indistinguishable:
- `softDeletePrompt` → `src/support/prompts-storage.js:1287` `.update({ status: 'deleted', updated_by })`
- `bulkSoftDeletePrompts` → `src/support/prompts-storage.js:1331` (same update)
Independent detection (from analysis): superseded deletions sit at cosine ≈1.00 to a still-kept prompt; for some brands the deleted rows are dominated by regeneration.
## Implementation
Add a `deleted_reason` (`user_dismiss` | `superseded`) — or a `superseded_by` / `superseded_at` pointer — param to those two functions, and have the **regeneration caller** pass `superseded` while the UI dismiss passes `user_dismiss`. Precedent already in this repo: `superseded_at` is used on another entity (`src/dto/audit-policy.js:76`).
## Retrieval impact
The true dismiss count **isn't retrievable** — `status=deleted` returns real rejects + pipeline regenerations mixed together, inflating "dismissed".
## Definition of done
A dismissed-because-rejected prompt is distinguishable from a regenerated one; acceptance metrics count only real dismisses.
---
Related epic: adobe/project-elmo-ui#3108.
Contributor guide
Research direction
Start by tracing softDeletePrompt and bulkSoftDeletePrompts in src/support/prompts-storage.js at lines 1287 and 1331, then identify the regeneration caller and the UI dismiss path. Review the prompts status update and the precedent in src/dto/audit-policy.js:76; done means deleted prompts preserve whether they were user-dismissed or superseded and acceptance metrics count only real dismissals.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100