Repository navigation
automatically update title languages from book - #610
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #610 +/- ##
==========================================
- Coverage 81.92% 81.78% -0.15%
==========================================
Files 78 78
Lines 5323 5375 +52
Branches 657 668 +11
==========================================
+ Hits 4361 4396 +35
- Misses 762 778 +16
- Partials 200 201 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
benoit74
left a comment
There was a problem hiding this comment.
I realize now what itched me since quite some time: updating the title must be done only when book is moved to production. A book blocked in staging (and which might be deleted without ever going to production) should not update the title yet.
This is true for the language but also for all other metadata. This is also what will allow editor to validate book metadata on first addition of a book to a blank title.
In other word, we alter the title metadata only when book is automatically moved to production or manually promoted.
I propose to move this to a dedicated issue unless you feel like it could be solved in this same PR. I let you decide and act accordingly (update PR or open issue linked to this comment).
What about when it's the first book and title is already missing all mandatory metadata? Book won't ever be moved to production if it doesn't update the mandatory metadata |
First books should force a manual validation of all metadata. Not moving them to production directly is what we want in fact, this has been an oversight so far IMHO. |
Sorry but I'm a bit conflicted on the purpose of this PR. I thought it was supposed to reduce the number of books blocked in staging by ensuring language issue isn't the blocker. Looking at the second sentence, I don't see how book will be automatically moved to prod if it's blocked because of a language issue because the issues get computed before deciding on it's destination. So, essentially, this PR will not prevent books from being blocked in staging and will still require editor to manually let them through. Only benefit can come from if we want to show editor that we will update languages in the book actions . |
This is indeed the hard part of this PR. I promised I did not silenced it on purpose ^^ We do not want to immediately update the title until we know the book will move to production, but we need to ignore the language changes under some conditions to take the decision about book quality (staging or production) and to raise issues (we do not want to warn the user) and still update title with these changes once decision has been made to move the book to production (automated or manual promotion). For instance I feel like this means we should flag these not as "informational" issues. Is it clearer? Note that I might still miss some details. I also don't have a very strong idea about how we can implement this in a efficient way (avoiding code duplicates) so I'm open to suggestions, including the fact this is just too complex or that for simplicity we should have some code duplication (with proper tests, it is not that much of a concern, especially if some of the logic or at least constants are shared like you proposed so far). |
I have updated the code to include a predicate function that determines whether to include
i think you are talking about |
benoit74
left a comment
There was a problem hiding this comment.
Thank you, one minor change
Nope, I was referring to the fact that with this PR (actual) code, when the book is blocked in staging for other purposes and the user fetches promotion actions, then you do not show at all in promotion action that |
I have added a new action type |
5b388d6 to
8fd5af0
Compare
Rationale
This PR adds the logic to automatically update title languages from book in the logic to add book to title which is called when book is being processed or re-processed. Logic for automatic update of title language is described in #527 (comment)
Changes
MIN_LANGUAGES_FOR_TITLE_SYNCto set how many languages both book and title need to have for automatic update to runupdate_title_metadata_from_bookto title module due to cyclic importsThis closes #527