This is an automated email from the ASF dual-hosted git repository.
shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new f68fd1f1db4 Stop the wiki check reporting well-formed AIP pages
(#77111)
f68fd1f1db4 is described below
commit f68fd1f1db43b8071a4585d7e0b96e5a22735f0d
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Nov 15 18:15:14 2026 +0100
Stop the wiki check reporting well-formed AIP pages (#77111)
The Confluence editor writes macro attributes in no fixed order, and the
check only found Page Properties and status macros whose name came
first, so pages with a correct block were reported as having none. It
also compared State badges case-sensitively, though Confluence shows
every badge in capitals and readers cannot tell the difference.
Generated-by: Claude Opus 5
Claude-Session: https://claude.ai/code/session_01NyQq9U7i5HhjDgrQ9qd3gq
---
scripts/ci/verify_improvement_proposals_wiki.py | 13 +++++---
.../ci/test_verify_improvement_proposals_wiki.py | 35 ++++++++++++++++++++++
2 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/scripts/ci/verify_improvement_proposals_wiki.py
b/scripts/ci/verify_improvement_proposals_wiki.py
index b4bab3eb479..b826feac1b5 100644
--- a/scripts/ci/verify_improvement_proposals_wiki.py
+++ b/scripts/ci/verify_improvement_proposals_wiki.py
@@ -246,9 +246,13 @@ def find_macro_body_start(body: str, start: int) -> int |
None:
def find_properties(body: str) -> list[dict[str, str]]:
- """Return the rows of each Page Properties block as {key: value storage
HTML}."""
+ """
+ Return the rows of each Page Properties block as {key: value storage HTML}.
+
+ The editor writes the macro's attributes in no fixed order,
``ac:macro-id`` often first.
+ """
blocks = []
- for match in re.finditer(r'<ac:structured-macro ac:name="details"', body):
+ for match in
re.finditer(r'<ac:structured-macro\b[^>]*?\sac:name="details"', body):
# Only a table inside the macro's own rich-text body is read by the
index report; a
# self-closing macro, or one with no body, has no properties.
body_start = find_macro_body_start(body, match.end())
@@ -301,7 +305,7 @@ def find_table_rows(html: str) -> list[list[str]]:
def find_badge(cell: str) -> str | None:
match = re.search(
- r'<ac:structured-macro ac:name="status".*?<ac:parameter
ac:name="title">([^<]*)</ac:parameter>',
+ r'<ac:structured-macro\b[^>]*?\sac:name="status".*?<ac:parameter
ac:name="title">([^<]*)</ac:parameter>',
cell,
re.S,
)
@@ -316,7 +320,8 @@ def check_properties(page: Page, allowed_badges: set[str])
-> tuple[list[str], d
if "State" not in properties:
return ["has no State row in its Page Properties block"], properties
badge = find_badge(properties["State"])
- if badge not in allowed_badges:
+ # Confluence shows every status badge in capitals, so case is not
something readers see.
+ if badge is None or badge.casefold() not in {allowed.casefold() for
allowed in allowed_badges}:
return [f"State badge is {badge!r}, expected one of
{sorted(allowed_badges)}"], properties
return [], properties
diff --git a/scripts/tests/ci/test_verify_improvement_proposals_wiki.py
b/scripts/tests/ci/test_verify_improvement_proposals_wiki.py
index 525ae75eea1..0ea0c1740a7 100644
--- a/scripts/tests/ci/test_verify_improvement_proposals_wiki.py
+++ b/scripts/tests/ci/test_verify_improvement_proposals_wiki.py
@@ -106,6 +106,41 @@ def folder_of(wiki, badge_title, tree=None):
return next(f for f in (tree or wiki.AIP_TREE).folders if f.badge ==
badge_title)
[email protected](
+ "opening",
+ [
+ pytest.param(
+ '<ac:structured-macro ac:macro-id="y" ac:name="{name}"
ac:schema-version="1">', id="id-first"
+ ),
+ pytest.param('<ac:structured-macro ac:schema-version="1"
ac:name="{name}">', id="version-first"),
+ ],
+)
+def test_macros_are_read_whatever_their_attribute_order(wiki, opening):
+ folder = folder_of(wiki, "Under discussion")
+ state = (
+ opening.format(name="status")
+ + '<ac:parameter ac:name="title">Under
discussion</ac:parameter></ac:structured-macro>'
+ )
+ body = (
+ opening.format(name="details")
+ +
f"<ac:rich-text-body><table><tbody><tr><td>State</td><td>{state}</td></tr></tbody></table>"
+ "</ac:rich-text-body></ac:structured-macro>"
+ )
+ page = wiki.Page(
+ "7", "AIP-7 Reordered", body, [wiki.AIP_TREE.base_label,
wiki.AIP_TREE.get_label(folder)]
+ )
+
+ assert wiki.check_tree(*build_tree(wiki, pages={folder.page_id: [page]}))
== []
+
+
[email protected]("state", ["UNDER DISCUSSION", "under discussion"])
+def test_state_badge_case_is_not_reported(wiki, state):
+ folder = folder_of(wiki, "Under discussion")
+ page = aip(wiki, folder, state=state)
+
+ assert wiki.check_tree(*build_tree(wiki, pages={folder.page_id: [page]}))
== []
+
+
@pytest.mark.parametrize("tree_name", ["AIP_TREE", "ADIP_TREE"])
def test_consistent_trees_have_no_problems(wiki, tree_name):
assert wiki.check_tree(*build_tree(wiki, tree=getattr(wiki, tree_name)))
== []