fix(build): stop bump_version clobbering mypy python_version (main reads 2.3.0)#435
Conversation
The [project] version bump used an unanchored regex (`version = "..."`) that also matched the tail of `python_version = "..."` under [tool.mypy], so every release rewrote the mypy target with the package version (main currently reads `python_version = "2.3.0"`, an invalid target). Anchor the substitution to the start of a line and cap it to the first match so only the project version is rewritten, and repair the current value to "3.10" (matching `requires-python >= 3.10` and Black's py310). Co-authored-by: Kiro Agent <244629292+kiro-agent@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #435 +/- ##
=======================================
Coverage ? 88.39%
=======================================
Files ? 137
Lines ? 16369
Branches ? 0
=======================================
Hits ? 14470
Misses ? 1899
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gutosantos82
left a comment
There was a problem hiding this comment.
PR Review: #435 — fix(build): stop bump_version clobbering mypy python_version (main reads 2.3.0)
- Head:
1f91b9d439314a76a3d38d59d51c4aaf8c987b88(current at review time, 2026-07-15) - Size: +6 / −2 across 2 files (
pyproject.toml,scripts/bump_version.py) — no runtime code - State: OPEN, MERGEABLE,
reviewDecision=REVIEW_REQUIRED; all 20 CI checks pass at this
head (Code Quality, Unit Tests 3.10/3.11, Security Scan, Trivy, Dependency Review, MCP Apps). - Comments: Codecov bot only ("all modified and coverable lines covered"); no human feedback.
- Ref: split out of the AG-UI workstream (#386); prerequisite for a meaningful type-check
gate on #436.
Summary
Fixes a real, verified release-tooling bug: update_pyproject in scripts/bump_version.py
used an unanchored version = "[^"]+" substitution, which also matches the tail of
python_version = "..." under [tool.mypy], so every release bump rewrote the mypy target
with the package version. The PR anchors the pattern to line start with (?m)^ and caps it
with count=1, and repairs the current corrupted value to python_version = "3.10" (matching
requires-python = ">=3.10" and Black's py310). Diagnosis, fix, and the PR body's
verification claim are all accurate. Recommend approve; two optional nits.
Blocking (must fix before merge)
None found.
Important (should fix)
None found.
Nits (optional)
- [consistency] scripts/bump_version.py:17 (
get_version) — the read side still uses the
unanchoredre.search(r'version = "([^"]+)"', ...). It is correct today only because the
[project]version (line 3) happens to be the file's first match; if the key order ever
changed,get_versionwould silently pick up a wrong value and the next bump would compound
it. Since this PR's whole point is un-fragile version rewriting, anchoring the read side the
same way ((?m)^version = "([^"]+)") would finish the job. One-line change. - [tests] scripts/bump_version.py — no regression test. A tiny unit test asserting that
update_pyprojectrewrites only the[project]version and leaves
[tool.mypy].python_versionuntouched would prevent this exact class of regression from
returning;scripts/currently has no test coverage at all, so this is a nice-to-have, not
a gate.
Prior feedback (already raised — not restating)
None — no human feedback on the PR at review time.
Tests
No tests added (see nit above). Acceptable for a two-line build-script fix: the change is
fully characterized by the simulation below, all existing suites pass at this head, and the
repaired python_version cannot break CI because every mypy step in the workflows
(ci.yml and all four provider workflows) runs with continue-on-error: true — mypy is
advisory. Note that repairing the value makes mypy actually run with a valid target for the
first time in a while, so the advisory step may start reporting pre-existing type errors that
the corrupted config previously masked; that is the intended effect (and the stated
prerequisite for the type gate on #436), not a regression.
Verification
Performed directly at this head (worktree checkout of 1f91b9d4):
- ✓ VERIFIED — the bug exists as described: simulated the old (main) regex against the
PR-headpyproject.toml→ bothversionandpython_versionrewritten to the bump value.
Corroborated historically: my local staleorigin/mainshowspython_version = "2.1.1"and
the PR reports current main at"2.3.0"— i.e. successive releases each stamped the
then-current package version, exactly the claimed clobbering. - ✓ VERIFIED — the fix works as described: simulated the new regex
((?m)^version = "[^"]+",count=1) → only the[project]version changes;
python_version = "3.10"untouched.pyproject.tomlat this head contains exactly one
line-anchoredversion =line (line 3), andtarget-version(Black) cannot match a
^versionanchor, socount=1selects the right line deterministically. - ✓ VERIFIED —
get_version()still resolves the correct value at this head (first match is
the[project]version), so the read/write pair stays consistent (see nit). - ✓ VERIFIED — no CI breakage possible from the repaired mypy target: all five mypy
invocations across the workflows arecontinue-on-error: true. - ✓ VERIFIED — all 20 checks pass at this head (
gh pr checks 435).
Verdict
Approve with nits — correct, minimal, honestly described fix to real release-tooling
corruption, verified end-to-end by simulation; the two nits (anchor get_version too, add a
regression test) are optional follow-ups.
…G.md conflict) Resolves the CHANGELOG.md [Unreleased]/Fixed conflict gutosantos82 flagged (mergeStateStatus was DIRTY): combined our awslabs#397 entry with upstream's awslabs#417/ awslabs#414 entries and the awslabs#142 Security entry (awslabs#427/awslabs#429/awslabs#434/awslabs#435 landed on main since the last merge). Also extended the awslabs#397 entry per gutosantos82's optional nit — it now mentions the burst-then-settle and cold-start detection additions and points at the new env vars in docs/configuration.md. Nothing else needed manual resolution — every other file (README.md, constants.py, api/main.py, terminal_service.py, the new graph-layer sink files) auto-merged cleanly; verified the PIPE_LIVENESS_* constants block in constants.py is untouched by the auto-merge. Verified post-merge: black --check clean on the three touched fifo files, full suite 4075 passed / 0 failed / 21 skipped (up from 3988 -- the delta is upstream's own new graph-sink tests merged in, not anything from this branch).
Problem
[tool.mypy].python_versiononmainis"2.3.0"— the package version, not a Python target.scripts/bump_version.pyrewrites it on every release becauseupdate_pyprojectuses an unanchored regex:version = "..."also matches the tail ofpython_version = "..."under[tool.mypy], so each bump clobbers the mypy target. This means mypy is not type-checking against the supported floor (requires-python = ">=3.10", Blackpy310).Fix
[project]version is rewritten:python_version = "3.10".Verification
Simulated a bump against the real
pyproject.toml: the[project]version updates whilepython_versionstays"3.10"(previously it was overwritten). Two-line change; no runtime code touched.Co-authored-by: Kiro Agent 244629292+kiro-agent@users.noreply.github.com
Context / Refs #386 — surfaced while rebasing the AG-UI workstream (#386) onto latest
main; a valid[tool.mypy].python_versionis a prerequisite for the type-check gate to be meaningful on the feature PR (#436). This fix is independent and can merge on its own.