From 446d08e01a6d55e149ca5302746bb57df429edb0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 18:30:53 +0000 Subject: [PATCH] fix(web): treat default heading detection as non-custom in fix warnings Agent-Logs-Url: https://github.com/Community-Access/glow/sessions/5b30bcc5-af88-4dc7-a9b1-17658e1342da Co-authored-by: accesswatch <70671938+accesswatch@users.noreply.github.com> --- CHANGELOG.md | 4 ++++ .../customization_warning.py | 11 ++++++++--- web/tests/test_customization_warning.py | 17 +++++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbacab9..12565a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ Releases are tagged in the [GitHub repository](https://github.com/Community-Acce ## [Unreleased] +### Fixed + +- **Web Fix: default ACB runs no longer get mislabeled as custom due to heading detection.** `web/src/acb_large_print_web/customization_warning.py` now treats `detect_headings=True` with `heading_accuracy=balanced` as the default behavior and only flags heading detection when it is disabled or switched to a non-default accuracy mode. Added regression coverage in `web/tests/test_customization_warning.py` for both default behavior and disabled heading detection. + ## [7.6.0] - 2026-05-19 ### Added diff --git a/web/src/acb_large_print_web/customization_warning.py b/web/src/acb_large_print_web/customization_warning.py index 57e6a29..7588ac3 100644 --- a/web/src/acb_large_print_web/customization_warning.py +++ b/web/src/acb_large_print_web/customization_warning.py @@ -169,14 +169,19 @@ def detect_fix_customizations(form_data) -> tuple[bool, list[str]]: if _get_bool(form_data, "preserve_heading_alignment"): customizations.append("Heading alignment preservation enabled") - if _get_bool(form_data, "detect_headings"): + detect_headings = ( + _get_bool(form_data, "detect_headings") + if "detect_headings" in form_data + else True + ) + if not detect_headings: + customizations.append("Heading detection disabled") + else: heading_accuracy = form_data.get("heading_accuracy", "balanced") if heading_accuracy != "balanced": customizations.append( f"Heading detection enabled ({heading_accuracy} accuracy)" ) - else: - customizations.append("Heading detection enabled") # Check suppressed rules via the rule_policy if available suppressed_ids: list[str] = [] diff --git a/web/tests/test_customization_warning.py b/web/tests/test_customization_warning.py index c3b03b6..7542925 100644 --- a/web/tests/test_customization_warning.py +++ b/web/tests/test_customization_warning.py @@ -13,7 +13,8 @@ def test_detect_fix_customizations_ignores_default_fix_options(): "para_indent_in": 0.0, "first_line_indent_in": 0.0, "preserve_heading_alignment": False, - "detect_headings": False, + "detect_headings": True, + "heading_accuracy": "balanced", "suppress_link_text": False, "suppress_missing_alt_text": False, "suppress_faux_heading": False, @@ -36,6 +37,18 @@ def test_detect_fix_customizations_flags_non_default_list_indent(): assert reasons == ['Document formatting customizations: List indent changed to 0.5"'] +def test_detect_fix_customizations_flags_heading_detection_disabled(): + has_customizations, reasons = detect_fix_customizations( + { + "mode": "full", + "detect_headings": False, + } + ) + + assert has_customizations is True + assert reasons == ["Document formatting customizations: Heading detection disabled"] + + def test_generate_customization_warning_uses_plain_paragraphs_without_hard_wraps(): warning = generate_customization_warning( ['Document formatting customizations: List indent changed to 0.5"'] @@ -44,4 +57,4 @@ def test_generate_customization_warning_uses_plain_paragraphs_without_hard_wraps assert "