* 9575: Expand test coverage for some of firefox_details to check both three and two-digit major version numbers
* 9575: Minor test expansion for three-digit FF
* 9575: More small FF100 test expansions - iOS and Android
* 9575: More small FF100 test expansions - releasenotes models
* 9575: More small FF100 test expansions - releasenotes listing/index view
A clash between test auto-discovery (find something beginning with "Test") and
a dummy/utility class created for testing the relevant decorator was causing pytest
to raise warning.
Renaming the dummy classes worked - running `pytest bedrock/utils -vv` shows the relevant tests
are run, while the warnings are now gone
System requirement pages for Android releases exist from 46.0 and upward. This changeset makes sure that it the relevant check works for FF100 and above
* 11038: add a nine-minute timeout to cron tasks, to avoid a long-running blockage
This was suggested by @duallain following a minor problem where a scheduled sync
task stalled/failed during an infrastructure outage and just hung. Adding a
timeout should avoid this happening again.
Nine minutes is a gut-feel for a reasonable time, allowing for long-running syncs
* 11038: Reduce timeout + make timeout easier to grok
* Attempt to catch all exceptions from check_call, log them to sentry and then re-raise
* 11038: Allow SENTRY_DSN to be absent without a hard fail
* BUGFIX: always pop the preview_image key from the SEO object, so that a missing preview image doesn't break the sync
* 10867: Remove unique constraint on ContentfulEntry.contentful_id and make hybrid with locale field
This is required because translations of Entries in Contentful share the same ID but vary on locale, making the uniqueness check a combination of contentful_id and locale
* 10867: Move hard-coded IDs for Contentful Homepage lookup into settings, because we'll need them as part of some homepage-specific logic when syncing multuple locales very soon
* 10810: Log to Sentry if we end up using the static fallback homepages instead of data from Contentful
* 10867: Looking forward, support getting individual pages by ID and locale, not just ID.
This is backwards-compatible with the way that the EN and DE Homepages are pulled from the DB only via ID.
When we add in the multi-locale sync in an upcoming commit, we'll deliberately ONLY sync the homepages for en-US, because they don't really have a formal locale field set up, and we WON'T sync them for any other locale
* 10867: Add support for syncing multiple locales from Contentful
This changeset updates how we pull from Contentful to ensure we query for a
version of every page in every locale that's enabled in Contentful. It's not
the most efficient - there are quite a lost of wasted queries and we're not
getting a bunch of Entries at once, just iterating through N page * M locales,
but it's workable for now.
There are also a number of workarounds in the code:
1) When syncing the homepages (connectHomepage Entries) we know we can't
trust the locale field we're currently extracting for them, so we only
sync them for en-US. This will go away when we move the homepages to Compose.
2) When syncing a Compose `page` in any locale other than en-US, we get back
an Entry, but when we try to read its content, things blow up because there is
no child Entry linked to it. Because of this, we have to check for a specific
AttributeError message, and skip that page, but it does still cost us a network
call.
* 10867: Drop patching/truncation of es locales when going from Bedrock to Contentful because Contentful now has the variations of the locale
* 10867: Update tests for locale-supporting Contentful sync. More to come
* 10867: Reduce the noise during the sync
* 10867: Fix broken locale map from Bedrock to Contentful
🤦
* 10867: Constants cleanup while in the neighbourhood
* 10867: Update deletion logic so that removing an individual locale in Contentful works
The locale-specific version of the page is removed from the DB, but any others persist.
Before this change, the deleted locale persisted, which was not ideal even though the
use-case of removing just one locale from a published page is small
* Update comment to highlight risk of cacheing mutable data structures
* Rename test module for Contentful management commands
* 11022: Add helpers for deciding when we have enough Contentful content in a particular locale to 'activate' it.
Broadly similar to how we use Fluent files, we have a configurable threshold
percentage which we use to decide whether we have enough ContentfulEntry
records of the given classification and content_type in the target locale,
compared to the default locale, to say 'yes we have enough records to consider
this locale as active.
Use cases are building a list of active locales to use in the footer <select>
and also deciding if a listing page (eg the VRC page) is worth rendering in
a particular locale, or redirecting to the default locale]
* 11022: Refactor Contentful active_locales helper to hit the DB less
* Drop unnecessary cache-timeout config
* 10867: Fix typo in short locale code version of ja-JP
* 11022: [Almost] Guarantee that all locales will show content in DEV mode
This will overrire any threshold setting for locales for Contentful-sourced content
* 11022: Extend Contentful-specific active_locales helper with optional scoping for all content with a particular (shared) slug
* 11022: Update VRC listing and article views to support multiple locales
* If requested locale isn't available for a specific article, try defaulting to en-US for the same slug, else 404
* Show the locale selector on listing and article pages, showing only those locales that are 'active', as defined by the helper util from an earlier commit
* Backfill tests for ContentfulEntry model - now at 100%
* Test coverage papercuts for Contentful management command
* Add pytest-mock to dev deps
* Contentful sync: split up main method to be a bit smaller + add another coverage increment
* Test regression fixups after rebasing
* Update comment on Bedrock<->Contentful locale map to help avoid misunderstanding
* VRC listing view: use l10n_utils.render to automatically select an appropriate locale if selected one is inviable
Returning early with the call to render() is better than a forced redirect to a DEFAULT_LOCALE, because it will
try to get the most appropriate default locale it can, rather than assuming en-US.
* Rename helper function used to transform Contentful locale names to Bedrock locale names
* VRC article view: use l10n_utils.render to automatically select an appropriate locale
...if the selected one is inviable
* Trim comments
* Optimise get_active_locales: return early when we've got a slug in the kwargs
When finding locales by slug + content_type + classification, every result returned
is active 'enough' because we only need one match for that triplet of params for it
to count as 'enough'. As such, we can return early and avoid crunching data unnecessarily
* Expand tests to cover both unavailable and invalid locales
* Refactor the redirection logic from l10n_utils.render() into a reusable function
Tested manually with DEV=False to be able to replicate locale redirection for /ff/ as a locale
* Refactor VRC to use redirect_to_best_locale helper - much cleaner now
* Tidy up the dev-level override for the Contentful locale activation threshold