Conversation
…l chain
Record the endpoints source commit in every run's report. resolve_git_sha
falls through baked build-info (wheels) -> ENDPOINTS_GIT_SHA (containers) ->
live git (dev) -> none, validating each channel against a hex-SHA grammar
([0-9a-fA-F]{7,64}, optional -dirty) and appending -dirty for uncommitted
tracked changes. The report now always prints
`Git SHA: <sha> (source: <channel>)` and records git_sha_source in
result_summary.json.
- utils/version.py: _valid_sha grammar on all channels; git-location env
family scrub (GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE/...); fail-to-dirty probe;
corrupt-bake tolerance; resolved once per report (no lru_cache)
- metrics/report.py: new required git_sha_source field; unconditional Git SHA
display line
- scripts/write_build_info.py: build-time generator (toplevel + hex validated,
own env scrub, atomic write); .dockerignore keeps a stray local bake out of
images; uv_build packs it into wheels
- docs/metrics/*, docs/utils/DESIGN.md: document the field + fallback chain
- tests: version, generator, report serialization
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
Comment on lines
+511
to
+512
| "from inference_endpoint.utils.version import resolve_git_sha;" | ||
| "print(resolve_git_sha()[1])", |
| import sys | ||
| from pathlib import Path | ||
|
|
||
| import inference_endpoint |
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.
What & why
Records the endpoints source commit in every run's report, so a
result_summary.json/report.txtis self-describing about which code produced it.resolve_git_sha()falls through a trust-ranked channel chain, validating eachagainst a hex-SHA grammar (
[0-9a-fA-F]{7,64}, optional-dirty):bakedscripts/write_build_info.py→ gitignored_build_info.py, packed by uv_buildenvENDPOINTS_GIT_SHA(docker--build-arg→ENV)gitgit rev-parse(anchored to the package, not cwd)noneThe SHA gains a
-dirtysuffix when tracked files are modified (fail-to-dirty onprobe error/timeout). The report now always prints
Git SHA: <sha> (source: <channel>), andgit_sha_sourceis recorded inresult_summary.json.Changes
utils/version.py— validated resolver chain; git repo-location env familyscrub (
GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE/…) so a strayGIT_DIRcan'tslip a foreign SHA past the toplevel guard; corrupt-bake tolerance; resolved
once per report (no
lru_cache).metrics/report.py— new requiredgit_sha_sourcefield; unconditionalGit SHA:display line.scripts/write_build_info.py— build-time generator (toplevel + hexvalidated, own env scrub, atomic write).
.dockerignorekeeps a stray localbake out of images.
docs/metrics/*,docs/utils/DESIGN.md) + tests.Testing
version.pyat 100% coverage.
converged clean.
sched_setaffinityfalse-positives (unrelated files; green on Linux CI).
Follow-ups (not in this PR)
it's a manual pre-
uv buildstep; containers use the env channel).--build-argin the image publish flow (companion to feat :Testing workflow to push images #405).Notes
Report.git_sha_sourceis a new required struct field; nothing decodesReportback from JSON, so there is no wire/back-compat break.
🤖 Generated with Claude Code