feat(agent-email): single-source version stamping + publish-time --check (bump 0.2.0)#1822
Conversation
…eck (bump 0.2.0) The email package version lived in eight files of six types (Python, YAML, TOML, JSON, Markdown, HTML) with no sync tool, so references drifted: on main binaries.lock.json still pointed agentVersion + baseUrl at email/0.1.0 while every other file had already moved to 0.2.0 — a stale static reference to a prior hub deployment that nothing caught. Make AGENT_VERSION in gaia_agent_email/version.py the one source of truth and add packaging/stamp_version.py to stamp every downstream reference from it (mirrors installer/version/bump-ui-version.mjs). Default mode stamps; --check verifies and exits non-zero on any drift. Wired --check into the release job (before publish) and the unit-test PR workflow (early drift detection). Targets absent on main (npm README image URL, assets/architecture.html — they land on other in-flight branches) are skipped-with-warning so the script works across that partial state and stamps them once those branches merge. API_VERSION (the REST/contract version) is deliberately untouched — it is the contract version, independent of the package build version.
SummarySolid, tightly-scoped DevOps PR that closes a real gap: the email package's version lived in eight files across six formats with no sync tool, and Issues Found🟡 ImportantSkip-on-no-match can mask drift in always-present targets ( Every rule is treated identically: if its regex finds no match, the target is skipped-with-warning and The patterns are format-fragile in ways that make this concrete, not hypothetical — e.g. the package.json rule hardcodes a two-space indent ( Cheap fix: mark the always-present rules required and fail (not skip) when a required rule matches nothing. @dataclass
class Rule:
label: str
path: Path
pattern: re.Pattern
field: str
required: bool = False # always-present targets: no-match is a FAILURE, not a skipThen in 🟢 MinorTest coverage gap mirrors the issue above ( Strengths
VerdictApprove with suggestions. No blocking defects — the script does what it claims and is well-tested. The 🟡 is a hardening of the PR's own central guarantee (don't let a mandatory target's drift pass silently) with a low-cost fix; reasonable to land in this PR or a fast follow-up, author's call. |
Why this matters
The email package's version lived in eight files of six different types (Python, YAML, TOML, JSON, Markdown, HTML) with no tool to keep them in sync, so references drifted silently. On
mainright now,binaries.lock.jsonstill pins bothagentVersionandbaseUrlto…/agents/email/0.1.0while every other file already says0.2.0— a static pointer to a prior hub deployment that no test caught. After this change,AGENT_VERSIONinversion.pyis the one source of truth, a stamp script syncs every other reference from it, and a--checkmode fails the build loudly on any mismatch — so a stale version reference can never ship again.Mirrors the Agent UI's existing pattern (
installer/version/bump-ui-version.mjs: one source → stamps dependents →--checkgated in CI).Stamped file types (all driven from
AGENT_VERSION): the YAML manifest,pyproject.toml, npmpackage.json, the lock'sagentVersion+baseUrl, the two README image URLs, and thearchitecture.htmlversion badge.API_VERSION(the REST/contract version) is deliberately not touched — it's the contract version, independent of the package build version.Cross-branch skip-with-warning: three npm-side targets (README image URLs,
assets/architecture.html) don't exist onmainyet — they live on in-flight branches (#1776, #1814). The script skips them with a warning rather than failing, so it works across the partial state today and will stamp them correctly once those branches merge. This PR only touches version strings + the new script + the two workflows + the new test; it does not touch the playground HTML, the/v1/email/initendpoint, or the npm client (owned by #1814/#1813/#1776).This PR also fixes the existing
binaries.lock.jsondrift (0.1.0 → 0.2.0) as the first run of the new stamper.Test plan
python hub/agents/python/email/packaging/stamp_version.py --checkpasses on the post-bump tree (exit 0)--checkexit non-zero (covered bytest_stamp_version.py)python -m pytest hub/agents/python/email/tests/test_stamp_version.py— 10 passed (hermetic, no network)test_agent_version_matches_package_export+test_agent_version_matches_package_metadata(pyproject + in-codeAGENT_VERSIONboth 0.2.0)black+isortclean on the new files--checkwired intorelease_agent_email.yml(before publish) andtest_email_agent_unit.yml(early PR drift gate; npm-side paths added to its triggers)