Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the survey-question-catalog datastore slice and REST API datapoint for the Reader Revenue Manager module, gated behind the rrmSurveyCTA feature flag. On the client side, it implements the Redux-style store slice with actions, resolvers, and selectors to fetch, cache, and reset survey questions for a connected publication, along with corresponding Jest tests. On the server side, it registers the GET:survey-question-catalog datapoint, implementing the Get_Survey_Question_Catalog class to request and parse question templates from the WebContentPublisher API, backed by PHPUnit integration tests. There are no review comments on this pull request, and I have no additional feedback to provide as the implementation is clean, well-tested, and adheres to the project's style guidelines.
ccb6ad5 to
582d952
Compare
Summary
Related issue(s):
GET:survey-question-catalogdatapoint andgetSurveyQuestionCatalog()selector #13736Relevant technical choices
The survey question catalog follows the shape that the CTAs ended up with in #14124, not the shape the IB describes. The IB was written against the first version of #13429, where the CTAs were held as one list and
resetCTAs()cleared it. After review, #14124 keyed the CTAs by publication ID and hadGET:ctasname the publication it answered for. The same races apply to the catalog. The server answers for the saved publication, and a save can land while a request is in flight. So the catalog uses the same approach.GET:survey-question-catalogtakes the publication ID it returns from the saved settings, asGet_CTAsdoes. It does not parse it from the catalog'sname, so the request and the response read the publication from one place.getSurveyQuestionCatalog()returnsundefinedwhile the selected publication differs from the saved one, asgetCTAs()does. The stored catalogs belong to the publication the server still answers for, not to one that is picked but not saved yet.parse_response()skips any question or answer that is not aQuestionTemplateor anAnswerChoiceTemplate, the same wayGet_CTAsskips anything that is not aCta.Deviations from IB
GET:survey-question-catalogreturnspublicationIDalongsidequestions. The IB hasparse_response()return the list of questions alone. The questions do not name their publication, and an empty catalog has nothing to name it. The publication ID in the response is what makes the key reliable. This matchesGET:ctas.resetSurveyQuestionCatalog()does not clear the stored catalog. The IB asks for an action, followingresetCTAs, that clears the list and the selector's stored error, and invalidates the resolution. In Use connected publication for RRM datapoints #14124,resetCTAs()no longer clears the list, because each publication's CTAs are stored under its own ID and cannot be mistaken for another's. The new action follows it: it clears the selector's stored error and invalidates thegetSurveyQuestionCatalogresolution.PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist