Skip to content

feat: give admin CSAT its own db key + metric#9787

Open
bookwormsuf wants to merge 4 commits into
feat/admin-feedback-starsfrom
feat/admin-rating-rename
Open

feat: give admin CSAT its own db key + metric#9787
bookwormsuf wants to merge 4 commits into
feat/admin-feedback-starsfrom
feat/admin-rating-rename

Conversation

@bookwormsuf

Copy link
Copy Markdown
Contributor

Problem

The new admin satisfaction measure (1-5 stars) is stored in the same rating
field as legacy thumbs feedback (0/1), and reported via a temporary .rating.v2
metric. Old and new data share one field, and the metric name doesn't say what
it measures.

Solution

Give the new measure its own csat key so it never mixes with legacy rating
data, and name the metric for what it is (CSAT).

Improvements:

  • Add optional csat (1-5) field to the admin feedback schema; relax legacy
    rating to optional (kept for historical thumbs rows).
  • New rows store csat only; rating is no longer written.
  • Rename Datadog metric .rating.v2formsg.users.feedback.csat; keep the
    transitional formsg.users.feedback.rating emit so the current report card
    keeps working.
  • Backend-only: the wire payload stays rating and is mapped to csat in the
    controller, so no frontend change and no overlap with the star-UI PR.
  • No data migration: the flag is off in prod and no star rows exist yet.

Follow-up to the admin satisfaction revamp stack:

  1. Feature flag (feat: gate admin feedback behind feature flag #9683)
  2. Backend schema + validation (feat: extend admin feedback schema for 1-5 rating + triggers #9684)
  3. Zustand store + move modal to builder (feat: zustand store + move feedback modal to builder page #9688)
  4. Publish + workflow triggers (feat: add publish and workflow feedback triggers #9689)
  5. Star rating UI (feat: replace thumbs up/down with 5-star rating UI #9692)
  6. CSAT key + metric rename (this PR)

Breaking Changes

No. csat and rating are both optional; legacy rows keep their rating. The
wire contract is unchanged (still accepts rating). New rows return csat
instead of rating; the workspace UI only reads _id from the response, so
nothing breaks.

Tests

  • pnpm build passes
  • POST rating 3: DB record has csat: 3, no rating
  • formsg.users.feedback.csat fires on create (tag csat); transitional formsg.users.feedback.rating still fires
  • PATCH new rating: DB record has csat updated and ratingChanged: true
  • PATCH only comment: ratingChanged stays false
  • Admin-feedback unit + route specs pass (updated to assert csat)

Automated: service spec 13/13, feedback route spec 13/13, typecheck no new errors, lint clean.

🤖 Generated with Claude Code

bookwormsuf and others added 3 commits July 23, 2026 16:55
Own key for the new 1-5 CSAT measure; legacy `rating` relaxed to optional so old thumbs rows and new stars never share a field.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire keeps sending `rating`; controller maps it to the `csat` key. Renames the .rating.v2 metric to formsg.users.feedback.csat, keeping the transitional .rating emit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Assert new rows store csat (not rating) and that formsg.users.feedback.csat is emitted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bookwormsuf
bookwormsuf requested a review from a team as a code owner July 23, 2026 08:57
@mergify

mergify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

rating is now optional (new rows use csat), so drop the 'rating required' assertion and add csat 1-5 / reject 0 & 6 coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant