Skip to content

Verify the version in the package workflow, not in a unit test (speedkick) - #1604

Merged
edwinyyyu merged 1 commit into
MemMachine:speedkickfrom
edwinyyyu:fix/version-test-post-release-speedkick
Sep 10, 2026
Merged

edwinyyyu merged 1 commit into
MemMachine:speedkickfrom
edwinyyyu:fix/version-test-post-release-speedkick

Conversation

@edwinyyyu

@edwinyyyu edwinyyyu commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Every pull request against speedkick fails the "Run Python unit tests" job on ubuntu and macos with

FAILED packages/server/server_tests/memmachine_server/common/api/test_version.py::test_get_version
AssertionError: Invalid server version: 0.3.9.post2.dev14+g2c69bb83e

Cause

The annotated tag v0.3.9-post1 ("Post-release build from speedkick, after v0.3.9", 2026-08-31) sits on speedkick's ancestry and is the nearest tag for every commit since. setuptools-scm therefore renders each speedkick build as 0.3.9.post2.devN+g<sha>. The test's hand-written pattern only allowed release[.devN[+local]], so it rejected a version setuptools-scm produces by design. main is unaffected because the tag is not reachable from it.

Why the test is deleted rather than patched

get_version() is a wrapper around importlib.metadata.version for two distribution names. Nothing in it produces a version shape; the shape comes from setuptools-scm, the repository's tags and the working tree. So the test could only ever fail for environmental reasons, and that is its whole history:

Date PR What broke the regex
2026-01-29 #993 dotted local segment +g<sha>.d<date>
2026-02-04 #1038 two-component tag 0.1
2026-09-10 this post-release tag v0.3.9-post1

The function under test has not changed since #951 wrote it. The test also rejected a documented output: #951 specifies client_version as "not available" when memmachine-client is not installed, which is the case for a wheel install of the server (the server package does not depend on the client). It passed only because the uv workspace installs every member.

test_version_string stays; it tests the model's own string form.

Where the check goes instead

The Test Server Package workflow already builds the wheels and installs them. A new step runs the installed memmachine-server --version and requires the reported server version to equal the version in the wheel's filename. That ties the binary to the artifact it shipped in without asserting anything about the version's format, so tag conventions can change without touching it.

Verification

  • The trimmed test file passes and is clean under ruff check and ruff format --check.
  • The new workflow step, extracted verbatim from the YAML and run against wheels built from this tree and installed into a fresh virtualenv, passes.

Out of scope: the windows unit-test jobs mask this failure

The windows jobs report success only because the step runs under pwsh, which does not stop on the first command's non-zero exit and returns the status of the last command (the client suite). The windows server run on #1602 actually fails three tests: this one plus two windows-only failures, test_nebula_graph_vector_literals.py::test_only_one_site_turns_a_vector_into_a_literal (cp1252 decode of a file read without an encoding) and test_index_persistence.py::TestFlushGuards::test_a_writer_that_replaces_the_file_fails_the_save (error-message regex mismatch). Forcing bash on the step would turn windows red until those two are fixed, so the masking is left as is here.

🤖 Generated with Claude Code

https://claude.ai/code/session_019zu1CSWVso2NA4bWPYmw8Z

Every pull request against speedkick fails the "Run Python unit tests"
job on ubuntu and macos with

    FAILED .../common/api/test_version.py::test_get_version
    AssertionError: Invalid server version: 0.3.9.post2.dev14+g2c69bb83e

