Commit d3d823c
<!-- mysticat-pr-skill -->
## 1. Abstract
Raises the fidelity of the Project Engine and User Manager Counterfact
mocks (`spacecat-shared-project-engine-client`,
`spacecat-shared-user-manager-client`) so a created+published market
round-trips, plus the complementary live-vs-mock divergences a second
sweep surfaced. Mock + documentation only — no production-code change.
## 2. Reasoning
With the publish 406 fixed in 1.3.1 (#1742), `POST markets` / `activate`
reach a published `201` against the PE mock, but a just-created market
did not round-trip: it never appeared in `GET markets`, `GET
markets/{geo}/{lang}` 404'd, and a prompt against that slice was
skipped. Root cause: the mock's created-project read-view returned an
empty `settings.ai.language.name`, so the consumer's `langOf` resolved
`null` and `listMarkets` dropped the project; and `publish` never
flipped the stored `publish_status`. A subsequent live-fidelity sweep
against the real Semrush gateway (captured in issue 1745) surfaced a set
of complementary mock-vs-live divergences worth closing while here. None
is a production bug.
## 3. High-level overview of the changes
Project Engine mock:
- The created read-view now resolves `settings.ai.language.name` to the
ISO code the live API returns there (e.g. `en`) — not the empty string,
and not the English display name — via a new shared
`mock/language-catalog.js` (canonical `id` ↔ display-name ↔ `iso`
catalog). The `GET /v1/languages` route now reads that catalog through
the request context instead of carrying its own duplicate copy.
`country.name` is resolved from the country code via
`Intl.DisplayNames`.
- `publish` now moves the stored project to the live state:
`publish_status` flips `draft` → `live` and `published_at` is stamped,
while `is_draft` is left unchanged (matching live, which keeps it `true`
post-publish). A later list/get therefore reports the published status.
- Net behaviour: create → publish → `GET markets` now lists the market
with `languageCode` and a `live` status, `GET markets/{geo}/{lang}`
resolves, and a prompt attaches to the slice.
- Second-sweep fidelity (live-pinned 2026-06-29): the read-view echoes
`null` (not `[]`/`''`) for an omitted `brand_names` / `location_name`;
prompt creation dedups by text into `existing_count`; benchmark creation
returns a hard `409` on a duplicate brand name / alias / domain —
including two conflicting entries within the same batch; deleting a
non-existent project returns `404` (the consumer treats a delete-404 as
success).
User Manager mock:
- The pool-exhaustion `422` now returns the live string `insufficient
available units in subscription`.
- `GET family` on an unknown workspace now returns `403`, mirroring `GET
status` (previously `200 []`).
Both packages' `docs/mock-statefulness.md` now record the intentional
simplifications the sweep confirmed (no tenant/ownership model and
presence-only bearer; the two-layer live error model and the unguarded
500s the mock does not reproduce; pagination asymmetry across catalogs;
empty `brand-topics` prompts; the UM stuck-`not ready` / 422-on-delete
zombie window and the spurious mock-only `role` field).
## 4. Required information
- Jira / issue: #1745
## 5. Affected / used mysticat-workspace projects
- `spacecat-api-service` — consumed (contract). Its serenity API-level
integration suite boots these two mock images; this PR makes the
created-market read-back and prompt-lifecycle assertions there pass. No
code change required in that repo for the mock behaviour, but it picks
up the corrected images once these packages release.
## 6. Additional information outside the code
- Drove the booted PE and UM mocks end-to-end through the
serenity-relevant lifecycle (create → publish → list round-trip;
prompt-text dedup; duplicate-benchmark `409`; non-existent-project
delete `404`; UM over-allocation `422` string; UM `family` on an unknown
workspace `403`) and confirmed the read-back shapes match the live
shapes captured in the issue. The live shapes themselves were captured
against the real Semrush prod gateway in the sweeps recorded on issue
1745.
## 7. Test plan
- (a) Local: ran each package's mock end-to-end via its e2e harness
(which boots the Counterfact server) and exercised the round-trip,
dedup, conflict, delete-404, and the UM string/403 paths described
above, plus the existing lifecycle suites, all against the booted mock.
- (b) Per-environment: not applicable — these packages ship only the
mock under `mock/` (used by local dev and the cross-repo e2e harness)
and the typed client `src/`; there is no service deployment. Downstream
verification happens in `spacecat-api-service`'s serenity IT once the
corrected mock images are consumed.
## 8. Deployment & merge order
- Related: #1742 (publish 406, fixed in 1.3.1) — already merged; this PR
builds on it.
- Related: adobe/spacecat-api-service PR 2709 — consumes the corrected
PE mock image in the serenity IT; it can drop its documented round-trip
caveats once these packages release and its mock image tag picks them
up. No hard merge ordering within this repo; independent to merge.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e87371a commit d3d823c
19 files changed
Lines changed: 639 additions & 89 deletions
File tree
- packages
Lines changed: 86 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
81 | 105 | | |
82 | 106 | | |
83 | 107 | | |
| |||
93 | 117 | | |
94 | 118 | | |
95 | 119 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
102 | 174 | | |
103 | 175 | | |
104 | 176 | | |
105 | 177 | | |
106 | 178 | | |
107 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
108 | 186 | | |
109 | 187 | | |
110 | 188 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
Lines changed: 7 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 24 | + | |
64 | 25 | | |
65 | | - | |
| 26 | + | |
| 27 | + | |
66 | 28 | | |
67 | 29 | | |
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | 63 | | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
21 | 30 | | |
22 | 31 | | |
23 | 32 | | |
| |||
30 | 39 | | |
31 | 40 | | |
32 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
33 | 47 | | |
34 | 48 | | |
35 | 49 | | |
| |||
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
24 | 36 | | |
25 | 37 | | |
| 38 | + | |
26 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
27 | 62 | | |
28 | | - | |
| 63 | + | |
29 | 64 | | |
30 | 65 | | |
31 | 66 | | |
| |||
0 commit comments