Whole file
hirak99/yabsnap
The author described this change as “fix(logging): added a friendly message if snaptype is UNKNOWN”. It counts as a record because the check below fails on the code as it stood at 5b7dc35a6 and passes on 0aa9496c4, with nothing else changed between the two runs.
Projecthirak99/yabsnap
Fix saved2025-01-17
Sharing licenceApache-2.0 · LICENSE
Change size+8 −1
What the code was meant to do, written into the code itself as a save note
fix(logging): added a friendly message if snaptype is UNKNOWN
The change
| 101 | 101 | ||
| 102 | 102 | @property | |
| 103 | 103 | def _snap_type(self) -> snap_mechanisms.SnapType: | |
| 104 | - | return snap_mechanisms.SnapType[self.metadata.snap_type] | |
| 104 | + | snap_type = snap_mechanisms.SnapType[self.metadata.snap_type] | |
| 105 | + | if snap_type == snap_mechanisms.SnapType.UNKNOWN: | |
| 106 | + | logging.warning( | |
| 107 | + | f"Cannot determine type for '{self.target}'.\n" | |
| 108 | + | f"This may occur if the metadata '{self._metadata_fname}' was manually deleted.\n" | |
| 109 | + | f"If so, also delete the snapshot '{self.target}' manually." | |
| 110 | + | ) | |
| 111 | + | return snap_type | |
| 105 | 112 | ||
| 106 | 113 | def as_json(self) -> dict[str, Any]: | |
| 107 | 114 | result: dict[str, Any] = {} |
The check that tells the two apart
fail→pass·src/code/snap_holder_test.py::SnapHolderTest::test_warn_unknown_type
Check file src/code/snap_holder_test.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it5b7dc35a635ecae4da03ed0b321e032148bdc2bc
Broken version dated2025-01-12
Modulecode.snap_holder
Units changedSnapshot
Fingerprint29b1aafa3e694c46
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.