The annotated tag v0.3.9-post1 (2026-08-31, "Post-release build from
speedkick, after v0.3.9") sits on speedkick's ancestry and is the
nearest tag for every commit since, so setuptools-scm renders each
build as 0.3.9.post2.devN+g<sha>. The test's hand-written pattern had
no post-release segment. main is unaffected because the tag is not
reachable from it.

The test is deleted rather than patched. get_version() is a wrapper
around importlib.metadata.version for two distribution names; nothing
in it produces a version shape. The shape comes from setuptools-scm,
the repository's tags and the working tree, so the test could only
ever fail for environmental reasons, and that is its whole history:
the regex was widened in MemMachine#993 (dotted local segment), MemMachine#1038
(two-component tag) and would have been again here, while the function
under test has not changed since MemMachine#951 wrote it. It also rejected a
documented output: MemMachine#951 specifies client_version as "not available"
when memmachine-client is not installed, which is the case for a wheel
install of the server, whose package does not depend on the client.
The test passed only because the uv workspace installs every member.
test_version_string stays; it tests the model's own string form.

The check moves to the layer that owns it. The Test Server Package
workflow already builds the wheels and installs them; a new step runs
the installed memmachine-server --version and requires the reported
server version to equal the version in the wheel's filename. That ties
the binary to the artifact it shipped in without asserting anything
about the version's format.

Verified locally on this branch: the trimmed test file passes and is
clean under ruff check and ruff format --check; the new step, run
verbatim against wheels built from this tree and installed into a
fresh virtualenv, passes.

The windows unit-test jobs report success only because the step runs
under pwsh, which does not stop on the first command's non-zero exit
and returns the last command's status (the client suite). Their server
run fails this test plus two windows-only tests
(test_nebula_graph_vector_literals charmap decode, test_index_persistence
flush guard). That masking is left as is: forcing bash on the step
would turn windows red until those two are fixed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019zu1CSWVso2NA4bWPYmw8Z
@edwinyyyu
edwinyyyu force-pushed the fix/version-test-post-release-speedkick branch from 34bedc1 to 565d7f4 Compare September 10, 2026 17:36
@edwinyyyu edwinyyyu changed the title Accept post-release versions in the server version test (speedkick) Verify the version in the package workflow, not in a unit test (speedkick) Sep 10, 2026
@edwinyyyu
edwinyyyu merged commit 0b15fad into MemMachine:speedkick Sep 10, 2026
38 of 39 checks passed
malatewang added a commit that referenced this pull request Sep 19, 2026
test_get_version asserts that get_version() returns a version matching a
hand-written pattern: release, optional .devN, optional local segment.
On speedkick that assertion fails on every pull request, because the
annotated tag v0.3.9-post1 (2026-08-31, "Post-release build from
speedkick, after v0.3.9") sits on that branch's ancestry and
setuptools-scm renders each build as 0.3.9.post2.devN+g<sha>, a shape
the pattern never allowed. main passes today only because that tag is
not yet reachable from it; it becomes reachable the moment speedkick
merges, and any post-release tag would do the same.

The test is deleted rather than patched. get_version() is a wrapper
around importlib.metadata.version for two distribution names; nothing
in it produces a version shape. The shape comes from setuptools-scm,
the repository's tags and the working tree, so the test could only
ever fail for environmental reasons, and that is its whole history:
the regex was widened in #993 (dotted local segment), #1038
(two-component tag) and would have been again here, while the function
under test has not changed since #951 wrote it. It also rejected a
documented output: #951 specifies client_version as "not available"
when memmachine-client is not installed, which is the case for a wheel
install of the server, whose package does not depend on the client.
The test passed only because the uv workspace installs every member.
test_version_string stays; it tests the model's own string form.

The check moves to the layer that owns it. The Test Server Package
workflow already builds the wheels and installs them; a new step runs
the installed memmachine-server --version and requires the reported
server version to equal the version in the wheel's filename. That ties
the binary to the artifact it shipped in without asserting anything
about the version's format.

Verified locally on this branch: the trimmed test file passes and is
clean under ruff check and ruff format --check; the new step, run
verbatim against wheels built from this tree and installed into a
fresh virtualenv, passes (and reports "client: not available", which
the deleted test would have rejected).

Unrelated but worth knowing: the pytest workflow's test step has no
shell key, so on windows it runs under pwsh, which does not stop on the
first command's non-zero exit and returns the last command's status
(the client suite). A server-suite failure on windows would not fail
the job. On main the windows server run passes today (1830 passed on
#1584's run), so nothing is hidden yet; on speedkick two windows-only
failures are. Forcing bash there is left for when those are fixed.

Same change as #1604 on speedkick, applied to main.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Shu Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant