Skip to content

feat: log coglet build info and SDK version at startup#2829

Merged
michaeldwan merged 4 commits intomainfrom
md/print-version-info
Mar 12, 2026
Merged

feat: log coglet build info and SDK version at startup#2829
michaeldwan merged 4 commits intomainfrom
md/print-version-info

Conversation

@michaeldwan
Copy link
Copy Markdown
Member

@michaeldwan michaeldwan commented Mar 12, 2026

Summary

  • Log coglet version, git sha (+dirty), build time, and debug/release mode at container boot
  • Log Python SDK and Python versions at startup
  • Expose git_sha and build_time in /health-check response for identifying running containers without log access
  • Rename cog to python_sdk in VersionInfo to align with naming convention (cog = suite, coglet = in-container server, python_sdk = SDK models are built on)

Startup log output

coglet 0.17.0-rc.1 (abc1234-dirty, built 2026-03-12T18:00:00Z, debug)
python sdk 0.17.0rc1
python 3.12.0

/health-check response

{
  "status": "READY",
  "version": {
    "coglet": "0.17.0-rc.1",
    "git_sha": "abc1234-dirty",
    "build_time": "2026-03-12T18:00:00Z",
    "python_sdk": "0.17.0rc1",
    "python": "3.12.0"
  }
}

Changes

  • crates/coglet-python/build.rs — Add COGLET_GIT_DIRTY env var; track .git/index for rebuild on staging changes
  • crates/coglet-python/src/lib.rs — Add dirty field to BuildInfo; enhanced startup log; log SDK/Python versions; wire build info into VersionInfo
  • crates/coglet/src/version.rs — Add optional git_sha and build_time fields to VersionInfo; rename cog field to python_sdk
  • Updated insta snapshot

Testing

  • 165 Rust unit tests pass
  • Clippy + fmt clean
  • Verified end-to-end with integration test: built container, started server, confirmed git_sha and build_time present in /health-check response

Print coglet version, git sha, dirty flag, build time, and debug/release
mode to logs on boot. Also log cog SDK and Python versions.

Expose git_sha and build_time in the /health-check response so running
containers can be identified without log access.

Add COGLET_GIT_DIRTY to build.rs and track .git/index for rebuild on
staging changes.
Align with naming convention: 'cog' is the suite, 'coglet' is the
in-container server, 'python_sdk' is the SDK models are built on.
clean:go was removing ./cog (legacy path) but build:cog outputs to
dist/go/*/cog, so 'mise clean && mise build' left a stale CLI binary.

Also add a _build_summary task that prints artifact paths and versions
after 'mise build'.
@michaeldwan michaeldwan marked this pull request as ready for review March 12, 2026 19:03
@michaeldwan michaeldwan requested a review from a team as a code owner March 12, 2026 19:03
@michaeldwan michaeldwan merged commit 46ad226 into main Mar 12, 2026
38 checks passed
@michaeldwan michaeldwan deleted the md/print-version-info branch March 12, 2026 19:22
michaeldwan added a commit that referenced this pull request Apr 7, 2026
Stubs drifted after the BuildInfo.dirty field was added in #2829 and
docstring updates in recent PRs. Regenerated with `mise run generate:stubs`.
github-merge-queue Bot pushed a commit that referenced this pull request Apr 8, 2026
* ci: add stub freshness check to CI

The generate:stubs mise task and stub:check already exist but weren't
enforced in CI, so .pyi stubs could drift when Rust source changed.

Adds a check-stubs job that runs `mise run --force stub:check` on Rust
changes, using --force to bypass sources/outputs mtime freshness (which
would skip regeneration in CI's fresh checkout).

* chore: regenerate coglet Python stubs

Stubs drifted after the BuildInfo.dirty field was added in #2829 and
docstring updates in recent PRs. Regenerated with `mise run generate:stubs`.

* fix(ci): set LD_LIBRARY_PATH for stub_gen in check-stubs

stub_gen is a PyO3 binary that dynamically links libpython. setup-uv
installs Python to a non-standard path, so the shared library isn't on
LD_LIBRARY_PATH by default. Query sysconfig for the correct LIBDIR.

* fix: restore dict[str, str] return type for Scope.context stub

Regression from #2853: the context property returns Py<PyDict> which
pyo3-stub-gen infers as bare `dict`. Add an override_return_type
annotation so the generated stub preserves the intended dict[str, str]
contract.

* fix(ci): use setup-python for shared libpython in check-stubs

stub_gen needs libpython3.x.so at runtime (PyO3 auto-initialize).
setup-uv's python-build-standalone is statically linked and doesn't
ship the .so, causing 'cannot open shared object file' at runtime.
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.

2 participants