Skip to content

Commit fdb3729

Browse files
ci: count regex matches not content delta in version-sync assertion (#150)
The version-sync step asserted `new != s`, which fires when parent and example versions already agree (the rewrite is an identity no-op, no content change). Post-merge run on main hit this immediately because the parent is at 6.1.0 and the example was already pinned to 6.1.0. Use re.subn to count matches and assert count >= 1 — a no-op rewrite when versions match is the expected steady state; a zero-match means the pom layout drifted and CI should fail loud.
1 parent 6fa1e62 commit fdb3729

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/integration.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,24 @@ jobs:
141141
echo "Parent SDK version: ${PARENT_VERSION}"
142142
# Replace the axonflow-sdk dependency version in examples/basic/pom.xml.
143143
# Anchored on the artifactId on the previous line to avoid touching
144-
# other deps.
144+
# other deps. Asserts the regex matched (count >= 1) so a layout
145+
# drift fails CI loud; a no-op rewrite (versions already match)
146+
# is fine.
145147
python3 - <<PY
146148
import re, pathlib
147149
p = pathlib.Path("examples/basic/pom.xml")
148150
s = p.read_text()
149-
new = re.sub(
151+
new, count = re.subn(
150152
r"(<artifactId>axonflow-sdk</artifactId>\s*<version>)[^<]+(</version>)",
151153
rf"\g<1>${PARENT_VERSION}\g<2>",
152154
s,
153155
)
154-
assert new != s, "Failed to rewrite example pom version"
155-
p.write_text(new)
156+
assert count >= 1, "Regex did not match — examples/basic/pom.xml layout drifted"
157+
if new != s:
158+
p.write_text(new)
159+
print(f"Rewrote example pom version to ${PARENT_VERSION}")
160+
else:
161+
print(f"Example pom already at parent version ${PARENT_VERSION} (no-op)")
156162
PY
157163
grep -A 1 "axonflow-sdk" examples/basic/pom.xml | head -4
158164

0 commit comments

Comments
 (0)