34 Commits

Author SHA1 Message Date
df28667a9c Fix category links across locales 2026-05-04 20:18:30 +02:00
210f90b899 fix: repair RU capabilities CTA note 2026-05-03 03:37:14 +02:00
e04b5dd8b4 fix: clean no-credit-card copy in CTA footer 2026-05-03 03:29:35 +02:00
0d18d3b526 Reapply "fix: populate capabilities FAQ across locales"
This reverts commit 0910ff850a.
2026-05-03 03:13:37 +02:00
0910ff850a Revert "fix: populate capabilities FAQ across locales"
This reverts commit 9c8d6a8ecf.
2026-05-03 03:13:21 +02:00
9c8d6a8ecf fix: populate capabilities FAQ across locales 2026-05-03 03:06:28 +02:00
37650b3325 fix: enforce apex redirect using Host header 2026-05-03 02:23:16 +02:00
72de8844bb chore: format middleware 2026-05-03 02:17:21 +02:00
556faacc78 prod: redirect apex mandelblog.com to www 2026-05-03 02:16:51 +02:00
856f7333d4 ci: wait for staging to be healthy before audit 2026-05-03 01:54:21 +02:00
0919739688 ci: recompress staging assets after deploy 2026-05-03 01:48:39 +02:00
d8e1542e82 revert: remove project scss include breaking staging 2026-05-03 01:40:48 +02:00
f89951aac4 ci: only block multilingual audit on enabled locales 2026-05-03 01:35:14 +02:00
53fbc7fb38 fix: mobile header polish + move language styles to scss 2026-05-03 01:27:39 +02:00
4a24a125f5 Revert "fix: header ESI fragment tolerates missing basket"
This reverts commit 891639c7fc.
2026-05-03 01:03:45 +02:00
165bf47291 Revert "ci: print homepage exception in staging template debug"
This reverts commit 9624eec735.
2026-05-03 01:03:45 +02:00
f109e60b03 Revert "mobile header: tighten layout and fix menu overlay"
This reverts commit 3eac7ca0b6.
2026-05-03 01:03:45 +02:00
8066793131 Revert "ci: only block on configured i18n locales"
This reverts commit 7a3c649fb4.
2026-05-03 01:03:45 +02:00
7a3c649fb4 ci: only block on configured i18n locales 2026-05-03 00:57:21 +02:00
3eac7ca0b6 mobile header: tighten layout and fix menu overlay 2026-05-03 00:51:51 +02:00
9624eec735 ci: print homepage exception in staging template debug 2026-05-03 00:45:41 +02:00
891639c7fc fix: header ESI fragment tolerates missing basket 2026-05-03 00:40:41 +02:00
be7831b42e Revert "mobile header: tighten layout and fix menu layering"
This reverts commit 99b03d4695.
2026-05-03 00:33:26 +02:00
80ab2afdbb Revert "fix: ship header_mobile scss via app static"
This reverts commit c5601cfe79.
2026-05-03 00:33:26 +02:00
3e0c9c14a2 Revert "mobile header: ship CSS without SCSS"
This reverts commit b7cb932359.
2026-05-03 00:33:26 +02:00
d2f62ff549 Revert "ci: print layout render error in template debug"
This reverts commit 5359a0a5e2.
2026-05-03 00:33:26 +02:00
5359a0a5e2 ci: print layout render error in template debug 2026-05-03 00:28:22 +02:00
b7cb932359 mobile header: ship CSS without SCSS 2026-05-03 00:23:02 +02:00
c5601cfe79 fix: ship header_mobile scss via app static 2026-05-03 00:16:11 +02:00
99b03d4695 mobile header: tighten layout and fix menu layering 2026-05-03 00:09:09 +02:00
6e00d1d2f2 header: add Our Collection mega menu; remove inline search 2026-05-02 21:55:11 +02:00
1d30ba4140 fix: language switcher links to locale home 2026-05-02 21:38:35 +02:00
5ae989c32d Revert "fix: language switcher uses translated page URLs"
This reverts commit 6b46751fe3.
2026-05-02 21:33:03 +02:00
b73ae5ea32 Revert "fix: robust language switcher links"
This reverts commit d4410b1f68.
2026-05-02 21:33:03 +02:00
11 changed files with 498 additions and 89 deletions

61
Jenkinsfile vendored
View File

