Skip to content

feat(serenity): bump project-engine-client to 1.2.0 and document v1/v2 read drift#2699

Merged
rainer-friederich merged 3 commits into
mainfrom
feat/2687
Jun 26, 2026
Merged

feat(serenity): bump project-engine-client to 1.2.0 and document v1/v2 read drift#2699
rainer-friederich merged 3 commits into
mainfrom
feat/2687

Conversation

@rainer-friederich

Copy link
Copy Markdown
Contributor

1. Abstract

Bumps @adobe/spacecat-shared-project-engine-client from 1.1.1 to 1.2.0 and lands two Serenity/Semrush implementation adjustments tracked in the running issue: documentation of the v1/v2 read-layer split, and a guard test for the model-edit republish contract.

2. Reasoning

1.2.0 is latest on npm and moves the Semrush aio/init_status route from /v1 to /v2, removing the /v1 route from the generated contract — so the transport must follow or it no longer type-checks. While in this code, two adjustments from the migration-readiness review (serenity-docs risk analysis) were closed: the v1/v2 read-drift that silently misreads an unpublished draft as empty/US, and locking in that a standalone model-set edit always republishes to the live layer.

3. High-level overview of the changes

  • Client bump 1.1.1 → 1.2.0. The only behavioural consequence for us is getInitStatus, which now calls GET /v2/workspaces/{id}/projects/{id}/aio/init_status (the /v1 route was removed upstream). init_status is an AIO-readiness boolean, not draft settings, so reading it from v2's live-view carries no draft-faithfulness concern. The other 1.2.0 changes (several response fields tightened to required; addAiModel 200→201; createProjectTags response object→array) are inert here — those consumers discard the response body and the transport's unwrap accepts any response.ok.
  • v1/v2 read-drift documentation (issue item 2). No code move — the only prompt read (listPromptsByTags) has no v1 variant, so it inherently reads the live (published) layer; an unpublished draft therefore reads empty (the "201-but-count-0" source). Added explaining comments on listPromptsByTags and listTagsForProject, and a new ADR recording which layer each Serenity read observes (v1 = draft settings, v2 prompts = live-only).
  • Model-edit republish guard (issue item 1). Behaviour was already correct (the standalone PUT /serenity/models path defaults publish: true; only brand-create batches its own publish). Added a guard test pinning that a publish/publishMode flag smuggled into the request body cannot suppress the republish.

