Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

Commit 406b238

Browse files
fix(data-access): allow rejecting new suggestions and refresh integration setup
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents 97f0d11 + 6ba0529 commit 406b238

8 files changed

Lines changed: 35 additions & 17 deletions

File tree

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/spacecat-shared-data-access/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [@adobe/spacecat-shared-data-access-v4.40.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v4.40.0...@adobe/spacecat-shared-data-access-v4.40.1) (2026-10-08)
2+
3+
### Bug Fixes
4+
5+
* **suggestions:** allow NEW -> REJECTED transition ([#1970](https://github.com/adobe/spacecat-shared/issues/1970)) ([8281605](https://github.com/adobe/spacecat-shared/commit/8281605431096155fc11b0a3f488978f89492865))
6+
17
## [@adobe/spacecat-shared-data-access-v4.40.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v4.39.1...@adobe/spacecat-shared-data-access-v4.40.0) (2026-10-02)
28

39
### Features

‎packages/spacecat-shared-data-access/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/spacecat-shared-data-access",
3-
"version": "4.40.0",
3+
"version": "4.40.1",
44
"description": "Shared modules of the Spacecat Services - Data Access",
55
"type": "module",
66
"engines": {

‎packages/spacecat-shared-data-access/src/models/suggestion/suggestion.transitions.js‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ export const SUGGESTION_CREATE = Symbol('SUGGESTION_CREATE');
4242
* drowning real flows in false warnings. The warn logs from the rollout period
4343
* inform which entries to tighten before flipping to enforce.
4444
*
45-
* The one hard rule already enforced by api-service is preserved exactly:
46-
* REJECTED is only reachable from PENDING_VALIDATION (suggestions.js).
45+
* The hard rule enforced by api-service (SITES-53247): REJECTED is only
46+
* reachable from NEW or PENDING_VALIDATION (suggestions.js).
4747
*/
4848
export const SUGGESTION_TRANSITIONS = {
49-
// audit-worker creates as NEW (non-paid) or PENDING_VALIDATION (paid); OUTDATED at audit time.
49+
// SITES-53247: audit-worker now always creates as NEW; OUTDATED at audit time.
50+
// PENDING_VALIDATION retained for historical rows and V2.
5051
[SUGGESTION_CREATE]: [S.NEW, S.PENDING_VALIDATION, S.OUTDATED],
51-
// ESE/TBYB review (-> NEW), mystique (-> IN_PROGRESS), bubble-up, UI skip, re-audit.
52-
[S.NEW]: [S.APPROVED, S.IN_PROGRESS, S.FIXED, S.ERROR, S.SKIPPED, S.OUTDATED],
53-
// paid-review gate: approve -> NEW, decline -> REJECTED (the one hard rule), or skip/outdate.
52+
// ESE review (-> REJECTED, SITES-53247), mystique (-> IN_PROGRESS), bubble-up, UI skip, re-audit.
53+
[S.NEW]: [S.APPROVED, S.IN_PROGRESS, S.FIXED, S.ERROR, S.SKIPPED, S.OUTDATED, S.REJECTED],
54+
// paid-review gate: approve -> NEW, decline -> REJECTED (the hard rule), or skip/outdate.
5455
// IN_PROGRESS: api-service autofixSuggestions accepts PENDING_VALIDATION and sets IN_PROGRESS.
5556
[S.PENDING_VALIDATION]: [S.NEW, S.IN_PROGRESS, S.REJECTED, S.SKIPPED, S.OUTDATED],
5657
[S.APPROVED]: [S.IN_PROGRESS, S.FIXED, S.ERROR, S.SKIPPED, S.NEW, S.OUTDATED],

‎packages/spacecat-shared-data-access/test/it/postgrest/all-collections-methods-coverage.test.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ const EXPECTED_INVOCATION_ERROR_PATTERNS = [
8686
'invalid input value for enum',
8787
'not configured',
8888
'schema cache',
89+
// Write-protected collections (e.g. AbvOnboardingClaim) revoke direct table
90+
// access and only expose RPC functions, so generic reads legitimately 403.
91+
'permission denied for table',
8992
];
9093

9194
const isMutatingMethod = (methodName) => MUTATING_METHOD_PREFIXES

‎packages/spacecat-shared-data-access/test/it/postgrest/docker-compose.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ services:
3838
# the oldest still-available tag (v5.104.0) since both are far past v5.80.0 and
3939
# pinning to the tip buys the most runway before the next forced bump.
4040
# v5.137.0 (2026-09-25): v5.115.0 aged out of ECR; also carries the semantic-index schema.
41-
# v5.156.0 (2026-10-07): v5.137.0 was deleted from ECR.
41+
# v5.157.0 (2026-10-08): v5.137.0 aged out of ECR; bumped to current tip.
4242
#
4343
# To obtain or refresh the digest:
4444
# aws ecr describe-images \
4545
# --profile <your-profile> --region us-east-1 \
4646
# --repository-name mysticat-data-service \
47-
# --image-ids imageTag=v5.156.0 \
47+
# --image-ids imageTag=v5.157.0 \
4848
# --query 'imageDetails[0].imageDigest' --output text
4949
# Then export MYSTICAT_DATA_SERVICE_DIGEST=sha256:<the-digest> before npm run test:it,
5050
# or set it in the .env file consumed by docker compose. Leave unset for local dev.
51-
image: ${MYSTICAT_DATA_SERVICE_REPOSITORY:-682033462621.dkr.ecr.us-east-1.amazonaws.com/mysticat-data-service}:${MYSTICAT_DATA_SERVICE_TAG:-v5.156.0}${MYSTICAT_DATA_SERVICE_DIGEST:+@${MYSTICAT_DATA_SERVICE_DIGEST}}
51+
image: ${MYSTICAT_DATA_SERVICE_REPOSITORY:-682033462621.dkr.ecr.us-east-1.amazonaws.com/mysticat-data-service}:${MYSTICAT_DATA_SERVICE_TAG:-v5.157.0}${MYSTICAT_DATA_SERVICE_DIGEST:+@${MYSTICAT_DATA_SERVICE_DIGEST}}
5252
depends_on:
5353
db:
5454
condition: service_healthy

‎packages/spacecat-shared-data-access/test/unit/models/suggestion/suggestion.model.test.js‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,23 +693,30 @@ describe('SuggestionModel', () => {
693693

694694
it('warns but still applies an illegal transition in warn mode (default)', () => {
695695
delete process.env.STATUS_TRANSITION_ENFORCEMENT;
696-
const { model, mockLogger } = createElectroMocks(Suggestion, { ...mockRecord, status: 'NEW' });
696+
const { model, mockLogger } = createElectroMocks(Suggestion, { ...mockRecord, status: 'APPROVED' });
697697
mockLogger.warn.resetHistory(); // ignore construction-time warnings
698-
model.setStatus('REJECTED'); // REJECTED only legal from PENDING_VALIDATION
698+
model.setStatus('REJECTED'); // REJECTED only legal from NEW or PENDING_VALIDATION (SITES-53247)
699699
expect(model.record.status).to.equal('REJECTED');
700700
expect(mockLogger.warn).to.have.been.calledOnce;
701701
});
702702

703-
it('allows REJECTED only from PENDING_VALIDATION in enforce mode', () => {
703+
it('allows REJECTED from PENDING_VALIDATION in enforce mode', () => {
704704
process.env.STATUS_TRANSITION_ENFORCEMENT = 'enforce';
705705
const { model } = createElectroMocks(Suggestion, { ...mockRecord, status: 'PENDING_VALIDATION' });
706706
expect(() => model.setStatus('REJECTED')).to.not.throw();
707707
expect(model.record.status).to.equal('REJECTED');
708708
});
709709

710-
it('throws on an illegal transition (NEW -> REJECTED) in enforce mode', () => {
710+
it('allows REJECTED from NEW in enforce mode (SITES-53247: pre-validation gate retired)', () => {
711711
process.env.STATUS_TRANSITION_ENFORCEMENT = 'enforce';
712712
const { model } = createElectroMocks(Suggestion, { ...mockRecord, status: 'NEW' });
713+
expect(() => model.setStatus('REJECTED')).to.not.throw();
714+
expect(model.record.status).to.equal('REJECTED');
715+
});
716+
717+
it('throws on an illegal transition (APPROVED -> REJECTED) in enforce mode', () => {
718+
process.env.STATUS_TRANSITION_ENFORCEMENT = 'enforce';
719+
const { model } = createElectroMocks(Suggestion, { ...mockRecord, status: 'APPROVED' });
713720
expect(() => model.setStatus('REJECTED')).to.throw('Suggestion');
714721
});
715722
});

‎packages/spacecat-shared-data-access/test/unit/models/suggestion/suggestion.transitions.test.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ describe('Suggestion transitions', () => {
2828
['NEW', 'ERROR'],
2929
['PENDING_VALIDATION', 'NEW'],
3030
['PENDING_VALIDATION', 'IN_PROGRESS'], // api-service autofixSuggestions path
31-
['PENDING_VALIDATION', 'REJECTED'], // the one hard rule preserved from api-service
31+
['PENDING_VALIDATION', 'REJECTED'], // the hard rule: NEW or PENDING_VALIDATION only
32+
['NEW', 'REJECTED'], // SITES-53247: ESE can reject directly from NEW now the gate is retired
3233
['IN_PROGRESS', 'FIXED'],
3334
['IN_PROGRESS', 'NEW'], // bubble-up: all issues NEUTRAL
3435
['FIXED', 'NEW'], // re-detection reopens
@@ -40,7 +41,7 @@ describe('Suggestion transitions', () => {
4041
];
4142

4243
const illegal = [
43-
['NEW', 'REJECTED'], // REJECTED only from PENDING_VALIDATION
44+
['APPROVED', 'REJECTED'], // REJECTED only from NEW or PENDING_VALIDATION
4445
['FIXED', 'REJECTED'],
4546
['REJECTED', 'FIXED'], // reopen only to NEW, not straight to a terminal outcome
4647
['SKIPPED', 'FIXED'],

0 commit comments

Comments
 (0)