serve honours TPK_STREAM_PREFIX; report the running version everywhere (#84, #85) - #87
Merged
Merged
Conversation
…n everywhere (#84, #85) #84: tpk serve and the stdio MCP server ignored TPK_STREAM_PREFIX (ensure_schema, corpus/admin seeding, the KnowledgeGraph, the chat agent's live-corpus provider and create_app all ran unprefixed) while ingest/export/import/auth honoured it -- a prefixed deployment ingested into one set of streams and served another, and 'TPK_STREAM_PREFIX=x tpk serve' silently ran on the REAL streams. The prefix is now resolved once and threaded through every one of those. #85: the package hard-coded 0.1.0 while releases are v0.0.x, and nothing reported a version. tpk/version.py resolves it from TPK_VERSION/TPK_COMMIT (baked into published images by the Docker workflow -- the build context has no .git), else 'git describe', else 'dev'. Shown by 'tpk --version', /healthz ({status, version, commit}), the UI (sidebar footer + login page, read from the server), the serve startup line and MCP serverInfo.version. pyproject's version is now a documented placeholder; no hand-edited constant is reported anywhere. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #84. Closes #85.
#84 —
tpk serve/ stdio MCP ignoredTPK_STREAM_PREFIXingest,export/importandauthhonoured the prefix;serveandmcp_server.main()did not —ensure_schema, corpus seeding,seed_admin, the sharedKnowledgeGraph, the chat agent's live-corpus provider andcreate_app()all ran unprefixed. A prefixed deployment would ingest into one set of streams and serve from another, andTPK_STREAM_PREFIX=x tpk servesilently ran on the real streams (how this was found).The prefix is now resolved once in
serve/main()and threaded through all of those (create_appalready passed it to auth, API, usage, audit, graph and/mcp).#85 — which version is running?
The package said
0.1.0while releases arev0.0.x, and nothing reported a version at runtime.src/tpk/version.py— one resolver:TPK_VERSION/TPK_COMMIT(baked into the published images — the build context has no.git, so the image can't work it out itself) →git describefor a checkout →dev.tpk.__version__uses it;pyproject.toml'sversionbecomes a documented placeholder (0.0.0) that is reported nowhere, so there is no hand-edited constant to forget.ARG TPK_VERSION/TPK_COMMIT→ENVin both final stages (placed late, so no extra cache busting); the Docker workflow passes the tag without itsv(ordev-<sha>for branch/PR builds) and the commit.tpk --version→tpk 0.0.5 (bc549ef);GET /healthz→{"status","version","commit"}(unauthenticated on purpose: a rollout check becomes onecurl); web UI sidebar footer + login page (fetched from/healthz, so it is the server's version, tooltip shows the commit, hidden when the sidebar is collapsed); thetpk servestartup line; MCPserverInfo.version.Testing
tests/test_version.py(env → version, leadingvdropped,git describefallback,devfallback, CLI flag,/healthz, MCP server version) andtests/test_serve_prefix.py— real DB: a user and a graph node that exist only under the prefix are reachable through the apptpk servebuilds (login +/api/graph/search), corpus seeding lands in the prefixed registry, and the stdio server'sKnowledgeGraphcarries the prefix. Both prefix tests were confirmed to fail without the fix.pytest: 313 passed, 10 skipped, 1 failed —tests/test_ingest.py::test_ingest_repo_passes_extraction_and_backend, environment-dependent and failing onmaintoo.tests/test_server.py::test_healthzupdated for the new body.npm run build+npm run check:sanitizeclean.docker build --target app --build-arg TPK_VERSION=9.9.9 --build-arg TPK_COMMIT=…→tpk --versionprintstpk 9.9.9 (bc549ef); without build-args →tpk dev; this checkout →tpk 0.0.5-dirty (bc549ef).tpk servein a throwaway database withTPK_STREAM_PREFIX=pfx_: startup linetpk 0.0.6 (abc1234) starting on … (stream prefix 'pfx_');/healthz→{"status":"ok","version":"0.0.6","commit":"abc1234"}; all 11 streams created carry the prefix, none unprefixed; seeded admin logs in; browser check:v0.0.6on the login page and in the sidebar footer (tooltiptpk 0.0.6 (abc1234)), hidden when collapsed.Notes
/healthz's body gained two keys — anything asserting it equals{"status":"ok"}exactly needs updating (k8s probes here use/and TCP, unaffected).curl https://<host>/healthzand check the version.🤖 Generated with Claude Code