No customer-visible API shape change; the /serenity/* surface consumed by elmo is unchanged.

4. Required information

6. Additional information outside the code

  • Diffed the published 1.1.1 vs 1.2.0 client paths types to scope the bump: confirmed aio/init_status is the only route that moved (v1 removed, v2 added) and that prompts remain v2-only in 1.2.0 (no v1 by_tags variant exists), which is why issue item 2 is documentation rather than a version swap.
  • Verified the two 1.2.0 runtime response-shape changes are inert by reading every consumer: addAiModel (markets.js) and createProjectTags (markets-subworkspace.js) both discard the response body, and unwrap gates on response.ok rather than a literal 200.

7. Test plan

  • (a) Ran the affected Serenity unit suites and the Serenity controller + OpenAPI-contract suites locally against the installed 1.2.0 client; the new model-edit guard test and the updated init_status assertion exercise the changed paths.
  • (b) dev: for a live (published) subworkspace brand, call the market-detail read (GET /serenity/markets/:geoTargetId/:languageCode) which triggers getInitStatus, and confirm initialized still resolves (now served by the v2 route). No prod/stage-specific steps — the change is an internal upstream-contract follow + docs/tests.

8. Deployment & merge order

🤖 Generated with Claude Code

…2 read drift

Bump @adobe/spacecat-shared-project-engine-client 1.1.1 -> 1.2.0. The client
moved aio/init_status from /v1 to /v2 and removed the /v1 route, so getInitStatus
now reads /v2/.../aio/init_status (init_status is a readiness boolean, not draft
settings, so v2's live-view is fine).

Address adjustments tracked in spacecat-api-service issue 2687:
- Item 2 (v1/v2 read drift): document the live-layer prompt-read semantics on
  listPromptsByTags and listTagsForProject (prompt reads are v2/live-only, no v1
  variant exists), and add ADR-006 with the per-read layer map.
- Item 1 (PUT /serenity/models republish): add a guard test pinning that the
  standalone model-edit path always republishes and that body publish flags
  cannot suppress it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

This PR will trigger a minor release when merged.

@MysticatBot MysticatBot added ai-reviewed Reviewed by AI complexity:high AI-assessed PR complexity: HIGH needs-human-review AI reviewer recommends a human read before merge labels Jun 26, 2026

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @rainer-friederich,

Verdict: Approve - well-scoped dependency bump with thorough documentation and a solid guard test.
Complexity: HIGH - medium diff; dependency bump with expanded transitive surface.
Changes: Bumps project-engine-client from 1.1.1 to 1.2.0, moves getInitStatus from /v1 to /v2 (route removed upstream), adds ADR-006 documenting the v1/v2 read-layer split, and pins the model-edit republish contract with a guard test (8 files).
Note: Recommend a human read before merge - this change amends an architectural decision record in docs/decisions/. The bot review is a complement to, not a replacement for, a human read here.

Non-blocking (3): minor issues and suggestions
  • nit: ADR-006 table describes writes as "mixed" without enumerating which operations use v1 vs v2; a future developer adding a write has no guidance from this row - docs/decisions/006-serenity-v1-v2-read-drift.md:50
  • nit: Lockfile top-level specifier records ^1.2.0 while package.json pins exact 1.2.0; functionally harmless (npm resolves from the lock entry) but would drift on a fresh install without the lockfile - package-lock.json:31
  • suggestion: Consider a single canonical pointer comment at the top of rest-transport.js referencing ADR-006 for developers adding new endpoints who may not discover the per-method JSDoc - src/support/serenity/rest-transport.js:1

Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 14m 26s | Cost: $7.60 | Commit: 36960631ca88abb7382abe855a1449dba912fd62
If this code review was useful, please react with 👍. Otherwise, react with 👎.

- ADR-006: clarify the writes row is per-op/contract-only (version does not
  affect draft-faithfulness; per-method map lives in the transport JSDoc) so a
  developer adding a write has guidance.
- rest-transport.js: add a top-of-file pointer to ADR-006 for the v1/v2
  read-layer choice when adding endpoints.
- package-lock.json: pin the top-level project-engine-client specifier to exact
  1.2.0 to match package.json (was a stray ^1.2.0 from the install).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rainer-friederich

Copy link
Copy Markdown
Contributor Author

Addressed all three non-blocking items from the MysticatBot review in bee2bd9f.

MysticatBot (non-blocking):

  • nit: ADR-006 writes row says "mixed" without v1/v2 guidance — done. Reworked the row to per-op with a footnote: writes are out of this ADR's read-scope, the API version doesn't affect draft-faithfulness for a write (every mutation stages in draft regardless of v1/v2 and only goes live on publishProject), and the authoritative per-method write map lives in the transport JSDoc + the serenity v2-endpoint audit. A developer adding a write now has an explicit pointer.
  • nit: lockfile records ^1.2.0 while package.json pins exact 1.2.0 — done. Pinned the top-level package-lock.json specifier to 1.2.0; npm install reconciles cleanly and leaves it exact.
  • suggestion: add a canonical ADR-006 pointer at the top of rest-transport.js — done. Added a module-level comment steering anyone adding a read endpoint to ADR-006 before defaulting to v2, alongside the existing per-method JSDoc.

Also rebased onto the latest feat/2687 (which the pipeline had merged main into — picks up 1.602.1 + http-utils 1.31.0). type-check and lint clean.

Noted your callout that this amends an ADR and merits a human read — agreed; leaving that for the CODEOWNER.

@rainer-friederich rainer-friederich enabled auto-merge (squash) June 26, 2026 07:00
@rainer-friederich rainer-friederich merged commit a1ea182 into main Jun 26, 2026
20 checks passed
@rainer-friederich rainer-friederich deleted the feat/2687 branch June 26, 2026 07:07
solaris007 pushed a commit that referenced this pull request Jun 26, 2026
# [1.603.0](v1.602.1...v1.603.0) (2026-06-26)

### Bug Fixes

* **llmo:** temporary cloudflareToken body/query fallback for CF token ([#2701](#2701)) ([b929f76](b929f76)), closes [#2681](#2681) [#2697](#2697)

### Features

* add POST /sites/:siteId/entitlements admin endpoint ([#2665](#2665)) ([4374fc4](4374fc4))
* **serenity:** bump project-engine-client to 1.2.0 and document v1/v2 read drift ([#2699](#2699)) ([a1ea182](a1ea182)), closes [Hi#level](https://github.com/Hi/issues/level) [#2584](#2584)
@solaris007

Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.603.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed Reviewed by AI complexity:high AI-assessed PR complexity: HIGH needs-human-review AI reviewer recommends a human read before merge released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants