fix(serenity): add required type to brand-alias updateProject PATCH#2721
Conversation
The brand-alias re-sync called transport.updateProject(...) with a body that omitted the required `type` field on ProjectUpdateRequest, so any drifted brand_names update 400s against the live Semrush Project Engine gateway (Go-validator: 'Type' failed on the 'required' tag) — silently no-oping the project-level alias sync. Add `type: 'ai'` to the PATCH body, matching the literal used at project create-time (handlers/markets.js, handlers/markets-subworkspace.js). AIO projects are always type 'ai'. Pin it in the three updateProject body assertions in the unit test. Fixes: #2720 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Hey @rainer-friederich,
Verdict: Approve - clean, well-scoped bug fix with adequate test coverage.
Complexity: TRIVIAL - 6 lines, 2 files, single call-site fix.
Changes: Adds the required type: 'ai' field to the brand-alias re-sync updateProject PATCH body so it validates against the Semrush Project Engine gateway (2 files).
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 0m 43s | Cost: $2.00 | Commit: 3173a31bba38c062f019f5f0b006545f75c38398
If this code review was useful, please react with 👍. Otherwise, react with 👎.
|
This PR will trigger a patch release when merged. |
## [1.609.3](v1.609.2...v1.609.3) (2026-06-29) ### Bug Fixes * **serenity:** add required `type` to brand-alias updateProject PATCH ([#2721](#2721)) ([174d852](174d852)), closes [Hi#level](https://github.com/Hi/issues/level) [#1746](#1746)
|
🎉 This PR is included in version 1.609.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
1. Abstract
Adds the required
type: 'ai'field to the serenity brand-alias re-syncupdateProjectPATCH body so the request validates against the Semrush Project Engine gateway.2. Reasoning
The brand-alias re-sync in
src/support/serenity/brand-aliases.jscalledtransport.updateProject(...)with a body that omitted thetypefield, which isrequiredonProjectUpdateRequest. A live sweep (captured 2026-06-29) confirmed that a typelessPATCH /v1/workspaces/{id}/projects/{pid}returns400(Key: 'ProjectUpdateRequest.Type' Error:Field validation for 'Type' failed on the 'required' tag), while the same PATCH withtype: 'ai'returns200. As a result, any brand-alias change that actually drifts a project'sbrand_nameswould fail in production and silently no-op the project-level alias sync. The gap went uncaught because no IT exercised the alias-resync PATCH path against the PE mock, even though the mock already 400s a typeless PATCH.3. High-level overview of the changes
brand_namesre-sync branch sent{ brand_name_display?, brand_names }— notype— so a drifted update 400'd against the live gateway and the alias sync silently failed.type: 'ai'(matching the literal used at project create-time inhandlers/markets.jsandhandlers/markets-subworkspace.js; AIO projects are always typeai), so the request validates and the driftedbrand_namesupdate succeeds.brand_namesset has drifted from the desired set; the benchmarkbrand_aliasesPUT path is untouched.type: 'ai', so a future regression that drops the field is caught locally.4. Required information
type— brand-alias PATCH 400s against live Semrush #27205. Affected / used mysticat-workspace projects
typerequirement at the request-validation seam; spacecat-shared PR feat: support running against a local spacecat instance | LLMO-2816 #1746 pins the typeless-PATCH 400 as an e2e. This change makes serenity conform to that contract.7. Test plan
brand-aliasesunit suite, which now assertstype: 'ai'on all threeupdateProjectbody expectations; the serenity// @ts-checktype-check gate also covers the touched file. No live e2e was run this session — the production defect was identified from the 2026-06-29 live Semrush sweep referenced in the issue.brand_names(display name or alias edit) and confirm thePATCH /v1/workspaces/{id}/projects/{pid}returns200rather than400, and that the project'ssettings.ai.brand_namesreflects the new set.8. Deployment & merge order
🤖 Generated with Claude Code