Bugfix spec: the-loop --version reports stale hardcoded 0.1.0
Phase 1 of 3 for a bug (bugfix → design → tasks).
Summary
the-loop --version prints the-loop 0.1.0 regardless of the installed package version. The package installed via uv tool install the-loopy-one is 0.14.0, but the CLI still reports 0.1.0 because the version string is hardcoded in cli/the_loop/__init__.py (__version__ = "0.1.0") rather than derived from package metadata. Tracked as issue #78.
Steps to reproduce
uv tool install the-loopy-one(installs the current release, e.g. 0.14.0).- Run
the-loop --version. - Observe the output:
the-loop 0.1.0.
Expected vs actual
- Expected:
the-loop --versionreports the actually-installed package version (the-loop 0.14.0). - Actual: it always prints
the-loop 0.1.0.
Root cause (confirmed)
__version__ was a literal "0.1.0" in cli/the_loop/__init__.py. Commitizen owns the canonical version in .cz.toml and rewrites every artifact listed in version_files on a bump — but cli/the_loop/__init__.py is not one of those targets (only cli/pyproject.toml and the plugin/marketplace manifests are). So the hardcoded __version__ was never touched by a release and silently froze at 0.1.0 while the published [project] version advanced to 0.14.0. This is the same failure mode as issue #46 (manifests frozen at 0.1.0), applied to the CLI's own __version__.
The webhook receiver carried the same latent hardcoded string (server_version = "the-loop-gh-webhook/0.1.0" in cli/the_loop/webhook/server.py).
Acceptance criteria (EARS)
- WHEN
the-loop --versionruns against an installed package THEN the system SHALL report the installed distribution's version (derived from package metadata), not a hardcoded string. the_loop.__version__SHALL equalimportlib.metadata.version("the-loopy-one")for an installed package, and SHALL NOT be"0.1.0".- WHEN the package is imported from an uninstalled source tree (no metadata) THEN
__version__SHALL fall back to a clearly non-release sentinel rather than raising. - The webhook receiver's
Serverheader SHALL carry the derived version rather than a second hardcoded0.1.0.
Out of scope
- Adding
cli/the_loop/__init__.pyto.cz.tomlversion_files. Deriving from metadata removes the drifting duplicate entirely, so no new lockstep target is needed. - Changing the release/bump machinery or the canonical version source.
Security considerations
None. The change reads local package metadata (importlib.metadata) — no new input, network, or trust boundary. The Server header already advertised a version string; it now advertises the accurate one, which does not increase exposure.
Open questions
None.