Keep the byte counts on NotEnoughFreeSpaceError - #427
Open
bernalvinicius wants to merge 2 commits into
Open
Conversation
The error accepted required/available/file_system, used them to build the message and then discarded them, so callers could only recover the numbers by parsing the message text. They are now kept as attributes, along with a precomputed shortfall. The message itself gained thousands separators and the shortfall, since a nine-digit byte count is hard to read and the remaining space was left for the reader to work out. The legacy min_space form is unchanged; its byte attributes are None.
bernalvinicius
requested review from
jeffkala,
pke11y and
pszulczewski
as code owners
August 17, 2026 23:48
jvanderaa
reviewed
Aug 18, 2026
jvanderaa
left a comment
Contributor
There was a problem hiding this comment.
Update to single backticks.
Co-authored-by: Josh VanDeraa <josh@josh-v.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 #426
Explanation of Change(s)
NotEnoughFreeSpaceErroracceptedrequired,availableandfile_system, used them to build the message string, and then dropped them — the values were only recoverable by parsingmessage. They are now kept as attributes, along with a precomputedshortfall.The message also gained thousands separators and the shortfall, since a nine-digit byte count is hard to read and the remaining space was left for the reader to work out:
The legacy
min_spaceform is untouched; its byte attributes areNone.Heads-up on the message change: the wording is observable to anyone parsing it. That is exactly the situation this fixes — nautobot-app-os-upgrades was regexing the counts back out of
messageand drops that workaround once this lands.Added change log fragment(s)
changes/426.changedUnit, Integration Tests
Four new tests in
tests/unit/test_errors.pycover the stored attributes, the message with counts and shortfall, the message without a file system, and the legacy form leaving the byte attributes unset. Full suite: 950 passed, 26 skipped.Outline Remaining Work, Constraints from Design
None.