Repository navigation
Type the Docker build-info payload as a BuildInfo TypedDict (P311-02) - #4106
Merged
Roman Lutz (romanlutz) merged 3 commits intoNov 9, 2026
Merged
Roman Lutz (romanlutz) merged 3 commits into
Roman Lutz (romanlutz) merged 3 commits into
Conversation
_load_build_info returned dict[str, Any] and the route read four known keys with stringly-typed .get calls. BuildInfo declares source, commit, modified and display as NotRequired, mirroring RawAnalyticsProfile, so absent keys stay distinguishable from nullable values and key names are checked. Runtime behavior, the JSON load and the warning-path fallback are unchanged; tests pin the key set and the absent-display fallback to the package version.
19 of 25 tasks
Roman Lutz (romanlutz)
self-requested a review
November 9, 2026 13:30
Roman Lutz (romanlutz)
approved these changes
Nov 9, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Roman Lutz (romanlutz)
approved these changes
Nov 9, 2026
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.
Description
Implements the P311-02 focused case from #3166 (reserved here, due 2026-11-12): the Docker build-info payload in
pyrit/backend/routes/version.py._load_build_infotyped the parsed/app/build_info.jsonasdict[str, Any], and the route read four known keys (source,commit,modified,display) with absent-tolerant.getsemantics (displayfalls back to the package version). This introduces aBuildInfoTypedDict withNotRequiredmembers, mirroringRawAnalyticsProfile's style, so absent keys stay distinguishable from nullable values and the key names are checked rather than stringly typed. No Pydantic runtime validation is introduced or replaced.Unchanged: the JSON load, the warning-path fallback, and every route behavior.
Tests
test_build_info_keys_are_not_requiredpins the TypedDict's exact key set and that an empty payload is valid.test_get_version_build_info_absent_display_falls_backproves a file withoutdisplayfalls back to the package version (the absent-vs-null distinction this item asks for).TestVersionRoutes: 6/6 pass locally;ty check: all checks passed; ruff check/format clean.Checklist
AI assistance disclosure: prepared with an AI coding agent (GLM-5.3) under my direction; I reviewed each line, ran the suite and type checks locally, and stand behind the change.