You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: capture guidance_markdown + feedback_subject_id on backoffice reviews (#2798)
## Summary
Extends the Backoffice **review-capture** endpoint for the Learning
Agent feedback loop (SITES-43974) to persist two new fields, and
consumes the companion `@adobe/spacecat-shared-data-access` release so
they round-trip on read.
- `guidanceMarkdown` — AI-generated issue context (title + description).
Validated as a string, 64 KB cap (413 on overflow), secret-scrubbed +
HTML-sanitised via `redactFeedbackContent`, stored as
`guidance_markdown`.
- `feedbackSubjectId` — SpaceCat-internal per-issue grouping key (e.g. a
CWV issue id). Validated as a string ≤ 200 chars, stored as
`feedback_subject_id`. Lets the Backoffice group per-issue "previous
feedback" when issues share one `suggestionId`.
⚠️ Deploy order: depends on mysticat-data-service #790 (the
`feedback_event` columns) being migrated first.
## Changes
- `src/controllers/suggestions.js` (`createBackofficeReview`): accept +
validate + scrub + store `guidanceMarkdown` and `feedbackSubjectId` on
the inserted row.
- `src/support/feedback-redaction.js`: secret-scrub `guidanceMarkdown`
alongside the other content fields (defence-in-depth — guidance can
quote customer HTML/config even though it's AI-generated).
- OpenAPI: request body (`site-opportunities.yaml`) documents both
fields; `SuggestionReview` response (`schemas.yaml`) adds
`feedbackSubjectId` + `guidanceMarkdown`, typed as a `[string, 'null']`
union (OAS 3.1) so the schema matches the runtime (null for
whole-suggestion reviews / absent guidance).
- `package.json` / lockfile: bump `@adobe/spacecat-shared-data-access`
to the released version so `toReviewView` returns the new fields on
`?include=reviews` (and repin off the gist tarball to the published
registry version).
- Tests: capture happy-paths + validation (400 non-string, 413 oversize)
for both fields; redaction test for `guidanceMarkdown`; read-response
test asserting `?include=reviews` returns `feedbackSubjectId` and
`?include=reviews,patches` returns `guidanceMarkdown`.
## Testing
Controller + redaction unit tests pass; `npm run docs:lint` valid; lint
clean. Full suite runs in CI.
Please ensure your pull request adheres to the following guidelines:
- [X] make sure to link the related issues in this description. Or if
there's no issue created, make sure you describe here the problem you're
solving.
- [X] when merging / squashing, make sure the fixed issue references are
visible in the commits, for easy compilation of release notes
If the PR is changing the API specification:
- [X] make sure you add a "Not implemented yet" note the endpoint
description, if the implementation is not ready yet. Ideally, return a
501 status code with a message explaining the feature is not implemented
yet.
- [X] make sure you add at least one example of the request and
response.
If the PR is changing the API implementation or an entity exposed
through the API:
- [X] make sure you update the API specification and the examples to
reflect the changes.
If the PR is introducing a new audit type:
- [X] make sure you update the API specification with the type, schema
of the audit result and an example
## Related Issues
Jira: https://jira.corp.adobe.com/browse/SITES-43974
Thanks for contributing!
0 commit comments