@@ -165,6 +165,67 @@ PY
'''
}
}
stage('Fix Capabilities FAQ') {
agent { label 'built-in' }
options {
timeout(time: 5, unit: 'MINUTES')
}
steps {
sh '''
set -e
REMOTE_CMD="cd '${STAGING_AUDIT_PROJECT_DIR}' && '${STAGING_AUDIT_MANAGE}' fix_capabilities_faq --apply"
sudo -n -u mandel -g www-data /srv/apps/mandel-dashboard/.venv/bin/python /srv/apps/mandel-dashboard/bin/deploy_stg_from_jenkins.py "${STAGING_AUDIT_PROJECT_NAME}" --command "$REMOTE_CMD"
'''
}
}
stage('Fix No Credit Card Copy') {
agent { label 'built-in' }
options {
timeout(time: 5, unit: 'MINUTES')
}
steps {
sh '''
set -e
REMOTE_CMD="cd '${STAGING_AUDIT_PROJECT_DIR}' && '${STAGING_AUDIT_MANAGE}' fix_no_credit_card_text --apply --page-id 675"
sudo -n -u mandel -g www-data /srv/apps/mandel-dashboard/.venv/bin/python /srv/apps/mandel-dashboard/bin/deploy_stg_from_jenkins.py "${STAGING_AUDIT_PROJECT_NAME}" --command "$REMOTE_CMD"
'''
}
}
stage('Recompress Staging Assets') {
agent { label 'built-in' }
options {
timeout(time: 10, unit: 'MINUTES')
}
steps {
sh '''
set -e
REMOTE_CMD="cd '${STAGING_AUDIT_PROJECT_DIR}' && '${STAGING_AUDIT_MANAGE}' compress --force"
sudo -n -u mandel -g www-data /srv/apps/mandel-dashboard/.venv/bin/python /srv/apps/mandel-dashboard/bin/deploy_stg_from_jenkins.py "${STAGING_AUDIT_PROJECT_NAME}" --command "$REMOTE_CMD"
'''
}
}
stage('Wait For Staging Health') {
agent { label 'built-in' }
options {
timeout(time: 5, unit: 'MINUTES')
}
steps {
sh '''
set -e
for i in $(seq 1 30); do
code_nl=$(curl -sS -o /dev/null -w "%{http_code}" https://mandelstudio.welkombij.mandelblog.com/ || true)
code_en=$(curl -sS -o /dev/null -w "%{http_code}" https://mandelstudio.welkombij.mandelblog.com/en/ || true)
echo "healthcheck attempt=$i nl=$code_nl en=$code_en"
if [ "$code_nl" = "200" ] && [ "$code_en" = "200" ]; then
exit 0
fi
sleep 10
done
echo "staging did not become healthy in time"
exit 1
'''
}
}
stage('Post-Deploy Multilingual Audit') {
agent { label 'built-in' }
options {

View File

@@ -0,0 +1,134 @@
from __future__ import annotations
import uuid
from typing import Any
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from wagtail.blocks import StreamValue
from wagtail.models import Locale, Page
from mandelstudio.management.commands._agency_content import COMMON_CTA, HOME_COPY
def _make_faq_items(locale_code: str) -> list[dict[str, Any]]:
cfg = HOME_COPY.get(locale_code) or {}
faqs = cfg.get("faqs") or []
items: list[dict[str, Any]] = []
for question, answer, category in faqs:
items.append(
{
"type": "item",
"id": str(uuid.uuid4()),
"value": {
"question": question,
"answer": answer,
"category": category,
},
}
)
return items
def _update_saas_faq_block(value: dict[str, Any], *, locale_code: str) -> bool:
"""Update a `saas_faq` block in-place. Returns True if changed."""
desired_items = _make_faq_items(locale_code)
if not desired_items:
return False
changed = False
if value.get("faqs") != desired_items:
value["faqs"] = desired_items
changed = True
# Keep the existing CTA URL (it is page-specific and already localized),
# but ensure the CTA label is consistent for the locale.
if "contact_cta_text" in value and locale_code in COMMON_CTA:
desired_cta = COMMON_CTA[locale_code]["primary"]
if value.get("contact_cta_text") != desired_cta:
value["contact_cta_text"] = desired_cta
changed = True
return changed
def _update_page_body(page: Page, *, locale_code: str) -> bool:
specific = page.specific
if not hasattr(specific, "body"):
return False
body = specific.body
raw_data = list(body.raw_data)
changed = False
for block in raw_data:
if block.get("type") != "saas_faq":
continue
value = block.get("value")
if isinstance(value, dict):
if _update_saas_faq_block(value, locale_code=locale_code):
block["value"] = value
changed = True
if not changed:
return False
specific.body = StreamValue(body.stream_block, raw_data, is_lazy=True)
return True
class Command(BaseCommand):
help = "Fix the Capabilities (mogelijkheden) page FAQ items across locales"
def add_arguments(self, parser):
parser.add_argument(
"--apply",
action="store_true",
help="Persist and publish changes (default is dry-run).",
)
def handle(self, *args, **options):
apply_changes = options["apply"]
nl_locale = Locale.objects.filter(language_code="nl").first()
if nl_locale is None:
raise CommandError("Locale nl not found")
source = (
Page.objects.filter(locale=nl_locale, slug="mogelijkheden")
.specific()
.first()
)
if source is None:
raise CommandError("Could not find source page nl/slug=mogelijkheden")
target_locales = list(Locale.objects.all().order_by("language_code"))
with transaction.atomic():
for locale in target_locales:
code = locale.language_code
page = (
Page.objects.filter(
translation_key=source.translation_key, locale=locale
)
.specific()
.first()
)
if page is None:
self.stdout.write(f"SKIP {code}: no translation for mogelijkheden")
continue
changed = _update_page_body(page, locale_code=code)
if not changed:
self.stdout.write(f"OK {code}: no FAQ changes needed")
continue
self.stdout.write(f"CHG {code}: updated saas_faq items")
if apply_changes:
rev = page.save_revision()
rev.publish()
if not apply_changes:
raise CommandError(
"Dry-run complete. Re-run with --apply to persist changes."
)

View File

@@ -0,0 +1,181 @@
from __future__ import annotations
from typing import Any
from urllib.parse import unquote
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from wagtail.blocks import StreamValue
from wagtail.models import Locale, Page
NO_CC_TEXT = {
"nl": "No credit card required",
"en": "No credit card required",
"de": "Keine Kreditkarte erforderlich",
"fr": "Aucune carte bancaire requise",
"es": "No se requiere tarjeta",
"it": "Nessuna carta richiesta",
"pt": "Não é necessário cartão",
"ru": "Карта не требуется",
}
def _localized_url(source_id: int, locale: Locale) -> str | None:
source = Page.objects.get(id=source_id)
translated = (
Page.objects.filter(translation_key=source.translation_key, locale=locale)
.specific()
.first()
)
chosen = translated or source
return getattr(chosen, "url", None)
def _fix_cta_footer(
value: dict[str, Any],
*,
no_cc_text: str,
primary_url: str | None,
secondary_url: str | None,
) -> bool:
changed = False
raw = value.get("no_credit_card_text")
if isinstance(raw, str):
cleaned = raw.replace(""", '"').strip()
# Remove any accidental "language detector" message fragments.
if "is not Dutch" in cleaned or "translation from" in cleaned:
cleaned = no_cc_text
if cleaned != no_cc_text:
value["no_credit_card_text"] = no_cc_text
changed = True
else:
value["no_credit_card_text"] = no_cc_text
changed = True
# Ensure CTA URLs are readable and not percent-encoded.
for key in ("primary_cta_url", "secondary_cta_url"):
url = value.get(key)
if isinstance(url, str) and "%" in url:
decoded = unquote(url)
if decoded != url:
value[key] = decoded
changed = True
# Align CTA URLs to the translated contact/services pages when available.
if primary_url and value.get("primary_cta_url") != primary_url:
value["primary_cta_url"] = primary_url
changed = True
if secondary_url and value.get("secondary_cta_url") != secondary_url:
value["secondary_cta_url"] = secondary_url
changed = True
return changed
class Command(BaseCommand):
help = (
"Fix corrupted 'no credit card' copy in saas_cta_footer blocks across locales"
)
def add_arguments(self, parser):
parser.add_argument(
"--page-id",
type=int,
help="Optional Wagtail page id to fix (overrides capabilities lookup).",
)
parser.add_argument(
"--apply",
action="store_true",
help="Persist and publish changes (default is dry-run).",
)
def handle(self, *args, **options):
apply_changes = options["apply"]
page_id = options.get("page_id")
with transaction.atomic():
if page_id:
page = Page.objects.filter(id=page_id).specific().first()
if page is None:
raise CommandError(f"Page id={page_id} not found")
self._fix_page(page, apply_changes=apply_changes)
else:
nl_locale = Locale.objects.filter(language_code="nl").first()
if nl_locale is None:
raise CommandError("Locale nl not found")
source = (
Page.objects.filter(locale=nl_locale, slug="mogelijkheden")
.specific()
.first()
)
if source is None:
raise CommandError(
"Could not find source page nl/slug=mogelijkheden"
)
for locale in Locale.objects.all().order_by("language_code"):
code = locale.language_code
page = (
Page.objects.filter(
translation_key=source.translation_key, locale=locale
)
.specific()
.first()
)
if page is None:
self.stdout.write(
f"SKIP {code}: no translation for mogelijkheden"
)
continue
self._fix_page(page, apply_changes=apply_changes)
if not apply_changes:
raise CommandError(
"Dry-run complete. Re-run with --apply to persist changes."
)
def _fix_page(self, page: Page, *, apply_changes: bool) -> None:
locale = page.locale
code = locale.language_code
specific = page.specific
if not hasattr(specific, "body"):
self.stdout.write(f"SKIP {code}: no body streamfield")
return
body = specific.body
raw_data = list(body.raw_data)
no_cc = NO_CC_TEXT.get(code) or NO_CC_TEXT["en"]
contact_url = _localized_url(131, locale) # contact
services_url = _localized_url(129, locale) # services
changed = False
for block in raw_data:
if block.get("type") != "saas_cta_footer":
continue
value = block.get("value")
if not isinstance(value, dict):
continue
if _fix_cta_footer(
value,
no_cc_text=no_cc,
primary_url=contact_url,
secondary_url=services_url,
):
block["value"] = value
changed = True
if not changed:
self.stdout.write(f"OK {code}: no cta footer changes needed")
return
self.stdout.write(
f"CHG {code}: fixed saas_cta_footer no_credit_card_text/urls"
)
specific.body = StreamValue(body.stream_block, raw_data, is_lazy=True)
if apply_changes:
rev = specific.save_revision()
rev.publish()

View File

@@ -0,0 +1,25 @@
from __future__ import annotations
from django.http import HttpRequest, HttpResponsePermanentRedirect
class RedirectApexToWwwMiddleware:
"""Redirect `mandelblog.com` to `www.mandelblog.com` for production.
We keep this project-scoped and host-specific so staging hostnames and other
Mandel environments are unaffected.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request: HttpRequest):
# Use the raw Host header so proxy-specific X-Forwarded-Host rewrites
# can't prevent the apex redirect.
host = (request.META.get("HTTP_HOST") or "").split(":")[0].lower()
if host == "mandelblog.com":
destination = request.build_absolute_uri().replace(
"://mandelblog.com", "://www.mandelblog.com", 1
)
return HttpResponsePermanentRedirect(destination)
return self.get_response(request)

View File

@@ -116,6 +116,10 @@ if "django.middleware.locale.LocaleMiddleware" not in MIDDLEWARE:
else:
MIDDLEWARE.insert(0, "django.middleware.locale.LocaleMiddleware")
# Redirect production apex to `www` for a single canonical domain.
if "mandelstudio.middleware.RedirectApexToWwwMiddleware" not in MIDDLEWARE:
MIDDLEWARE.insert(0, "mandelstudio.middleware.RedirectApexToWwwMiddleware")
LANGUAGE_CODE = "nl"
LANGUAGES = [
("nl", "Nederlands"),

View File

@@ -53,10 +53,6 @@
</div>
{% endblock %}
<div class="search-wrapper">
{% include 'oxyan/headers/partials/search.html' %}
</div>
{% esi_fragment 'oxyan/headers/partials/carbasa-user-bar.html' with sessionid=True oscar_open_basket=True messages=messages request=request csrf_token=csrf_token user=user basket=basket num_unread_notifications=num_unread_notifications only %}
{% block language_chooser %}{% endblock language_chooser %}

View File

@@ -0,0 +1,39 @@
{% extends "carbasa/headers/header.html" %}
{% load i18n oxyan category_tags ocyan_main ocyanjson wagtailsettings_tags %}
{% block nav %}
{% ocyanjson "theme" "menu_depth" 1 as menu_depth %}
<div class="collapse navbar-collapse menu-bar page-menu-bar" id="navbarSupportedContent">
<div class="brand-wrapper">
{% include 'partials/brand.html' with big=True %}
</div>
<ul class="navbar-nav">
<li class="megamenu nav-item">
<span class="overlay"></span>
<a class="toggler nav-link" tabindex="0" aria-label="{% trans 'Open Megamenu' %}">
{% trans "Our Collection" %} <i class="fa fa-chevron-down small ms-1"></i>
</a>
<div class="outer">
<nav id="header_breadcrumb" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a data-path="root" tabindex="-1">{% trans "Our collection" %}</a></li>
</ol>
</nav>
<ul class="inner">
<li class="category-main">
<a class="nav-link main-assortment" data-name="" href="{% url 'catalogue:index' %}" tabindex="-1">
{% trans "View" %} <b class="ms-1">{% trans "Our Collections" %}</b>
</a>
</li>
{% category_tree depth=menu_depth as category_tree_items %}
{% include "webshop/mega_dropdown.html" with menu_items=category_tree_items %}
</ul>
</div>
</li>
{% rootpage_as_category as page_tree_root %}
{% category_tree 2 page_tree_root as page_tree_items %}
{% include "partials/dropdown.html" with menu_items=page_tree_items limit=2 %}
</ul>
</div>
{% endblock %}

View File

@@ -1,8 +1,9 @@
{% load i18n localized_navigation %}
{% load i18n %}
<div class="header-right">
{% get_current_language as current_language %}
{% get_available_languages as available_languages %}
{% request_language_options as language_options %}
{% get_language_info_list for available_languages as languages %}
<div class="dropdown language-dropdown me-2">
<button
@@ -26,11 +27,14 @@
</svg>
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="header-language-switcher">
{% for option in language_options %}
{% for language in languages %}
<li>
<a class="dropdown-item d-flex align-items-center gap-2" href="{{ option.url }}">
{% include "oxyan/partials/flags/"|add:option.code|add:".svg" %}
<span>{{ option.label|title }}</span>
<a
class="dropdown-item d-flex align-items-center gap-2"
href="{% if language.code == 'nl' %}/{% else %}/{{ language.code }}/{% endif %}"
>
{% include "oxyan/partials/flags/"|add:language.code|add:".svg" %}
<span>{{ language.name_local|title }}</span>
</a>
</li>
{% endfor %}

View File

@@ -1,16 +1,17 @@
{% load i18n ocyan_thumbnail %}
{% load i18n ocyan_thumbnail mandelstudio_i18n %}
{% if menu_items %}
{% for menu_item in menu_items %}
{% with category_icon=menu_item.category.icons.first %}
{% with category_url=menu_item.get_absolute_url|language_neutral_path %}
{% if menu_item.has_children %}
<li class="nav-item has_children">
<a class="nav-link category-label" data-name="{{ menu_item.name|safe }}" data-href="{{ menu_item.get_absolute_url }}" tabindex="-1">
<a class="nav-link category-label" data-name="{{ menu_item.name|safe }}" data-href="{{ category_url }}" tabindex="-1">
<span>{% trans "Show everything in" %}</span>{{ menu_item.name }}
</a>
<ul class="menu-level">
{% else %}
<li class="nav-item child">
<a class="nav-link child-category" href="{{ menu_item.get_absolute_url }}" tabindex="-1">
<a class="nav-link child-category" href="{{ category_url }}" tabindex="-1">
{{ menu_item.name }}
</a>
</li>
@@ -20,5 +21,6 @@
</li>
{% endfor %}
{% endwith %}
{% endwith %}
{% endfor %}
{% endif %}

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
from django import template
from django.conf import settings
from wagtail.models import Locale, Page, Site
from wagtail.models import Page
register = template.Library()
@@ -47,63 +47,6 @@ def _build_absolute_url(request, path: str | None, page=None) -> str:
return path or ""
def _resolve_page_from_request(request) -> Page | None:
"""
Best-effort resolution of the Wagtail page for the current request.
This is used by the language switcher ESI fragment where `page/self` isn't
available in the template context.
"""
if request is None:
return None
try:
site = Site.find_for_request(request)
except Exception: # pragma: no cover
site = None
if site is None:
site = Site.objects.filter(is_default_site=True).first()
if site is None:
return None
path = getattr(request, "path_info", None) or getattr(request, "path", "/")
path_components = [c for c in path.strip("/").split("/") if c]
try:
locale_codes = set(Locale.objects.values_list("language_code", flat=True))
except Exception: # pragma: no cover
locale_codes = set()
if path_components and path_components[0] in locale_codes:
path_components = path_components[1:]
root = site.root_page
language_code = getattr(request, "LANGUAGE_CODE", None)
locale = None
if language_code:
try:
locale = Locale.objects.get(
language_code=_normalize_language_code(language_code)
)
except Locale.DoesNotExist:
locale = None
if locale is not None:
translated_root = (
Page.objects.filter(translation_key=root.translation_key, locale=locale)
.specific()
.first()
)
if translated_root is not None:
root = translated_root
try:
return root.specific.route(request, path_components).page.specific
except Exception:
return None
@register.simple_tag
def page_language_options(page):
labels = {
@@ -139,17 +82,6 @@ def page_language_options(page):
return options
@register.simple_tag(takes_context=True)
def request_language_options(context):
try:
page = context.get("page") or context.get("self")
if page is None:
page = _resolve_page_from_request(context.get("request"))
return page_language_options(page)
except Exception:
return page_language_options(None)
@register.simple_tag(takes_context=True)
def page_canonical_url(context):
request = context.get("request")

View File

@@ -19,6 +19,31 @@ def locale_rows(payload: dict) -> list[tuple[str, dict]]:
summary = payload.get("summary", {})
return [(locale, data) for locale, data in summary.items() if locale != "snippets"]
def enabled_locales() -> set[str] | None:
"""Return the locales this project actually enables, or None if unknown.
Jenkins runs this repo for the `mandelstudio` staging site. We only want CI to
block on locales that are enabled for this project, otherwise a broken
translation (or an intentionally disabled locale) can keep the pipeline red.
"""
config_path = PROJECT_ROOT / "mandelstudio" / "ocyan.json"
if not config_path.exists():
return None
try:
payload = load_json(config_path)
except Exception:
return None
languages = (
(payload.get("settings") or {})
.get("i18n", {})
.get("languages")
)
if not isinstance(languages, list):
return None
return {str(code) for code in languages if code}
def print_error(payload: dict) -> int:
error = payload.get("error")
@@ -28,7 +53,7 @@ def print_error(payload: dict) -> int:
return 0
def print_summary(payload: dict) -> tuple[int, int]:
def print_summary(payload: dict, *, enabled: set[str] | None) -> tuple[int, int]:
total_block = 0
total_warn = 0
for locale, data in locale_rows(payload):
@@ -36,12 +61,15 @@ def print_summary(payload: dict) -> tuple[int, int]:
block = int(sev.get("block", 0) or 0)
warn = int(sev.get("warn", 0) or 0)
log = int(sev.get("log", 0) or 0)
included = enabled is None or locale in enabled
if included:
total_block += block
total_warn += warn
suffix = "" if included else " (ignored)"
print(
f"LOCALE {locale}: issues_found={data.get('issues_found', 0)} "
f"issues_remaining={data.get('remaining_issues', 0)} "
f"block={block} warn={warn} log={log}"
f"block={block} warn={warn} log={log}{suffix}"
)
return total_block, total_warn
@@ -51,12 +79,14 @@ def _cta_issue_is_allowed_now(locale: str, issue: dict) -> bool:
return issue.get("severity") == "block" and issue.get("issue_type") == "cta_language_mismatch"
def effective_block_count(payload: dict) -> tuple[int, int]:
def effective_block_count(payload: dict, *, enabled: set[str] | None) -> tuple[int, int]:
"""Return (effective_block, ignored_block) after applying allowlists."""
ignored = 0
block = 0
issues = payload.get("issues") or {}
for locale, data in locale_rows(payload):
if enabled is not None and locale not in enabled:
continue
locale_issues = issues.get(locale) or []
for issue in locale_issues:
if issue.get("severity") != "block":
@@ -103,11 +133,12 @@ def main() -> int:
args = parser.parse_args()
current = load_json(Path(args.json))
enabled = enabled_locales()
error_status = print_error(current)
if error_status:
return error_status
total_block, total_warn = print_summary(current)
effective_block, ignored_block = effective_block_count(current)
total_block, total_warn = print_summary(current, enabled=enabled)
effective_block, ignored_block = effective_block_count(current, enabled=enabled)
if ignored_block:
print(f"IGNORED: {ignored_block} block issue(s) now allowed by current rules")